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

Unified Diff: ui/views/controls/button/menu_button.h

Issue 547303003: Keep reference view pressed while extension actions have a popup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/controls/button/custom_button.cc ('k') | ui/views/controls/button/menu_button.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/button/menu_button.h
diff --git a/ui/views/controls/button/menu_button.h b/ui/views/controls/button/menu_button.h
index da67506ca45ec3244520b05b199ca5c6e1e08c15..bac6b798fda094b6c9d10903c1b4b447e96d1c18 100644
--- a/ui/views/controls/button/menu_button.h
+++ b/ui/views/controls/button/menu_button.h
@@ -47,6 +47,19 @@ class VIEWS_EXPORT MenuButton : public LabelButton {
const gfx::Point& menu_offset() const { return menu_offset_; }
void set_menu_offset(int x, int y) { menu_offset_.SetPoint(x, y); }
+ bool menu_visible() const { return menus_visible_ > 0; }
+
+ // Increases the |menus_visible_| count by one and sets the state to be
sky 2014/09/18 20:02:24 This is very fragile and not something I want in t
Devlin 2014/09/18 20:53:51 The problem with isolating all the logic in the ex
+ // pressed.
+ // This is public because some menus may "attach" themselves to a menu button,
+ // even if they aren't the main menu for that button (the one run via
+ // Activate()).
+ void AttachMenu();
+
+ // Decreases the |menus_visible_| count by one and sets the state to be
+ // normal if this was the last visible menu.
+ void DetachMenu();
+
// Activate the button (called when the button is pressed).
virtual bool Activate();
@@ -56,13 +69,15 @@ class VIEWS_EXPORT MenuButton : public LabelButton {
virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE;
virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE;
- virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE;
virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE;
virtual bool OnKeyReleased(const ui::KeyEvent& event) OVERRIDE;
virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE;
protected:
+ // MenuButton:
+ virtual bool ShouldRespondToMouseMovement() OVERRIDE;
+
// Paint the menu marker image.
void PaintMenuMarker(gfx::Canvas* canvas);
@@ -70,7 +85,7 @@ class VIEWS_EXPORT MenuButton : public LabelButton {
virtual gfx::Rect GetChildAreaBounds() OVERRIDE;
// True if the menu is currently visible.
- bool menu_visible_;
+ int menus_visible_;
// Offset of the associated menu position.
gfx::Point menu_offset_;
« no previous file with comments | « ui/views/controls/button/custom_button.cc ('k') | ui/views/controls/button/menu_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698