| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef ASH_SHELF_APP_LIST_BUTTON_H_ | 5 #ifndef ASH_SHELF_APP_LIST_BUTTON_H_ |
| 6 #define ASH_SHELF_APP_LIST_BUTTON_H_ | 6 #define ASH_SHELF_APP_LIST_BUTTON_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "ui/views/controls/button/image_button.h" | 9 #include "ui/views/controls/button/image_button.h" |
| 10 | 10 |
| 11 namespace ash { | 11 namespace ash { |
| 12 class InkDropButtonListener; |
| 12 class ShelfView; | 13 class ShelfView; |
| 13 | 14 |
| 14 // Button used for the AppList icon on the shelf. | 15 // Button used for the AppList icon on the shelf. |
| 15 class AppListButton : public views::ImageButton { | 16 class AppListButton : public views::ImageButton { |
| 16 public: | 17 public: |
| 17 explicit AppListButton(ShelfView* shelf_view); | 18 explicit AppListButton(InkDropButtonListener* listener, |
| 19 ShelfView* shelf_view); |
| 18 ~AppListButton() override; | 20 ~AppListButton() override; |
| 19 | 21 |
| 20 bool draw_background_as_active() { return draw_background_as_active_; } | 22 bool draw_background_as_active() { return draw_background_as_active_; } |
| 21 | 23 |
| 22 protected: | 24 protected: |
| 23 // views::ImageButton overrides: | 25 // views::ImageButton overrides: |
| 24 bool OnMousePressed(const ui::MouseEvent& event) override; | 26 bool OnMousePressed(const ui::MouseEvent& event) override; |
| 25 void OnMouseReleased(const ui::MouseEvent& event) override; | 27 void OnMouseReleased(const ui::MouseEvent& event) override; |
| 26 void OnMouseCaptureLost() override; | 28 void OnMouseCaptureLost() override; |
| 27 bool OnMouseDragged(const ui::MouseEvent& event) override; | 29 bool OnMouseDragged(const ui::MouseEvent& event) override; |
| 28 void OnPaint(gfx::Canvas* canvas) override; | 30 void OnPaint(gfx::Canvas* canvas) override; |
| 29 void GetAccessibleState(ui::AXViewState* state) override; | 31 void GetAccessibleState(ui::AXViewState* state) override; |
| 32 void NotifyClick(const ui::Event& event) override; |
| 30 | 33 |
| 31 // ui::EventHandler overrides: | 34 // ui::EventHandler overrides: |
| 32 void OnGestureEvent(ui::GestureEvent* event) override; | 35 void OnGestureEvent(ui::GestureEvent* event) override; |
| 33 | 36 |
| 34 private: | 37 private: |
| 35 // Toggles the active state for painting the background and schedules a paint. | 38 // Toggles the active state for painting the background and schedules a paint. |
| 36 void SetDrawBackgroundAsActive(bool draw_background_as_active); | 39 void SetDrawBackgroundAsActive(bool draw_background_as_active); |
| 37 | 40 |
| 38 // Helper functions to paint the background and foreground of the AppList | 41 // Helper functions to paint the background and foreground of the AppList |
| 39 // button in Chrome OS MD. | 42 // button in Chrome OS MD. |
| 40 void PaintBackgroundMD(gfx::Canvas* canvas); | 43 void PaintBackgroundMD(gfx::Canvas* canvas); |
| 41 void PaintForegroundMD(gfx::Canvas* canvas, | 44 void PaintForegroundMD(gfx::Canvas* canvas, |
| 42 const gfx::ImageSkia& foreground_image); | 45 const gfx::ImageSkia& foreground_image); |
| 43 | 46 |
| 44 // Helper function to paint the AppList button in Chrome OS non-MD. | 47 // Helper function to paint the AppList button in Chrome OS non-MD. |
| 45 void PaintAppListButton(gfx::Canvas* canvas, | 48 void PaintAppListButton(gfx::Canvas* canvas, |
| 46 const gfx::ImageSkia& foreground_image); | 49 const gfx::ImageSkia& foreground_image); |
| 47 | 50 |
| 48 // True if the background should render as active, regardless of the state of | 51 // True if the background should render as active, regardless of the state of |
| 49 // the application list. | 52 // the application list. |
| 50 bool draw_background_as_active_; | 53 bool draw_background_as_active_; |
| 51 | 54 |
| 55 InkDropButtonListener* listener_; |
| 52 ShelfView* shelf_view_; | 56 ShelfView* shelf_view_; |
| 53 | 57 |
| 54 DISALLOW_COPY_AND_ASSIGN(AppListButton); | 58 DISALLOW_COPY_AND_ASSIGN(AppListButton); |
| 55 }; | 59 }; |
| 56 | 60 |
| 57 } // namespace ash | 61 } // namespace ash |
| 58 | 62 |
| 59 #endif // ASH_SHELF_APP_LIST_BUTTON_H_ | 63 #endif // ASH_SHELF_APP_LIST_BUTTON_H_ |
| OLD | NEW |