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

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

Issue 2832823002: Update avatar button to MD (Closed)
Patch Set: Fixed ProfileChooserViewExtensionsTest browser tests Created 3 years, 8 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 is_sibling_menu_show); 35 PressedLock(MenuButton* menu_button,
36 bool is_sibling_menu_show,
37 const ui::LocatedEvent* event);
36 ~PressedLock(); 38 ~PressedLock();
37 39
38 private: 40 private:
39 base::WeakPtr<MenuButton> menu_button_; 41 base::WeakPtr<MenuButton> menu_button_;
40 42
41 DISALLOW_COPY_AND_ASSIGN(PressedLock); 43 DISALLOW_COPY_AND_ASSIGN(PressedLock);
42 }; 44 };
43 45
44 static const char kViewClassName[]; 46 static const char kViewClassName[];
45 47
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // Offset of the associated menu position. 104 // Offset of the associated menu position.
103 gfx::Point menu_offset_; 105 gfx::Point menu_offset_;
104 106
105 private: 107 private:
106 friend class PressedLock; 108 friend class PressedLock;
107 109
108 // Increment/decrement the number of "pressed" locks this button has, and 110 // Increment/decrement the number of "pressed" locks this button has, and
109 // set the state accordingly. The ink drop is snapped to the final ACTIVATED 111 // set the state accordingly. The ink drop is snapped to the final ACTIVATED
110 // state if |snap_ink_drop_to_activated| is true, otherwise the ink drop will 112 // state if |snap_ink_drop_to_activated| is true, otherwise the ink drop will
111 // be animated to the ACTIVATED node_data. 113 // be animated to the ACTIVATED node_data.
112 void IncrementPressedLocked(bool snap_ink_drop_to_activated); 114 void IncrementPressedLocked(bool snap_ink_drop_to_activated,
115 const ui::LocatedEvent* event);
113 void DecrementPressedLocked(); 116 void DecrementPressedLocked();
114 117
115 // Compute the maximum X coordinate for the current screen. MenuButtons 118 // Compute the maximum X coordinate for the current screen. MenuButtons
116 // use this to make sure a menu is never shown off screen. 119 // use this to make sure a menu is never shown off screen.
117 int GetMaximumScreenXCoordinate(); 120 int GetMaximumScreenXCoordinate();
118 121
119 // We use a time object in order to keep track of when the menu was closed. 122 // We use a time object in order to keep track of when the menu was closed.
120 // The time is used for simulating menu behavior for the menu button; that 123 // The time is used for simulating menu behavior for the menu button; that
121 // is, if the menu is shown and the button is pressed, we need to close the 124 // is, if the menu is shown and the button is pressed, we need to close the
122 // menu. There is no clean way to get the second click event because the 125 // menu. There is no clean way to get the second click event because the
(...skipping 26 matching lines...) Expand all
149 bool should_disable_after_press_; 152 bool should_disable_after_press_;
150 153
151 base::WeakPtrFactory<MenuButton> weak_factory_; 154 base::WeakPtrFactory<MenuButton> weak_factory_;
152 155
153 DISALLOW_COPY_AND_ASSIGN(MenuButton); 156 DISALLOW_COPY_AND_ASSIGN(MenuButton);
154 }; 157 };
155 158
156 } // namespace views 159 } // namespace views
157 160
158 #endif // UI_VIEWS_CONTROLS_BUTTON_MENU_BUTTON_H_ 161 #endif // UI_VIEWS_CONTROLS_BUTTON_MENU_BUTTON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698