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

Side by Side Diff: ui/views/controls/button/menu_button.h

Issue 1757993004: Added ink drop hover/ripple to menu hosting bookmark buttons. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated the ripple to behave resonably when showing context menus. Created 4 years, 9 months 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 UI_VIEWS_CONTROLS_BUTTON_MENU_BUTTON_H_ 5 #ifndef UI_VIEWS_CONTROLS_BUTTON_MENU_BUTTON_H_
6 #define UI_VIEWS_CONTROLS_BUTTON_MENU_BUTTON_H_ 6 #define UI_VIEWS_CONTROLS_BUTTON_MENU_BUTTON_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 14 matching lines...) Expand all
25 // A button that shows a menu when the left mouse button is pushed 25 // A button that shows a menu when the left mouse button is pushed
26 // 26 //
27 //////////////////////////////////////////////////////////////////////////////// 27 ////////////////////////////////////////////////////////////////////////////////
28 class VIEWS_EXPORT MenuButton : public LabelButton { 28 class VIEWS_EXPORT MenuButton : public LabelButton {
29 public: 29 public:
30 // A scoped lock for keeping the MenuButton in STATE_PRESSED e.g., while a 30 // A scoped lock for keeping the MenuButton in STATE_PRESSED e.g., while a
31 // menu is running. These are cumulative. 31 // menu is running. These are cumulative.
32 class VIEWS_EXPORT PressedLock { 32 class VIEWS_EXPORT PressedLock {
33 public: 33 public:
34 explicit PressedLock(MenuButton* menu_button); 34 explicit PressedLock(MenuButton* menu_button);
35 PressedLock(MenuButton* menu_button, bool first_menu_show);
35 ~PressedLock(); 36 ~PressedLock();
36 37
37 private: 38 private:
38 base::WeakPtr<MenuButton> menu_button_; 39 base::WeakPtr<MenuButton> menu_button_;
39 40
40 DISALLOW_COPY_AND_ASSIGN(PressedLock); 41 DISALLOW_COPY_AND_ASSIGN(PressedLock);
41 }; 42 };
42 43
43 static const char kViewClassName[]; 44 static const char kViewClassName[];
44 45
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 void StateChanged() override; 99 void StateChanged() override;
99 void NotifyClick(const ui::Event& event) override; 100 void NotifyClick(const ui::Event& event) override;
100 101
101 // Offset of the associated menu position. 102 // Offset of the associated menu position.
102 gfx::Point menu_offset_; 103 gfx::Point menu_offset_;
103 104
104 private: 105 private:
105 friend class PressedLock; 106 friend class PressedLock;
106 107
107 // Increment/decrement the number of "pressed" locks this button has, and 108 // Increment/decrement the number of "pressed" locks this button has, and
108 // set the state accordingly. 109 // set the state accordingly. The ink drop is animated to the ACTIVATED state
109 void IncrementPressedLocked(); 110 // if |animate_ink_drop| is true and will be snapped to it's final frame if
111 // false.
112 void IncrementPressedLocked(bool animate_ink_drop);
varkha 2016/03/11 17:57:17 I think it will be clearer if you reverse the para
bruthig 2016/03/11 21:58:20 Done.
110 void DecrementPressedLocked(); 113 void DecrementPressedLocked();
111 114
112 // Compute the maximum X coordinate for the current screen. MenuButtons 115 // Compute the maximum X coordinate for the current screen. MenuButtons
113 // use this to make sure a menu is never shown off screen. 116 // use this to make sure a menu is never shown off screen.
114 int GetMaximumScreenXCoordinate(); 117 int GetMaximumScreenXCoordinate();
115 118
116 // We use a time object in order to keep track of when the menu was closed. 119 // We use a time object in order to keep track of when the menu was closed.
117 // The time is used for simulating menu behavior for the menu button; that 120 // The time is used for simulating menu behavior for the menu button; that
118 // is, if the menu is shown and the button is pressed, we need to close the 121 // is, if the menu is shown and the button is pressed, we need to close the
119 // menu. There is no clean way to get the second click event because the 122 // menu. There is no clean way to get the second click event because the
(...skipping 26 matching lines...) Expand all
146 bool should_disable_after_press_; 149 bool should_disable_after_press_;
147 150
148 base::WeakPtrFactory<MenuButton> weak_factory_; 151 base::WeakPtrFactory<MenuButton> weak_factory_;
149 152
150 DISALLOW_COPY_AND_ASSIGN(MenuButton); 153 DISALLOW_COPY_AND_ASSIGN(MenuButton);
151 }; 154 };
152 155
153 } // namespace views 156 } // namespace views
154 157
155 #endif // UI_VIEWS_CONTROLS_BUTTON_MENU_BUTTON_H_ 158 #endif // UI_VIEWS_CONTROLS_BUTTON_MENU_BUTTON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698