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_COMMON_SHELF_APP_LIST_BUTTON_H_ | 5 #ifndef ASH_COMMON_SHELF_APP_LIST_BUTTON_H_ |
6 #define ASH_COMMON_SHELF_APP_LIST_BUTTON_H_ | 6 #define ASH_COMMON_SHELF_APP_LIST_BUTTON_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "ui/views/controls/button/image_button.h" | 10 #include "ui/views/controls/button/image_button.h" |
11 | 11 |
12 namespace ash { | 12 namespace ash { |
13 class InkDropButtonListener; | 13 class InkDropButtonListener; |
14 class ShelfView; | 14 class ShelfView; |
15 class WmShelf; | 15 class WmShelf; |
16 | 16 |
17 // Button used for the AppList icon on the shelf. | 17 // Button used for the AppList icon on the shelf. |
18 class ASH_EXPORT AppListButton : public views::ImageButton { | 18 class ASH_EXPORT AppListButton : public views::ImageButton { |
19 public: | 19 public: |
20 AppListButton(InkDropButtonListener* listener, | 20 AppListButton(InkDropButtonListener* listener, |
21 ShelfView* shelf_view, | 21 ShelfView* shelf_view, |
22 WmShelf* wm_shelf); | 22 WmShelf* wm_shelf); |
23 ~AppListButton() override; | 23 ~AppListButton() override; |
24 | 24 |
25 void OnAppListShown(); | 25 void OnAppListShown(); |
26 void OnAppListDismissed(); | 26 void OnAppListDismissed(); |
27 | 27 |
28 bool draw_background_as_active() { return draw_background_as_active_; } | 28 bool draw_background_as_active() { return draw_background_as_active_; } |
29 | 29 |
| 30 // Sets alpha value of the background and schedules a paint. |
| 31 void SetBackgroundAlpha(int alpha); |
| 32 |
30 protected: | 33 protected: |
31 // views::ImageButton overrides: | 34 // views::ImageButton overrides: |
32 bool OnMousePressed(const ui::MouseEvent& event) override; | 35 bool OnMousePressed(const ui::MouseEvent& event) override; |
33 void OnMouseReleased(const ui::MouseEvent& event) override; | 36 void OnMouseReleased(const ui::MouseEvent& event) override; |
34 void OnMouseCaptureLost() override; | 37 void OnMouseCaptureLost() override; |
35 bool OnMouseDragged(const ui::MouseEvent& event) override; | 38 bool OnMouseDragged(const ui::MouseEvent& event) override; |
36 void OnPaint(gfx::Canvas* canvas) override; | 39 void OnPaint(gfx::Canvas* canvas) override; |
37 void GetAccessibleState(ui::AXViewState* state) override; | 40 void GetAccessibleState(ui::AXViewState* state) override; |
38 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override; | 41 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override; |
39 void NotifyClick(const ui::Event& event) override; | 42 void NotifyClick(const ui::Event& event) override; |
(...skipping 14 matching lines...) Expand all Loading... |
54 const gfx::ImageSkia& foreground_image); | 57 const gfx::ImageSkia& foreground_image); |
55 | 58 |
56 // Helper function to paint the AppList button in Chrome OS non-MD. | 59 // Helper function to paint the AppList button in Chrome OS non-MD. |
57 void PaintAppListButton(gfx::Canvas* canvas, | 60 void PaintAppListButton(gfx::Canvas* canvas, |
58 const gfx::ImageSkia& foreground_image); | 61 const gfx::ImageSkia& foreground_image); |
59 | 62 |
60 // True if the background should render as active, regardless of the state of | 63 // True if the background should render as active, regardless of the state of |
61 // the application list. | 64 // the application list. |
62 bool draw_background_as_active_; | 65 bool draw_background_as_active_; |
63 | 66 |
| 67 // Alpha value used to paint the background. |
| 68 int background_alpha_; |
| 69 |
64 InkDropButtonListener* listener_; | 70 InkDropButtonListener* listener_; |
65 ShelfView* shelf_view_; | 71 ShelfView* shelf_view_; |
66 WmShelf* wm_shelf_; | 72 WmShelf* wm_shelf_; |
67 | 73 |
68 DISALLOW_COPY_AND_ASSIGN(AppListButton); | 74 DISALLOW_COPY_AND_ASSIGN(AppListButton); |
69 }; | 75 }; |
70 | 76 |
71 } // namespace ash | 77 } // namespace ash |
72 | 78 |
73 #endif // ASH_COMMON_SHELF_APP_LIST_BUTTON_H_ | 79 #endif // ASH_COMMON_SHELF_APP_LIST_BUTTON_H_ |
OLD | NEW |