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

Side by Side Diff: chrome/browser/ui/gtk/avatar_menu_item_gtk.h

Issue 10337010: Revert r123782. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 7 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) 2012 The Chromium Authors. All rights reserved. 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 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_GTK_AVATAR_MENU_ITEM_GTK_H_ 5 #ifndef CHROME_BROWSER_UI_GTK_AVATAR_MENU_ITEM_GTK_H_
6 #define CHROME_BROWSER_UI_GTK_AVATAR_MENU_ITEM_GTK_H_ 6 #define CHROME_BROWSER_UI_GTK_AVATAR_MENU_ITEM_GTK_H_
7 #pragma once 7 #pragma once
8 8
9 #include <gtk/gtk.h> 9 #include <gtk/gtk.h>
10 10
11 #include "chrome/browser/profiles/avatar_menu_model.h" 11 #include "chrome/browser/profiles/avatar_menu_model.h"
12 #include "content/public/browser/notification_observer.h" 12 #include "content/public/browser/notification_observer.h"
13 #include "content/public/browser/notification_registrar.h" 13 #include "content/public/browser/notification_registrar.h"
14 #include "ui/base/gtk/gtk_signal.h" 14 #include "ui/base/gtk/gtk_signal.h"
15 #include "ui/base/gtk/owned_widget_gtk.h" 15 #include "ui/base/gtk/owned_widget_gtk.h"
16 16
17 class ThemeServiceGtk; 17 class GtkThemeService;
18 18
19 // This widget contains the profile icon, user name, and synchronization status 19 // This widget contains the profile icon, user name, and synchronization status
20 // to be displayed in the AvatarMenuBubble. Clicking the profile will open a new 20 // to be displayed in the AvatarMenuBubble. Clicking the profile will open a new
21 // browser window, and when the user hovers over an active profile item, a link 21 // browser window, and when the user hovers over an active profile item, a link
22 // is displayed that will allow editing the profile. 22 // is displayed that will allow editing the profile.
23 class AvatarMenuItemGtk : public content::NotificationObserver { 23 class AvatarMenuItemGtk : public content::NotificationObserver {
24 public: 24 public:
25 // Delegates opening or editing a profile. 25 // Delegates opening or editing a profile.
26 class Delegate { 26 class Delegate {
27 public: 27 public:
28 // Open a new browser window using the profile at |profile_index|. 28 // Open a new browser window using the profile at |profile_index|.
29 virtual void OpenProfile(size_t profile_index) = 0; 29 virtual void OpenProfile(size_t profile_index) = 0;
30 30
31 // Edit the profile given by |profile_index|. 31 // Edit the profile given by |profile_index|.
32 virtual void EditProfile(size_t profile_index) = 0; 32 virtual void EditProfile(size_t profile_index) = 0;
33 }; 33 };
34 34
35 AvatarMenuItemGtk(Delegate* delegate, 35 AvatarMenuItemGtk(Delegate* delegate,
36 const AvatarMenuModel::Item& item, 36 const AvatarMenuModel::Item& item,
37 size_t item_index, 37 size_t item_index,
38 ThemeServiceGtk* theme_service); 38 GtkThemeService* theme_service);
39 virtual ~AvatarMenuItemGtk(); 39 virtual ~AvatarMenuItemGtk();
40 40
41 // Returns the root widget for this menu item. 41 // Returns the root widget for this menu item.
42 GtkWidget* widget() { return widget_.get(); } 42 GtkWidget* widget() { return widget_.get(); }
43 43
44 // content::NotificationObserver implementation. 44 // content::NotificationObserver implementation.
45 virtual void Observe(int type, 45 virtual void Observe(int type,
46 const content::NotificationSource& source, 46 const content::NotificationSource& source,
47 const content::NotificationDetails& details) OVERRIDE; 47 const content::NotificationDetails& details) OVERRIDE;
48 48
(...skipping 12 matching lines...) Expand all
61 GdkEventFocus*); 61 GdkEventFocus*);
62 CHROMEGTK_CALLBACK_1(AvatarMenuItemGtk, gboolean, OnProfileFocusOut, 62 CHROMEGTK_CALLBACK_1(AvatarMenuItemGtk, gboolean, OnProfileFocusOut,
63 GdkEventFocus*); 63 GdkEventFocus*);
64 CHROMEGTK_CALLBACK_1(AvatarMenuItemGtk, gboolean, OnProfileKeyPress, 64 CHROMEGTK_CALLBACK_1(AvatarMenuItemGtk, gboolean, OnProfileKeyPress,
65 GdkEventKey*); 65 GdkEventKey*);
66 CHROMEGTK_CALLBACK_1(AvatarMenuItemGtk, gboolean, OnEventBoxExpose, 66 CHROMEGTK_CALLBACK_1(AvatarMenuItemGtk, gboolean, OnEventBoxExpose,
67 GdkEventExpose*); 67 GdkEventExpose*);
68 CHROMEGTK_CALLBACK_0(AvatarMenuItemGtk, void, OnEditProfileLinkClicked); 68 CHROMEGTK_CALLBACK_0(AvatarMenuItemGtk, void, OnEditProfileLinkClicked);
69 69
70 // Create all widgets in this menu item, using |theme_service|. 70 // Create all widgets in this menu item, using |theme_service|.
71 void Init(ThemeServiceGtk* theme_service); 71 void Init(GtkThemeService* theme_service);
72 72
73 // A weak pointer to the item's delegate. 73 // A weak pointer to the item's delegate.
74 Delegate* delegate_; 74 Delegate* delegate_;
75 75
76 // Profile information to display for this item, e.g. user name, sync status. 76 // Profile information to display for this item, e.g. user name, sync status.
77 AvatarMenuModel::Item item_; 77 AvatarMenuModel::Item item_;
78 78
79 // The index of this profile. The delegate uses this value to distinguish 79 // The index of this profile. The delegate uses this value to distinguish
80 // which profile should be switched to. 80 // which profile should be switched to.
81 size_t item_index_; 81 size_t item_index_;
82 82
83 // The root widget for this menu item. 83 // The root widget for this menu item.
84 ui::OwnedWidgetGtk widget_; 84 ui::OwnedWidgetGtk widget_;
85 85
86 // Provides colors. 86 // Provides colors.
87 ThemeServiceGtk* theme_service_; 87 GtkThemeService* theme_service_;
88 88
89 // A weak pointer to a label that displays the sync status. It is not shown 89 // A weak pointer to a label that displays the sync status. It is not shown
90 // when the user is hovering over the item if the profile is the active 90 // when the user is hovering over the item if the profile is the active
91 // profile. 91 // profile.
92 GtkWidget* status_label_; 92 GtkWidget* status_label_;
93 93
94 // A weak pointer to a link button to edit the given profile. It is shown only 94 // A weak pointer to a link button to edit the given profile. It is shown only
95 // when the user is hovering over the active profile. 95 // when the user is hovering over the active profile.
96 GtkWidget* link_alignment_; 96 GtkWidget* link_alignment_;
97 97
98 // A weak pointer to a GtkChromeLinkButton so we can keep the use_gtk_theme 98 // A weak pointer to a GtkChromeLinkButton so we can keep the use_gtk_theme
99 // property up to date. 99 // property up to date.
100 GtkWidget* edit_profile_link_; 100 GtkWidget* edit_profile_link_;
101 101
102 // The highlighted color. Depending on the theme, this is either |widget|'s 102 // The highlighted color. Depending on the theme, this is either |widget|'s
103 // bg[GTK_STATE_SELECTED] or a static highlight. 103 // bg[GTK_STATE_SELECTED] or a static highlight.
104 GdkColor highlighted_color_; 104 GdkColor highlighted_color_;
105 105
106 // The unhighlighted color. Depending on the theme, this is either NULL or a 106 // The unhighlighted color. Depending on the theme, this is either NULL or a
107 // pointer to static data. 107 // pointer to static data.
108 const GdkColor* unhighlighted_color_; 108 const GdkColor* unhighlighted_color_;
109 109
110 content::NotificationRegistrar registrar_; 110 content::NotificationRegistrar registrar_;
111 111
112 DISALLOW_COPY_AND_ASSIGN(AvatarMenuItemGtk); 112 DISALLOW_COPY_AND_ASSIGN(AvatarMenuItemGtk);
113 }; 113 };
114 114
115 #endif // CHROME_BROWSER_UI_GTK_AVATAR_MENU_ITEM_GTK_H_ 115 #endif // CHROME_BROWSER_UI_GTK_AVATAR_MENU_ITEM_GTK_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/avatar_menu_bubble_gtk.cc ('k') | chrome/browser/ui/gtk/avatar_menu_item_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698