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

Side by Side Diff: chrome/browser/profiles/avatar_menu.h

Issue 597783003: Update the AvatarMenu when a supervised user's custodian info changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix tests Created 6 years, 2 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
« no previous file with comments | « no previous file | chrome/browser/profiles/avatar_menu.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_PROFILES_AVATAR_MENU_H_ 5 #ifndef CHROME_BROWSER_PROFILES_AVATAR_MENU_H_
6 #define CHROME_BROWSER_PROFILES_AVATAR_MENU_H_ 6 #define CHROME_BROWSER_PROFILES_AVATAR_MENU_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/scoped_observer.h"
13 #include "base/strings/string16.h" 14 #include "base/strings/string16.h"
14 #include "chrome/browser/profiles/profile_metrics.h" 15 #include "chrome/browser/profiles/profile_metrics.h"
15 #include "chrome/browser/ui/host_desktop.h" 16 #include "chrome/browser/ui/host_desktop.h"
16 #include "content/public/browser/notification_observer.h" 17 #include "content/public/browser/notification_observer.h"
17 #include "content/public/browser/notification_registrar.h" 18 #include "content/public/browser/notification_registrar.h"
18 #include "content/public/browser/web_contents.h" 19 #include "content/public/browser/web_contents.h"
19 #include "content/public/browser/web_contents_observer.h" 20 #include "content/public/browser/web_contents_observer.h"
20 #include "ui/gfx/image/image.h" 21 #include "ui/gfx/image/image.h"
21 22
23 #if defined(ENABLE_MANAGED_USERS)
24 #include "chrome/browser/supervised_user/supervised_user_service_observer.h"
25 #endif
26
27 class AvatarMenuActions;
22 class AvatarMenuObserver; 28 class AvatarMenuObserver;
23 class Browser; 29 class Browser;
24 class Profile; 30 class Profile;
25 class ProfileInfoInterface; 31 class ProfileInfoInterface;
26 class ProfileList; 32 class ProfileList;
27 class AvatarMenuActions; 33 class SupervisedUserService;
28 34
29 // This class represents the menu-like interface used to select profiles, 35 // This class represents the menu-like interface used to select profiles,
30 // such as the bubble that appears when the avatar icon is clicked in the 36 // such as the bubble that appears when the avatar icon is clicked in the
31 // browser window frame. This class will notify its observer when the backend 37 // browser window frame. This class will notify its observer when the backend
32 // data changes, and the view for this model should forward actions 38 // data changes, and the view for this model should forward actions
33 // back to it in response to user events. 39 // back to it in response to user events.
34 class AvatarMenu : public content::NotificationObserver { 40 class AvatarMenu :
41 #if defined(ENABLE_MANAGED_USERS)
42 public SupervisedUserServiceObserver,
43 #endif
44 public content::NotificationObserver {
35 public: 45 public:
36 // Represents an item in the menu. 46 // Represents an item in the menu.
37 struct Item { 47 struct Item {
38 Item(size_t menu_index, size_t profile_index, const gfx::Image& icon); 48 Item(size_t menu_index, size_t profile_index, const gfx::Image& icon);
39 ~Item(); 49 ~Item();
40 50
41 // The icon to be displayed next to the item. 51 // The icon to be displayed next to the item.
42 gfx::Image icon; 52 gfx::Image icon;
43 53
44 // Whether or not the current browser is using this profile. 54 // Whether or not the current browser is using this profile.
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 145
136 // Returns true if the edit profile link should be shown. 146 // Returns true if the edit profile link should be shown.
137 bool ShouldShowEditProfileLink() const; 147 bool ShouldShowEditProfileLink() const;
138 148
139 // content::NotificationObserver: 149 // content::NotificationObserver:
140 virtual void Observe(int type, 150 virtual void Observe(int type,
141 const content::NotificationSource& source, 151 const content::NotificationSource& source,
142 const content::NotificationDetails& details) OVERRIDE; 152 const content::NotificationDetails& details) OVERRIDE;
143 153
144 private: 154 private:
155 #if defined(ENABLE_MANAGED_USERS)
156 // SupervisedUserServiceObserver:
157 virtual void OnCustodianInfoChanged() OVERRIDE;
158 #endif
159
145 // The model that provides the list of menu items. 160 // The model that provides the list of menu items.
146 scoped_ptr<ProfileList> profile_list_; 161 scoped_ptr<ProfileList> profile_list_;
147 162
148 // The controller for avatar menu actions. 163 // The controller for avatar menu actions.
149 scoped_ptr<AvatarMenuActions> menu_actions_; 164 scoped_ptr<AvatarMenuActions> menu_actions_;
150 165
166 #if defined(ENABLE_MANAGED_USERS)
167 // Observes changes to a supervised user's custodian info.
168 ScopedObserver<SupervisedUserService, SupervisedUserServiceObserver>
169 supervised_user_observer_;
170 #endif
171
151 // The cache that provides the profile information. Weak. 172 // The cache that provides the profile information. Weak.
152 ProfileInfoInterface* profile_info_; 173 ProfileInfoInterface* profile_info_;
153 174
154 // The observer of this model, which is notified of changes. Weak. 175 // The observer of this model, which is notified of changes. Weak.
155 AvatarMenuObserver* observer_; 176 AvatarMenuObserver* observer_;
156 177
157 // Browser in which this avatar menu resides. Weak. 178 // Browser in which this avatar menu resides. Weak.
158 Browser* browser_; 179 Browser* browser_;
159 180
160 // Listens for notifications from the ProfileInfoCache. 181 // Listens for notifications from the ProfileInfoCache.
161 content::NotificationRegistrar registrar_; 182 content::NotificationRegistrar registrar_;
162 183
163 DISALLOW_COPY_AND_ASSIGN(AvatarMenu); 184 DISALLOW_COPY_AND_ASSIGN(AvatarMenu);
164 }; 185 };
165 186
166 #endif // CHROME_BROWSER_PROFILES_AVATAR_MENU_H_ 187 #endif // CHROME_BROWSER_PROFILES_AVATAR_MENU_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/profiles/avatar_menu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698