OLD | NEW |
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/strings/string16.h" | 13 #include "base/strings/string16.h" |
14 #include "chrome/browser/profiles/profile_metrics.h" | 14 #include "chrome/browser/profiles/profile_metrics.h" |
15 #include "chrome/browser/ui/host_desktop.h" | 15 #include "chrome/browser/ui/host_desktop.h" |
16 #include "content/public/browser/notification_observer.h" | 16 #include "content/public/browser/notification_observer.h" |
17 #include "content/public/browser/notification_registrar.h" | 17 #include "content/public/browser/notification_registrar.h" |
18 #include "content/public/browser/web_contents.h" | 18 #include "content/public/browser/web_contents.h" |
19 #include "content/public/browser/web_contents_observer.h" | 19 #include "content/public/browser/web_contents_observer.h" |
20 #include "ui/gfx/image/image.h" | 20 #include "ui/gfx/image/image.h" |
21 | 21 |
| 22 #if defined(ENABLE_MANAGED_USERS) |
| 23 #include "chrome/browser/supervised_user/supervised_user_service_observer.h" |
| 24 #endif |
| 25 |
22 class AvatarMenuObserver; | 26 class AvatarMenuObserver; |
23 class Browser; | 27 class Browser; |
24 class Profile; | 28 class Profile; |
25 class ProfileInfoInterface; | 29 class ProfileInfoInterface; |
26 class ProfileList; | 30 class ProfileList; |
27 class AvatarMenuActions; | 31 class AvatarMenuActions; |
28 | 32 |
29 // This class represents the menu-like interface used to select profiles, | 33 // 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 | 34 // 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 | 35 // browser window frame. This class will notify its observer when the backend |
32 // data changes, and the view for this model should forward actions | 36 // data changes, and the view for this model should forward actions |
33 // back to it in response to user events. | 37 // back to it in response to user events. |
34 class AvatarMenu : public content::NotificationObserver { | 38 class AvatarMenu : |
| 39 #if defined(ENABLE_MANAGED_USERS) |
| 40 public SupervisedUserServiceObserver, |
| 41 #endif |
| 42 public content::NotificationObserver { |
35 public: | 43 public: |
36 // Represents an item in the menu. | 44 // Represents an item in the menu. |
37 struct Item { | 45 struct Item { |
38 Item(size_t menu_index, size_t profile_index, const gfx::Image& icon); | 46 Item(size_t menu_index, size_t profile_index, const gfx::Image& icon); |
39 ~Item(); | 47 ~Item(); |
40 | 48 |
41 // The icon to be displayed next to the item. | 49 // The icon to be displayed next to the item. |
42 gfx::Image icon; | 50 gfx::Image icon; |
43 | 51 |
44 // Whether or not the current browser is using this profile. | 52 // Whether or not the current browser is using this profile. |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 | 143 |
136 // Returns true if the edit profile link should be shown. | 144 // Returns true if the edit profile link should be shown. |
137 bool ShouldShowEditProfileLink() const; | 145 bool ShouldShowEditProfileLink() const; |
138 | 146 |
139 // content::NotificationObserver: | 147 // content::NotificationObserver: |
140 virtual void Observe(int type, | 148 virtual void Observe(int type, |
141 const content::NotificationSource& source, | 149 const content::NotificationSource& source, |
142 const content::NotificationDetails& details) OVERRIDE; | 150 const content::NotificationDetails& details) OVERRIDE; |
143 | 151 |
144 private: | 152 private: |
| 153 #if defined(ENABLE_MANAGED_USERS) |
| 154 // SupervisedUserServiceObserver: |
| 155 virtual void OnCustodianInfoChanged() OVERRIDE; |
| 156 #endif |
| 157 |
145 // The model that provides the list of menu items. | 158 // The model that provides the list of menu items. |
146 scoped_ptr<ProfileList> profile_list_; | 159 scoped_ptr<ProfileList> profile_list_; |
147 | 160 |
148 // The controller for avatar menu actions. | 161 // The controller for avatar menu actions. |
149 scoped_ptr<AvatarMenuActions> menu_actions_; | 162 scoped_ptr<AvatarMenuActions> menu_actions_; |
150 | 163 |
151 // The cache that provides the profile information. Weak. | 164 // The cache that provides the profile information. Weak. |
152 ProfileInfoInterface* profile_info_; | 165 ProfileInfoInterface* profile_info_; |
153 | 166 |
154 // The observer of this model, which is notified of changes. Weak. | 167 // The observer of this model, which is notified of changes. Weak. |
155 AvatarMenuObserver* observer_; | 168 AvatarMenuObserver* observer_; |
156 | 169 |
157 // Browser in which this avatar menu resides. Weak. | 170 // Browser in which this avatar menu resides. Weak. |
158 Browser* browser_; | 171 Browser* browser_; |
159 | 172 |
160 // Listens for notifications from the ProfileInfoCache. | 173 // Listens for notifications from the ProfileInfoCache. |
161 content::NotificationRegistrar registrar_; | 174 content::NotificationRegistrar registrar_; |
162 | 175 |
163 DISALLOW_COPY_AND_ASSIGN(AvatarMenu); | 176 DISALLOW_COPY_AND_ASSIGN(AvatarMenu); |
164 }; | 177 }; |
165 | 178 |
166 #endif // CHROME_BROWSER_PROFILES_AVATAR_MENU_H_ | 179 #endif // CHROME_BROWSER_PROFILES_AVATAR_MENU_H_ |
OLD | NEW |