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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_GTK_AVATAR_MENU_BUTTON_GTK_H_
6 #define CHROME_BROWSER_UI_GTK_AVATAR_MENU_BUTTON_GTK_H_
10 #include "base/memory/scoped_ptr.h"
11 #include "chrome/browser/ui/gtk/bubble/bubble_gtk.h"
12 #include "ui/base/gtk/gtk_signal.h"
13 #include "ui/base/gtk/owned_widget_gtk.h"
22 // A button used to show the profile avatar. When clicked, it opens the
23 // AvatarMenuBubbleGtk.
24 class AvatarMenuButtonGtk
{
26 explicit AvatarMenuButtonGtk(Browser
* browser
);
28 ~AvatarMenuButtonGtk();
30 // Returns the button widget.
31 GtkWidget
* widget() const { return widget_
.get(); }
33 // Sets the location the arrow should be displayed on the menu bubble.
34 void set_menu_frame_style(BubbleGtk::FrameStyle frame_style
) {
35 frame_style_
= frame_style
;
38 // Sets the image to display on the button, typically the profile icon.
39 void SetIcon(const gfx::Image
& icon
, bool is_gaia_picture
);
41 // Show the avatar bubble.
42 void ShowAvatarBubble();
45 CHROMEGTK_CALLBACK_1(AvatarMenuButtonGtk
, gboolean
, OnButtonPressed
,
47 CHROMEGTK_CALLBACK_1(AvatarMenuButtonGtk
, void, OnSizeAllocate
,
50 void UpdateButtonIcon();
53 ui::OwnedWidgetGtk widget_
;
55 // A weak pointer to the image widget displayed on the button.
58 // A weak pointer to a browser. Used to create the bubble menu.
61 // Which side of the bubble to display the arrow.
62 BubbleGtk::FrameStyle frame_style_
;
64 scoped_ptr
<gfx::Image
> icon_
;
65 bool is_gaia_picture_
;
68 DISALLOW_COPY_AND_ASSIGN(AvatarMenuButtonGtk
);
71 #endif // CHROME_BROWSER_UI_GTK_AVATAR_MENU_BUTTON_GTK_H_