OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_SYSTEM_TRAY_SYSTEM_MENU_BUTTON_H_ | 5 #ifndef ASH_COMMON_SYSTEM_TRAY_SYSTEM_MENU_BUTTON_H_ |
6 #define ASH_COMMON_SYSTEM_TRAY_SYSTEM_MENU_BUTTON_H_ | 6 #define ASH_COMMON_SYSTEM_TRAY_SYSTEM_MENU_BUTTON_H_ |
7 | 7 |
8 #include "ash/resources/vector_icons/vector_icons.h" | 8 #include "ash/resources/vector_icons/vector_icons.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "ui/views/controls/button/button.h" | 10 #include "ui/views/controls/button/button.h" |
11 #include "ui/views/controls/button/image_button.h" | 11 #include "ui/views/controls/button/image_button.h" |
12 | 12 |
13 namespace views { | |
14 class InkDropHighlight; | |
15 class InkDropRipple; | |
16 } | |
17 | |
18 namespace ash { | 13 namespace ash { |
19 | 14 |
20 // A 48x48 image button with a material design ripple effect, which can be | 15 // A 48x48 image button with a material design ripple effect, which can be |
21 // used across Ash material design native UI menus. | 16 // used across Ash material design native UI menus. |
22 // TODO(tdanderson): Deprecate TrayPopupHeaderButton in favor of | 17 // TODO(tdanderson): Deprecate TrayPopupHeaderButton in favor of |
23 // SystemMenuButton once material design is enabled by default. See | 18 // SystemMenuButton once material design is enabled by default. See |
24 // crbug.com/614453. | 19 // crbug.com/614453. |
25 class SystemMenuButton : public views::ImageButton { | 20 class SystemMenuButton : public views::ImageButton { |
26 public: | 21 public: |
22 // The different ink drop styles that can be used. | |
23 enum class InkDropStyle { SQUARE, FLOOD_FILL }; | |
24 | |
27 // Constructs the button with |listener| and a centered icon corresponding to | 25 // Constructs the button with |listener| and a centered icon corresponding to |
28 // |icon|. |accessible_name_id| corresponds to the string in | 26 // |icon|. |ink_drop_style| specifies which flavor of the ink drop should be |
27 // used. |accessible_name_id| corresponds to the string in | |
29 // ui::ResourceBundle to use for the button's accessible and tooltip text. | 28 // ui::ResourceBundle to use for the button's accessible and tooltip text. |
30 SystemMenuButton(views::ButtonListener* listener, | 29 SystemMenuButton(views::ButtonListener* listener, |
30 InkDropStyle ink_drop_style, | |
31 const gfx::VectorIcon& icon, | 31 const gfx::VectorIcon& icon, |
32 int accessible_name_id); | 32 int accessible_name_id); |
33 ~SystemMenuButton() override; | 33 ~SystemMenuButton() override; |
34 | 34 |
35 // views::ImageButton: | 35 // views::ImageButton: |
36 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override; | 36 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override; |
37 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight() | 37 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight() |
38 const override; | 38 const override; |
39 bool ShouldShowInkDropForFocus() const override; | 39 bool ShouldShowInkDropHighlight() const override; |
40 | 40 |
41 private: | 41 private: |
42 // Returns the size that the ink drop should be constructed with. | |
43 gfx::Size GetInkDropSize() const; | |
44 | |
45 // Defines the flavor of ink drop ripple/highlight that should be constructed. | |
tdanderson
2016/10/27 21:21:41
Consider including a brief mention of why one woul
bruthig
2016/10/27 21:34:30
Done, added to the enum.
| |
46 InkDropStyle ink_drop_style_ = InkDropStyle::SQUARE; | |
tdanderson
2016/10/27 21:21:41
nit: I don't think initialization here is necessar
bruthig
2016/10/27 21:34:31
Removed.
| |
47 | |
42 DISALLOW_COPY_AND_ASSIGN(SystemMenuButton); | 48 DISALLOW_COPY_AND_ASSIGN(SystemMenuButton); |
43 }; | 49 }; |
44 | 50 |
45 } // namespace ash | 51 } // namespace ash |
46 | 52 |
47 #endif // ASH_COMMON_SYSTEM_TRAY_SYSTEM_MENU_BUTTON_H_ | 53 #endif // ASH_COMMON_SYSTEM_TRAY_SYSTEM_MENU_BUTTON_H_ |
OLD | NEW |