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

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

Issue 9447096: gtk: Rename GtkThemeService to ThemeServiceGtk. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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) 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 "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "chrome/browser/profiles/avatar_menu_model.h" 12 #include "chrome/browser/profiles/avatar_menu_model.h"
13 #include "content/public/browser/notification_observer.h" 13 #include "content/public/browser/notification_observer.h"
14 #include "content/public/browser/notification_registrar.h" 14 #include "content/public/browser/notification_registrar.h"
15 #include "ui/base/gtk/gtk_signal.h" 15 #include "ui/base/gtk/gtk_signal.h"
16 #include "ui/base/gtk/owned_widget_gtk.h" 16 #include "ui/base/gtk/owned_widget_gtk.h"
17 17
18 class GtkThemeService; 18 class ThemeServiceGtk;
19 19
20 // This widget contains the profile icon, user name, and synchronization status 20 // This widget contains the profile icon, user name, and synchronization status
21 // to be displayed in the AvatarMenuBubble. Clicking the profile will open a new 21 // to be displayed in the AvatarMenuBubble. Clicking the profile will open a new
22 // browser window, and when the user hovers over an active profile item, a link 22 // browser window, and when the user hovers over an active profile item, a link
23 // is displayed that will allow editing the profile. 23 // is displayed that will allow editing the profile.
24 class AvatarMenuItemGtk : public content::NotificationObserver { 24 class AvatarMenuItemGtk : public content::NotificationObserver {
25 public: 25 public:
26 // Delegates opening or editing a profile. 26 // Delegates opening or editing a profile.
27 class Delegate { 27 class Delegate {
28 public: 28 public:
29 // Open a new browser window using the profile at |profile_index|. 29 // Open a new browser window using the profile at |profile_index|.
30 virtual void OpenProfile(size_t profile_index) = 0; 30 virtual void OpenProfile(size_t profile_index) = 0;
31 31
32 // Edit the profile given by |profile_index|. 32 // Edit the profile given by |profile_index|.
33 virtual void EditProfile(size_t profile_index) = 0; 33 virtual void EditProfile(size_t profile_index) = 0;
34 }; 34 };
35 35
36 AvatarMenuItemGtk(Delegate* delegate, 36 AvatarMenuItemGtk(Delegate* delegate,
37 const AvatarMenuModel::Item& item, 37 const AvatarMenuModel::Item& item,
38 size_t item_index, 38 size_t item_index,
39 GtkThemeService* theme_service); 39 ThemeServiceGtk* theme_service);
40 virtual ~AvatarMenuItemGtk(); 40 virtual ~AvatarMenuItemGtk();
41 41
42 void OpenProfile(); 42 void OpenProfile();
43 void EditProfile(); 43 void EditProfile();
44 44
45 // Returns the root widget for this menu item. 45 // Returns the root widget for this menu item.
46 GtkWidget* widget() { return widget_.get(); } 46 GtkWidget* widget() { return widget_.get(); }
47 47
48 // content::NotificationObserver implementation. 48 // content::NotificationObserver implementation.
49 virtual void Observe(int type, 49 virtual void Observe(int type,
(...skipping 15 matching lines...) Expand all
65 GdkEventFocus*); 65 GdkEventFocus*);
66 CHROMEGTK_CALLBACK_1(AvatarMenuItemGtk, gboolean, OnProfileFocusOut, 66 CHROMEGTK_CALLBACK_1(AvatarMenuItemGtk, gboolean, OnProfileFocusOut,
67 GdkEventFocus*); 67 GdkEventFocus*);
68 CHROMEGTK_CALLBACK_1(AvatarMenuItemGtk, gboolean, OnProfileKeyPress, 68 CHROMEGTK_CALLBACK_1(AvatarMenuItemGtk, gboolean, OnProfileKeyPress,
69 GdkEventKey*); 69 GdkEventKey*);
70 CHROMEGTK_CALLBACK_1(AvatarMenuItemGtk, gboolean, OnEventBoxExpose, 70 CHROMEGTK_CALLBACK_1(AvatarMenuItemGtk, gboolean, OnEventBoxExpose,
71 GdkEventExpose*); 71 GdkEventExpose*);
72 CHROMEGTK_CALLBACK_0(AvatarMenuItemGtk, void, OnEditProfileLinkClicked); 72 CHROMEGTK_CALLBACK_0(AvatarMenuItemGtk, void, OnEditProfileLinkClicked);
73 73
74 // Create all widgets in this menu item, using |theme_service|. 74 // Create all widgets in this menu item, using |theme_service|.
75 void Init(GtkThemeService* theme_service); 75 void Init(ThemeServiceGtk* theme_service);
76 76
77 // A weak pointer to the item's delegate. 77 // A weak pointer to the item's delegate.
78 Delegate* delegate_; 78 Delegate* delegate_;
79 79
80 // Profile information to display for this item, e.g. user name, sync status. 80 // Profile information to display for this item, e.g. user name, sync status.
81 AvatarMenuModel::Item item_; 81 AvatarMenuModel::Item item_;
82 82
83 // The index of this profile. The delegate uses this value to distinguish 83 // The index of this profile. The delegate uses this value to distinguish
84 // which profile should be switched to. 84 // which profile should be switched to.
85 size_t item_index_; 85 size_t item_index_;
86 86
87 // The root widget for this menu item. 87 // The root widget for this menu item.
88 ui::OwnedWidgetGtk widget_; 88 ui::OwnedWidgetGtk widget_;
89 89
90 // Provides colors. 90 // Provides colors.
91 GtkThemeService* theme_service_; 91 ThemeServiceGtk* theme_service_;
92 92
93 // A weak pointer to a label that displays the sync status. It is not shown 93 // A weak pointer to a label that displays the sync status. It is not shown
94 // when the user is hovering over the item if the profile is the active 94 // when the user is hovering over the item if the profile is the active
95 // profile. 95 // profile.
96 GtkWidget* status_label_; 96 GtkWidget* status_label_;
97 97
98 // A weak pointer to a link button to edit the given profile. It is shown only 98 // A weak pointer to a link button to edit the given profile. It is shown only
99 // when the user is hovering over the active profile. 99 // when the user is hovering over the active profile.
100 GtkWidget* link_alignment_; 100 GtkWidget* link_alignment_;
101 101
(...skipping 10 matching lines...) Expand all
112 const GdkColor* unhighlighted_color_; 112 const GdkColor* unhighlighted_color_;
113 113
114 base::WeakPtrFactory<AvatarMenuItemGtk> weak_factory_; 114 base::WeakPtrFactory<AvatarMenuItemGtk> weak_factory_;
115 115
116 content::NotificationRegistrar registrar_; 116 content::NotificationRegistrar registrar_;
117 117
118 DISALLOW_COPY_AND_ASSIGN(AvatarMenuItemGtk); 118 DISALLOW_COPY_AND_ASSIGN(AvatarMenuItemGtk);
119 }; 119 };
120 120
121 #endif // CHROME_BROWSER_UI_GTK_AVATAR_MENU_ITEM_GTK_H_ 121 #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