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

Side by Side 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: address review comments Created 7 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 CHROME_BROWSER_UI_VIEWS_AVATAR_MENU_BUBBLE_VIEW_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_AVATAR_MENU_BUBBLE_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_AVATAR_MENU_BUBBLE_VIEW_H_ 6 #define CHROME_BROWSER_UI_VIEWS_AVATAR_MENU_BUBBLE_VIEW_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 12 matching lines...) Expand all
23 class Separator; 23 class Separator;
24 } 24 }
25 25
26 // This bubble view is displayed when the user clicks on the avatar button. 26 // This bubble view is displayed when the user clicks on the avatar button.
27 // It displays a list of profiles and allows users to switch between profiles. 27 // It displays a list of profiles and allows users to switch between profiles.
28 class AvatarMenuBubbleView : public views::BubbleDelegateView, 28 class AvatarMenuBubbleView : public views::BubbleDelegateView,
29 public views::ButtonListener, 29 public views::ButtonListener,
30 public views::LinkListener, 30 public views::LinkListener,
31 public AvatarMenuModelObserver { 31 public AvatarMenuModelObserver {
32 public: 32 public:
33 AvatarMenuBubbleView(views::View* anchor_view, 33 static void ShowBubble(views::View* anchor_view,
Peter Kasting 2013/01/04 00:58:43 Nit: Write a comment to note why we want this sort
sail 2013/01/04 19:23:08 Done.
34 views::BubbleBorder::ArrowLocation arrow_location, 34 views::BubbleBorder::ArrowLocation arrow_location,
35 const gfx::Rect& anchor_rect, 35 views::BubbleBorder::BubbleAlignment border_alignment,
36 Browser* browser); 36 const gfx::Rect& anchor_rect,
37 Browser* browser);
38 static bool IsShowing();
39 static void Hide();
40
37 virtual ~AvatarMenuBubbleView(); 41 virtual ~AvatarMenuBubbleView();
38 42
39 // views::View implementation. 43 // views::View implementation.
40 virtual gfx::Size GetPreferredSize() OVERRIDE; 44 virtual gfx::Size GetPreferredSize() OVERRIDE;
41 virtual void Layout() OVERRIDE; 45 virtual void Layout() OVERRIDE;
42 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; 46 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE;
43 47
44 // views::ButtonListener implementation. 48 // views::ButtonListener implementation.
45 virtual void ButtonPressed(views::Button* sender, 49 virtual void ButtonPressed(views::Button* sender,
46 const ui::Event& event) OVERRIDE; 50 const ui::Event& event) OVERRIDE;
47 51
48 // views::LinkListener implementation. 52 // views::LinkListener implementation.
49 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; 53 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
50 54
51 // BubbleDelegate implementation. 55 // BubbleDelegate implementation.
52 virtual gfx::Rect GetAnchorRect() OVERRIDE; 56 virtual gfx::Rect GetAnchorRect() OVERRIDE;
53 virtual void Init() OVERRIDE; 57 virtual void Init() OVERRIDE;
58 virtual void WindowClosing() OVERRIDE;
54 59
55 // AvatarMenuModelObserver implementation. 60 // AvatarMenuModelObserver implementation.
56 virtual void OnAvatarMenuModelChanged( 61 virtual void OnAvatarMenuModelChanged(
57 AvatarMenuModel* avatar_menu_model) OVERRIDE; 62 AvatarMenuModel* avatar_menu_model) OVERRIDE;
58 63
59 private: 64 private:
65 AvatarMenuBubbleView(views::View* anchor_view,
66 views::BubbleBorder::ArrowLocation arrow_location,
67 const gfx::Rect& anchor_rect,
68 Browser* browser);
69
60 views::Link* add_profile_link_; 70 views::Link* add_profile_link_;
61 scoped_ptr<AvatarMenuModel> avatar_menu_model_; 71 scoped_ptr<AvatarMenuModel> avatar_menu_model_;
62 gfx::Rect anchor_rect_; 72 gfx::Rect anchor_rect_;
63 Browser* browser_; 73 Browser* browser_;
64 std::vector<views::CustomButton*> item_views_; 74 std::vector<views::CustomButton*> item_views_;
65 views::Separator* separator_; 75 views::Separator* separator_;
66 76
77 static AvatarMenuBubbleView* avatar_bubble_;
78
67 DISALLOW_COPY_AND_ASSIGN(AvatarMenuBubbleView); 79 DISALLOW_COPY_AND_ASSIGN(AvatarMenuBubbleView);
68 }; 80 };
69 81
70 #endif // CHROME_BROWSER_UI_VIEWS_AVATAR_MENU_BUBBLE_VIEW_H_ 82 #endif // CHROME_BROWSER_UI_VIEWS_AVATAR_MENU_BUBBLE_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698