| 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);
|
| };
|
|
|
|
|