Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(769)

Side by Side Diff: ash/common/system/tray/system_menu_button.h

Issue 2456783005: [ash-md] Changed the style of ink drop applied to system menu icon buttons. (Closed)
Patch Set: Addressed review comments. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 {
24 // Despite the poor name this style actually displays as a circle. It is
25 // typically used for buttons that the user doesn't need to know the exact
26 // targetable rect and they are expected to target an icon centered in the
27 // targetable space.
28 SQUARE,
29 // Typically used for buttons that should indicate to the user what the
30 // actual targetable bounds are. e.g. a row of buttons separated with
31 // separators.
32 FLOOD_FILL
33 };
34
27 // Constructs the button with |listener| and a centered icon corresponding to 35 // Constructs the button with |listener| and a centered icon corresponding to
28 // |icon|. |accessible_name_id| corresponds to the string in 36 // |icon|. |ink_drop_style| specifies which flavor of the ink drop should be
37 // used. |accessible_name_id| corresponds to the string in
29 // ui::ResourceBundle to use for the button's accessible and tooltip text. 38 // ui::ResourceBundle to use for the button's accessible and tooltip text.
30 SystemMenuButton(views::ButtonListener* listener, 39 SystemMenuButton(views::ButtonListener* listener,
40 InkDropStyle ink_drop_style,
31 const gfx::VectorIcon& icon, 41 const gfx::VectorIcon& icon,
32 int accessible_name_id); 42 int accessible_name_id);
33 ~SystemMenuButton() override; 43 ~SystemMenuButton() override;
34 44
35 // views::ImageButton: 45 // views::ImageButton:
36 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override; 46 std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override;
37 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight() 47 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight()
38 const override; 48 const override;
39 bool ShouldShowInkDropForFocus() const override; 49 bool ShouldShowInkDropHighlight() const override;
40 50
41 private: 51 private:
52 // Returns the size that the ink drop should be constructed with.
53 gfx::Size GetInkDropSize() const;
54
55 // Defines the flavor of ink drop ripple/highlight that should be constructed.
56 InkDropStyle ink_drop_style_;
57
42 DISALLOW_COPY_AND_ASSIGN(SystemMenuButton); 58 DISALLOW_COPY_AND_ASSIGN(SystemMenuButton);
43 }; 59 };
44 60
45 } // namespace ash 61 } // namespace ash
46 62
47 #endif // ASH_COMMON_SYSTEM_TRAY_SYSTEM_MENU_BUTTON_H_ 63 #endif // ASH_COMMON_SYSTEM_TRAY_SYSTEM_MENU_BUTTON_H_
OLDNEW
« no previous file with comments | « ash/common/system/tray/special_popup_row.cc ('k') | ash/common/system/tray/system_menu_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698