Disable TabDragController tests that fail with a real compositor.
[chromium-blink-merge.git] / chrome / browser / ui / gtk / avatar_menu_bubble_gtk.h
blob4515dcbaec22c83b3d1d3c9d7faa9a43cafb3ead
1 // Copyright (c) 2012 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_BUBBLE_GTK_H_
6 #define CHROME_BROWSER_UI_GTK_AVATAR_MENU_BUBBLE_GTK_H_
8 #include <gtk/gtk.h>
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/scoped_vector.h"
14 #include "chrome/browser/profiles/avatar_menu_observer.h"
15 #include "chrome/browser/ui/gtk/avatar_menu_item_gtk.h"
16 #include "chrome/browser/ui/gtk/bubble/bubble_gtk.h"
17 #include "ui/base/gtk/gtk_signal.h"
19 class AvatarMenu;
20 class Browser;
21 class GtkThemeService;
23 // This bubble is displayed when the user clicks on the avatar button.
24 // It displays a list of profiles and allows users to switch between profiles.
25 class AvatarMenuBubbleGtk : public BubbleDelegateGtk,
26 public AvatarMenuObserver,
27 public AvatarMenuItemGtk::Delegate {
28 public:
29 AvatarMenuBubbleGtk(Browser* browser,
30 GtkWidget* anchor,
31 BubbleGtk::FrameStyle arrow,
32 const gfx::Rect* rect);
33 virtual ~AvatarMenuBubbleGtk();
35 // BubbleDelegateGtk implementation.
36 virtual void BubbleClosing(BubbleGtk* bubble,
37 bool closed_by_escape) OVERRIDE;
39 // AvatarMenuObserver implementation.
40 virtual void OnAvatarMenuChanged(
41 AvatarMenu* avatar_menu) OVERRIDE;
43 // AvatarMenuItemGtk::Delegate implementation.
44 virtual void OpenProfile(size_t profile_index) OVERRIDE;
45 virtual void EditProfile(size_t profile_index) OVERRIDE;
47 private:
48 // Notified when |contents_| is destroyed so we can delete our instance.
49 CHROMEGTK_CALLBACK_0(AvatarMenuBubbleGtk, void, OnDestroy);
50 CHROMEGTK_CALLBACK_1(AvatarMenuBubbleGtk, void, OnSizeRequest,
51 GtkRequisition*);
52 CHROMEGTK_CALLBACK_0(AvatarMenuBubbleGtk, void, OnNewProfileLinkClicked);
53 CHROMEGTK_CALLBACK_0(AvatarMenuBubbleGtk, void, OnSwitchProfileLinkClicked);
55 // Create all widgets in this bubble.
56 void InitContents();
58 // Create the menu contents for a normal profile.
59 void InitMenuContents();
61 // Create the managed user specific contents of the menu.
62 void InitManagedUserContents();
64 // Close the bubble and set bubble_ to NULL.
65 void CloseBubble();
67 // A model of all the profile information to be displayed in the menu.
68 scoped_ptr<AvatarMenu> avatar_menu_;
70 // A weak pointer to the parent widget of all widgets in the bubble.
71 GtkWidget* contents_;
73 // A weak pointer to the only child widget of |contents_| which contains all
74 // widgets in the bubble.
75 GtkWidget* inner_contents_;
77 // A weak pointer to the bubble window.
78 BubbleGtk* bubble_;
80 // A weak pointer to the theme service.
81 GtkThemeService* theme_service_;
83 // A weak pointer to the new profile link to keep its theme information
84 // updated.
85 GtkWidget* new_profile_link_;
87 // A vector of all profile items in the menu.
88 ScopedVector<AvatarMenuItemGtk> items_;
90 // The minimum width to display the bubble. This is used to prevent the bubble
91 // from automatically reducing its size when hovering over a profile item.
92 int minimum_width_;
94 // Is set to true if the managed user has clicked on Switch Users.
95 bool switching_;
97 DISALLOW_COPY_AND_ASSIGN(AvatarMenuBubbleGtk);
100 #endif // CHROME_BROWSER_UI_GTK_AVATAR_MENU_BUBBLE_GTK_H_