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

Unified Diff: chrome/browser/ui/views/avatar_menu_button.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: Created 8 years 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
Index: chrome/browser/ui/views/avatar_menu_button.h
diff --git a/chrome/browser/ui/views/avatar_menu_button.h b/chrome/browser/ui/views/avatar_menu_button.h
index 54b6452eccd0bce87980e1fbacfe160e2518403c..c02bad4660cf99a0f9662d0e7704c1fee5e1e81f 100644
--- a/chrome/browser/ui/views/avatar_menu_button.h
+++ b/chrome/browser/ui/views/avatar_menu_button.h
@@ -7,10 +7,12 @@
#include <string>
+#include "base/cancelable_callback.h"
#include "base/compiler_specific.h"
#include "ui/base/models/simple_menu_model.h"
#include "ui/views/controls/button/menu_button.h"
#include "ui/views/controls/button/menu_button_listener.h"
+#include "ui/views/widget/widget_observer.h"
namespace gfx {
class Canvas;
@@ -29,7 +31,8 @@ void DrawTaskBarDecoration(gfx::NativeWindow window, const gfx::Image* image);
// The button can optionally have a menu attached to it.
class AvatarMenuButton : public views::MenuButton,
- public views::MenuButtonListener {
+ public views::MenuButtonListener,
+ public views::WidgetObserver {
public:
// Creates a new button. If |incognito| is true and we're not in managed mode,
// clicking on the button will cause the profile menu to be displayed.
@@ -46,12 +49,17 @@ class AvatarMenuButton : public views::MenuButton,
void ShowAvatarBubble();
+ views::Widget* bubble_widget() const { return bubble_widget_; }
+
private:
// views::MenuButtonListener:
virtual void OnMenuButtonClicked(views::View* source,
const gfx::Point& point) OVERRIDE;
- void ButtonClicked();
+ // views::WidgetObserver:
+ virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE;
+
+ void ShowAvatarBubbleImpl();
Browser* browser_;
bool incognito_;
@@ -63,6 +71,12 @@ class AvatarMenuButton : public views::MenuButton,
bool is_gaia_picture_;
int old_height_;
+ // The current bubble that's being shown.
+ views::Widget* bubble_widget_;
+ // This allows the asynchronous process of showing the avatar bubble to be
+ // cancelled.
+ base::CancelableClosure show_avatar_bubble_closure_;
+
DISALLOW_COPY_AND_ASSIGN(AvatarMenuButton);
};
« no previous file with comments | « no previous file | chrome/browser/ui/views/avatar_menu_button.cc » ('j') | chrome/browser/ui/views/avatar_menu_button.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698