| 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 ShelfView; | 12 class ShelfView; |
| 13 | 13 |
| 14 // Button used for the AppList icon on the shelf. | 14 // Button used for the AppList icon on the shelf. |
| 15 class AppListButton : public views::ImageButton { | 15 class AppListButton : public views::ImageButton { |
| 16 public: | 16 public: |
| 17 explicit AppListButton(ShelfView* shelf_view); | 17 explicit AppListButton(ShelfView* shelf_view); |
| 18 ~AppListButton() override; | 18 ~AppListButton() override; |
| 19 | 19 |
| 20 bool draw_background_as_active() { return draw_background_as_active_; } | 20 bool draw_background_as_active() { return draw_background_as_active_; } |
| 21 | 21 |
| 22 protected: | 22 protected: |
| 23 // views::ImageButton overrides: | 23 // views::ImageButton overrides: |
| 24 bool OnMousePressed(const ui::MouseEvent& event) override; | 24 bool OnMousePressed(const ui::MouseEvent& event) override; |
| 25 void OnMouseReleased(const ui::MouseEvent& event) override; | 25 void OnMouseReleased(const ui::MouseEvent& event) override; |
| 26 void OnMouseCaptureLost() override; | 26 void OnMouseCaptureLost() override; |
| 27 bool OnMouseDragged(const ui::MouseEvent& event) override; | 27 bool OnMouseDragged(const ui::MouseEvent& event) override; |
| 28 void OnPaint(gfx::Canvas* canvas) override; | 28 void OnPaint(gfx::Canvas* canvas) override; |
| 29 void GetAccessibleState(ui::AXViewState* state) override; | 29 void GetAccessibleState(ui::AXViewState* state) override; |
| 30 void NotifyClick(const ui::Event& event) override; |
| 30 | 31 |
| 31 // ui::EventHandler overrides: | 32 // ui::EventHandler overrides: |
| 32 void OnGestureEvent(ui::GestureEvent* event) override; | 33 void OnGestureEvent(ui::GestureEvent* event) override; |
| 33 | 34 |
| 34 private: | 35 private: |
| 35 // Toggles the active state for painting the background and schedules a paint. | 36 // Toggles the active state for painting the background and schedules a paint. |
| 36 void SetDrawBackgroundAsActive(bool draw_background_as_active); | 37 void SetDrawBackgroundAsActive(bool draw_background_as_active); |
| 37 | 38 |
| 38 // True if the background should render as active, regardless of the state of | 39 // True if the background should render as active, regardless of the state of |
| 39 // the application list. | 40 // the application list. |
| 40 bool draw_background_as_active_; | 41 bool draw_background_as_active_; |
| 41 | 42 |
| 42 ShelfView* shelf_view_; | 43 ShelfView* shelf_view_; |
| 43 | 44 |
| 44 DISALLOW_COPY_AND_ASSIGN(AppListButton); | 45 DISALLOW_COPY_AND_ASSIGN(AppListButton); |
| 45 }; | 46 }; |
| 46 | 47 |
| 47 } // namespace ash | 48 } // namespace ash |
| 48 | 49 |
| 49 #endif // ASH_SHELF_APP_LIST_BUTTON_H_ | 50 #endif // ASH_SHELF_APP_LIST_BUTTON_H_ |
| OLD | NEW |