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

Unified Diff: chrome/browser/ui/views/avatar_menu_bubble_view.h

Issue 11646008: Close avatar bubble when avatar button is clicked a second time (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix build Created 7 years, 12 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 | « no previous file | chrome/browser/ui/views/avatar_menu_bubble_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/avatar_menu_bubble_view.h
diff --git a/chrome/browser/ui/views/avatar_menu_bubble_view.h b/chrome/browser/ui/views/avatar_menu_bubble_view.h
index 5490ac2e917b6a3c6c3c37a1fa52d3f3f7771a13..560c1845e97f2a3e4924fbafea873c5cd328823c 100644
--- a/chrome/browser/ui/views/avatar_menu_bubble_view.h
+++ b/chrome/browser/ui/views/avatar_menu_bubble_view.h
@@ -30,10 +30,24 @@ class AvatarMenuBubbleView : public views::BubbleDelegateView,
public views::LinkListener,
public AvatarMenuModelObserver {
public:
- AvatarMenuBubbleView(views::View* anchor_view,
- views::BubbleBorder::ArrowLocation arrow_location,
- const gfx::Rect& anchor_rect,
- Browser* browser);
+ // Helper function to show the bubble and ensure that it doesn't reshow.
+ // Normally this bubble is shown when there's a mouse down event on a button.
+ // If the bubble is already showing when the user clicks on the button then
+ // this will cause two things to happen:
+ // - (1) the button will show a new instance of the bubble
+ // - (2) the old instance of the bubble will get a deactivate event and
+ // close
+ // To prevent this reshow this function checks if an instance of the bubble
+ // is already showing and do nothing. This means that (1) will do nothing
+ // and (2) will correctly hide the old bubble instance.
+ static void ShowBubble(views::View* anchor_view,
+ views::BubbleBorder::ArrowLocation arrow_location,
+ views::BubbleBorder::BubbleAlignment border_alignment,
+ const gfx::Rect& anchor_rect,
+ Browser* browser);
+ static bool IsShowing();
+ static void Hide();
+
virtual ~AvatarMenuBubbleView();
// views::View implementation.
@@ -51,12 +65,18 @@ class AvatarMenuBubbleView : public views::BubbleDelegateView,
// BubbleDelegate implementation.
virtual gfx::Rect GetAnchorRect() OVERRIDE;
virtual void Init() OVERRIDE;
+ virtual void WindowClosing() OVERRIDE;
// AvatarMenuModelObserver implementation.
virtual void OnAvatarMenuModelChanged(
AvatarMenuModel* avatar_menu_model) OVERRIDE;
private:
+ AvatarMenuBubbleView(views::View* anchor_view,
+ views::BubbleBorder::ArrowLocation arrow_location,
+ const gfx::Rect& anchor_rect,
+ Browser* browser);
+
views::Link* add_profile_link_;
scoped_ptr<AvatarMenuModel> avatar_menu_model_;
gfx::Rect anchor_rect_;
@@ -64,6 +84,8 @@ class AvatarMenuBubbleView : public views::BubbleDelegateView,
std::vector<views::CustomButton*> item_views_;
views::Separator* separator_;
+ static AvatarMenuBubbleView* avatar_bubble_;
+
DISALLOW_COPY_AND_ASSIGN(AvatarMenuBubbleView);
};
« no previous file with comments | « no previous file | chrome/browser/ui/views/avatar_menu_bubble_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698