[go: nahoru, domu]

shelf: Separate back button and app list button.

Seperate the back button and app list button into separate elements.
Draws the background in ShelfView::OnPaint. This fixes issues with ink
drop and accessibility focusing not working correctly. Made changes to
ShelfView focus search to accommodate this.

Add back_button_unittest.
Removed app_list_button/back button ink drop unittest which tested
if different parts of the old app list button's ink drop acted
different if different parts were pressed. Not needed as the two
separate buttons' ink drops should work normally.
Removed app_list_button rtl unittest as the buttons should be flipped
normally by the views rtl handling.

Test: ash_unittests *Shelf* *ApplistButton* *BackButton*
Bug: 791638, 758402
Change-Id: I07bdd0b490ffb2619a13cebacf388e2e08190114
Reviewed-on: https://chromium-review.googlesource.com/761856
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Mitsuru Oshima <oshima@chromium.org>
Reviewed-by: Michael Wasserman <msw@chromium.org>
Commit-Queue: Sammie Quon <sammiequon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#524301}
diff --git a/ash/shelf/app_list_button.h b/ash/shelf/app_list_button.h
index 78895df..273b0f4 100644
--- a/ash/shelf/app_list_button.h
+++ b/ash/shelf/app_list_button.h
@@ -20,10 +20,11 @@
 }  // namespace base
 
 namespace ash {
+
+class AssistantOverlay;
 class InkDropButtonListener;
 class Shelf;
 class ShelfView;
-class AssistantOverlay;
 
 // Button used for the AppList icon on the shelf.
 class ASH_EXPORT AppListButton : public views::ImageButton,
@@ -41,24 +42,12 @@
 
   bool is_showing_app_list() const { return is_showing_app_list_; }
 
-  // Updates background and schedules a paint.
-  void UpdateShelfItemBackground(SkColor color);
-
   // views::ImageButton:
   void OnGestureEvent(ui::GestureEvent* event) override;
 
   // Get the center point of the app list button circle used to draw its
   // background and ink drops.
-  gfx::Point GetAppListButtonCenterPoint() const;
-
-  // Get the center point of the app list button back arrow. Returns an empty
-  // gfx::Point if the back arrow is not shown.
-  gfx::Point GetBackButtonCenterPoint() const;
-
-  // Called by ShelfView to notify the app list button that it has started or
-  // finished a bounds animation.
-  void OnBoundsAnimationStarted();
-  void OnBoundsAnimationFinished();
+  gfx::Point GetCenterPoint() const;
 
  protected:
   // views::ImageButton:
@@ -90,15 +79,6 @@
 
   void StartVoiceInteractionAnimation();
 
-  // Helper function to determine whether and event at |location| should be
-  // handled by the back button or the app list circle. Returns false if we are
-  // not in tablet mode (there is no back button).
-  bool IsBackEvent(const gfx::Point& location);
-
-  // Generate and send a VKEY_BROWSER_BACK key event when the back button
-  // portion is clicked or tapped.
-  void GenerateAndSendBackEvent(const ui::LocatedEvent& original_event);
-
   // Whether the voice interaction style should be used.
   bool UseVoiceInteractionStyle();
 
@@ -107,10 +87,7 @@
 
   // True if the app list is currently showing for this display.
   // This is useful because other IsApplistVisible functions aren't per-display.
-  bool is_showing_app_list_;
-
-  // Color used to paint the background.
-  SkColor background_color_;
+  bool is_showing_app_list_ = false;
 
   InkDropButtonListener* listener_;
   ShelfView* shelf_view_;
@@ -122,10 +99,6 @@
   std::unique_ptr<base::OneShotTimer> assistant_animation_hide_delay_timer_;
   base::TimeTicks voice_interaction_start_timestamp_;
 
-  // Flag that gets set each time we receive a mouse or gesture event. It is
-  // then used to render the ink drop in the right location.
-  bool last_event_is_back_event_ = false;
-
   DISALLOW_COPY_AND_ASSIGN(AppListButton);
 };