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 "base/scoped_observer.h" | |
Bernhard Bauer
2014/09/25 16:11:19
For sake of simplicity, I would include this uncon
Marc Treib
2014/09/25 16:17:17
Done.
| |
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 |
34 #if defined(ENABLE_MANAGED_USERS) | |
35 class SupervisedUserService; | |
Bernhard Bauer
2014/09/25 16:11:19
Same here, forward-declare this unconditionally. I
Marc Treib
2014/09/25 16:17:16
Done.
| |
36 #endif | |
28 | 37 |
29 // This class represents the menu-like interface used to select profiles, | 38 // 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 | 39 // 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 | 40 // browser window frame. This class will notify its observer when the backend |
32 // data changes, and the view for this model should forward actions | 41 // data changes, and the view for this model should forward actions |
33 // back to it in response to user events. | 42 // back to it in response to user events. |
34 class AvatarMenu : public content::NotificationObserver { | 43 class AvatarMenu : |
44 #if defined(ENABLE_MANAGED_USERS) | |
45 public SupervisedUserServiceObserver, | |
46 #endif | |
47 public content::NotificationObserver { | |
35 public: | 48 public: |
36 // Represents an item in the menu. | 49 // Represents an item in the menu. |
37 struct Item { | 50 struct Item { |
38 Item(size_t menu_index, size_t profile_index, const gfx::Image& icon); | 51 Item(size_t menu_index, size_t profile_index, const gfx::Image& icon); |
39 ~Item(); | 52 ~Item(); |
40 | 53 |
41 // The icon to be displayed next to the item. | 54 // The icon to be displayed next to the item. |
42 gfx::Image icon; | 55 gfx::Image icon; |
43 | 56 |
44 // Whether or not the current browser is using this profile. | 57 // Whether or not the current browser is using this profile. |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
135 | 148 |
136 // Returns true if the edit profile link should be shown. | 149 // Returns true if the edit profile link should be shown. |
137 bool ShouldShowEditProfileLink() const; | 150 bool ShouldShowEditProfileLink() const; |
138 | 151 |
139 // content::NotificationObserver: | 152 // content::NotificationObserver: |
140 virtual void Observe(int type, | 153 virtual void Observe(int type, |
141 const content::NotificationSource& source, | 154 const content::NotificationSource& source, |
142 const content::NotificationDetails& details) OVERRIDE; | 155 const content::NotificationDetails& details) OVERRIDE; |
143 | 156 |
144 private: | 157 private: |
158 #if defined(ENABLE_MANAGED_USERS) | |
159 // SupervisedUserServiceObserver: | |
160 virtual void OnCustodianInfoChanged() OVERRIDE; | |
161 #endif | |
162 | |
145 // The model that provides the list of menu items. | 163 // The model that provides the list of menu items. |
146 scoped_ptr<ProfileList> profile_list_; | 164 scoped_ptr<ProfileList> profile_list_; |
147 | 165 |
148 // The controller for avatar menu actions. | 166 // The controller for avatar menu actions. |
149 scoped_ptr<AvatarMenuActions> menu_actions_; | 167 scoped_ptr<AvatarMenuActions> menu_actions_; |
150 | 168 |
169 #if defined(ENABLE_MANAGED_USERS) | |
170 // Observes changes to a supervised user's custodian info. | |
171 ScopedObserver<SupervisedUserService, SupervisedUserServiceObserver> | |
172 supervised_user_observer_; | |
Bernhard Bauer
2014/09/25 16:11:19
Indent two more spaces.
Marc Treib
2014/09/25 16:17:17
Done.
| |
173 #endif | |
174 | |
151 // The cache that provides the profile information. Weak. | 175 // The cache that provides the profile information. Weak. |
152 ProfileInfoInterface* profile_info_; | 176 ProfileInfoInterface* profile_info_; |
153 | 177 |
154 // The observer of this model, which is notified of changes. Weak. | 178 // The observer of this model, which is notified of changes. Weak. |
155 AvatarMenuObserver* observer_; | 179 AvatarMenuObserver* observer_; |
156 | 180 |
157 // Browser in which this avatar menu resides. Weak. | 181 // Browser in which this avatar menu resides. Weak. |
158 Browser* browser_; | 182 Browser* browser_; |
159 | 183 |
160 // Listens for notifications from the ProfileInfoCache. | 184 // Listens for notifications from the ProfileInfoCache. |
161 content::NotificationRegistrar registrar_; | 185 content::NotificationRegistrar registrar_; |
162 | 186 |
163 DISALLOW_COPY_AND_ASSIGN(AvatarMenu); | 187 DISALLOW_COPY_AND_ASSIGN(AvatarMenu); |
164 }; | 188 }; |
165 | 189 |
166 #endif // CHROME_BROWSER_PROFILES_AVATAR_MENU_H_ | 190 #endif // CHROME_BROWSER_PROFILES_AVATAR_MENU_H_ |
OLD | NEW |