| 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 "ash/ash_export.h" |
| 8 #include "base/macros.h" | 9 #include "base/macros.h" |
| 9 #include "ui/views/controls/button/image_button.h" | 10 #include "ui/views/controls/button/image_button.h" |
| 10 | 11 |
| 11 namespace ash { | 12 namespace ash { |
| 12 class InkDropButtonListener; | 13 class InkDropButtonListener; |
| 13 class ShelfView; | 14 class ShelfView; |
| 14 | 15 |
| 15 // Button used for the AppList icon on the shelf. | 16 // Button used for the AppList icon on the shelf. |
| 16 class AppListButton : public views::ImageButton { | 17 class ASH_EXPORT AppListButton : public views::ImageButton { |
| 17 public: | 18 public: |
| 18 explicit AppListButton(InkDropButtonListener* listener, | 19 explicit AppListButton(InkDropButtonListener* listener, |
| 19 ShelfView* shelf_view); | 20 ShelfView* shelf_view); |
| 20 ~AppListButton() override; | 21 ~AppListButton() override; |
| 21 | 22 |
| 23 void OnAppListShown(); |
| 24 void OnAppListDismissed(); |
| 25 |
| 22 bool draw_background_as_active() { return draw_background_as_active_; } | 26 bool draw_background_as_active() { return draw_background_as_active_; } |
| 23 | 27 |
| 24 protected: | 28 protected: |
| 25 // views::ImageButton overrides: | 29 // views::ImageButton overrides: |
| 26 bool OnMousePressed(const ui::MouseEvent& event) override; | 30 bool OnMousePressed(const ui::MouseEvent& event) override; |
| 27 void OnMouseReleased(const ui::MouseEvent& event) override; | 31 void OnMouseReleased(const ui::MouseEvent& event) override; |
| 28 void OnMouseCaptureLost() override; | 32 void OnMouseCaptureLost() override; |
| 29 bool OnMouseDragged(const ui::MouseEvent& event) override; | 33 bool OnMouseDragged(const ui::MouseEvent& event) override; |
| 30 void OnPaint(gfx::Canvas* canvas) override; | 34 void OnPaint(gfx::Canvas* canvas) override; |
| 31 void GetAccessibleState(ui::AXViewState* state) override; | 35 void GetAccessibleState(ui::AXViewState* state) override; |
| 36 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override; |
| 32 void NotifyClick(const ui::Event& event) override; | 37 void NotifyClick(const ui::Event& event) override; |
| 38 bool ShouldEnterPushedState(const ui::Event& event) override; |
| 39 bool ShouldShowInkDropHighlight() const override; |
| 33 | 40 |
| 34 // ui::EventHandler overrides: | 41 // ui::EventHandler overrides: |
| 35 void OnGestureEvent(ui::GestureEvent* event) override; | 42 void OnGestureEvent(ui::GestureEvent* event) override; |
| 36 | 43 |
| 37 private: | 44 private: |
| 38 // Toggles the active state for painting the background and schedules a paint. | 45 // Toggles the active state for painting the background and schedules a paint. |
| 39 void SetDrawBackgroundAsActive(bool draw_background_as_active); | 46 void SetDrawBackgroundAsActive(bool draw_background_as_active); |
| 40 | 47 |
| 41 // Helper functions to paint the background and foreground of the AppList | 48 // Helper functions to paint the background and foreground of the AppList |
| 42 // button in Chrome OS MD. | 49 // button in Chrome OS MD. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 54 | 61 |
| 55 InkDropButtonListener* listener_; | 62 InkDropButtonListener* listener_; |
| 56 ShelfView* shelf_view_; | 63 ShelfView* shelf_view_; |
| 57 | 64 |
| 58 DISALLOW_COPY_AND_ASSIGN(AppListButton); | 65 DISALLOW_COPY_AND_ASSIGN(AppListButton); |
| 59 }; | 66 }; |
| 60 | 67 |
| 61 } // namespace ash | 68 } // namespace ash |
| 62 | 69 |
| 63 #endif // ASH_SHELF_APP_LIST_BUTTON_H_ | 70 #endif // ASH_SHELF_APP_LIST_BUTTON_H_ |
| OLD | NEW |