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 <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/scoped_observer.h" | 16 #include "base/scoped_observer.h" |
17 #include "base/strings/string16.h" | 17 #include "base/strings/string16.h" |
18 #include "chrome/browser/profiles/profile_attributes_storage.h" | 18 #include "chrome/browser/profiles/profile_attributes_storage.h" |
19 #include "chrome/browser/profiles/profile_metrics.h" | 19 #include "chrome/browser/profiles/profile_metrics.h" |
| 20 #include "chrome/common/features.h" |
20 #include "content/public/browser/web_contents.h" | 21 #include "content/public/browser/web_contents.h" |
21 #include "content/public/browser/web_contents_observer.h" | 22 #include "content/public/browser/web_contents_observer.h" |
22 #include "ui/gfx/image/image.h" | 23 #include "ui/gfx/image/image.h" |
23 | 24 |
24 #if defined(ENABLE_SUPERVISED_USERS) | 25 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) |
25 #include "chrome/browser/supervised_user/supervised_user_service_observer.h" | 26 #include "chrome/browser/supervised_user/supervised_user_service_observer.h" |
26 #endif | 27 #endif |
27 | 28 |
28 class AvatarMenuActions; | 29 class AvatarMenuActions; |
29 class AvatarMenuObserver; | 30 class AvatarMenuObserver; |
30 class Browser; | 31 class Browser; |
31 class Profile; | 32 class Profile; |
32 class ProfileAttributesStorage; | 33 class ProfileAttributesStorage; |
33 class ProfileList; | 34 class ProfileList; |
34 class SupervisedUserService; | 35 class SupervisedUserService; |
35 | 36 |
36 // This class represents the menu-like interface used to select profiles, | 37 // This class represents the menu-like interface used to select profiles, |
37 // such as the bubble that appears when the avatar icon is clicked in the | 38 // such as the bubble that appears when the avatar icon is clicked in the |
38 // browser window frame. This class will notify its observer when the backend | 39 // browser window frame. This class will notify its observer when the backend |
39 // data changes, and the view for this model should forward actions | 40 // data changes, and the view for this model should forward actions |
40 // back to it in response to user events. | 41 // back to it in response to user events. |
41 class AvatarMenu : | 42 class AvatarMenu : |
42 #if defined(ENABLE_SUPERVISED_USERS) | 43 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) |
43 public SupervisedUserServiceObserver, | 44 public SupervisedUserServiceObserver, |
44 #endif | 45 #endif |
45 public ProfileAttributesStorage::Observer { | 46 public ProfileAttributesStorage::Observer { |
46 public: | 47 public: |
47 // Represents an item in the menu. | 48 // Represents an item in the menu. |
48 struct Item { | 49 struct Item { |
49 Item(size_t menu_index, const base::FilePath& profile_path, | 50 Item(size_t menu_index, const base::FilePath& profile_path, |
50 const gfx::Image& icon); | 51 const gfx::Image& icon); |
51 Item(const Item& other); | 52 Item(const Item& other); |
52 ~Item(); | 53 ~Item(); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 void OnProfileNameChanged(const base::FilePath& profile_path, | 155 void OnProfileNameChanged(const base::FilePath& profile_path, |
155 const base::string16& old_profile_name) override; | 156 const base::string16& old_profile_name) override; |
156 void OnProfileAuthInfoChanged(const base::FilePath& profile_path) override; | 157 void OnProfileAuthInfoChanged(const base::FilePath& profile_path) override; |
157 void OnProfileAvatarChanged(const base::FilePath& profile_path) override; | 158 void OnProfileAvatarChanged(const base::FilePath& profile_path) override; |
158 void OnProfileHighResAvatarLoaded( | 159 void OnProfileHighResAvatarLoaded( |
159 const base::FilePath& profile_path) override; | 160 const base::FilePath& profile_path) override; |
160 void OnProfileSigninRequiredChanged( | 161 void OnProfileSigninRequiredChanged( |
161 const base::FilePath& profile_path) override; | 162 const base::FilePath& profile_path) override; |
162 void OnProfileIsOmittedChanged(const base::FilePath& profile_path) override; | 163 void OnProfileIsOmittedChanged(const base::FilePath& profile_path) override; |
163 | 164 |
164 #if defined(ENABLE_SUPERVISED_USERS) | 165 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) |
165 // SupervisedUserServiceObserver: | 166 // SupervisedUserServiceObserver: |
166 void OnCustodianInfoChanged() override; | 167 void OnCustodianInfoChanged() override; |
167 #endif | 168 #endif |
168 | 169 |
169 // Rebuilds the menu and notifies any observers that an update occured. | 170 // Rebuilds the menu and notifies any observers that an update occured. |
170 void Update(); | 171 void Update(); |
171 | 172 |
172 // The model that provides the list of menu items. | 173 // The model that provides the list of menu items. |
173 std::unique_ptr<ProfileList> profile_list_; | 174 std::unique_ptr<ProfileList> profile_list_; |
174 | 175 |
175 // The controller for avatar menu actions. | 176 // The controller for avatar menu actions. |
176 std::unique_ptr<AvatarMenuActions> menu_actions_; | 177 std::unique_ptr<AvatarMenuActions> menu_actions_; |
177 | 178 |
178 #if defined(ENABLE_SUPERVISED_USERS) | 179 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) |
179 // Observes changes to a supervised user's custodian info. | 180 // Observes changes to a supervised user's custodian info. |
180 ScopedObserver<SupervisedUserService, SupervisedUserServiceObserver> | 181 ScopedObserver<SupervisedUserService, SupervisedUserServiceObserver> |
181 supervised_user_observer_; | 182 supervised_user_observer_; |
182 #endif | 183 #endif |
183 | 184 |
184 // The storage that provides the profile attributes. Weak. | 185 // The storage that provides the profile attributes. Weak. |
185 ProfileAttributesStorage* profile_storage_; | 186 ProfileAttributesStorage* profile_storage_; |
186 | 187 |
187 // The observer of this model, which is notified of changes. Weak. | 188 // The observer of this model, which is notified of changes. Weak. |
188 AvatarMenuObserver* observer_; | 189 AvatarMenuObserver* observer_; |
189 | 190 |
190 // Browser in which this avatar menu resides. Weak. | 191 // Browser in which this avatar menu resides. Weak. |
191 Browser* browser_; | 192 Browser* browser_; |
192 | 193 |
193 DISALLOW_COPY_AND_ASSIGN(AvatarMenu); | 194 DISALLOW_COPY_AND_ASSIGN(AvatarMenu); |
194 }; | 195 }; |
195 | 196 |
196 #endif // CHROME_BROWSER_PROFILES_AVATAR_MENU_H_ | 197 #endif // CHROME_BROWSER_PROFILES_AVATAR_MENU_H_ |
OLD | NEW |