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 #include "chrome/browser/profiles/avatar_menu.h" | 5 #include "chrome/browser/profiles/avatar_menu.h" |
6 | 6 |
7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/i18n/case_conversion.h" | 9 #include "base/i18n/case_conversion.h" |
10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
27 #include "components/signin/core/common/profile_management_switches.h" | 27 #include "components/signin/core/common/profile_management_switches.h" |
28 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
29 #include "content/public/browser/notification_service.h" | 29 #include "content/public/browser/notification_service.h" |
30 #include "grit/generated_resources.h" | 30 #include "grit/generated_resources.h" |
31 #include "grit/theme_resources.h" | 31 #include "grit/theme_resources.h" |
32 #include "ui/base/l10n/l10n_util.h" | 32 #include "ui/base/l10n/l10n_util.h" |
33 #include "ui/base/resource/resource_bundle.h" | 33 #include "ui/base/resource/resource_bundle.h" |
34 | 34 |
35 #if defined(ENABLE_MANAGED_USERS) | 35 #if defined(ENABLE_MANAGED_USERS) |
36 #include "chrome/browser/managed_mode/managed_user_service.h" | 36 #include "chrome/browser/supervised_user/supervised_user_service.h" |
37 #include "chrome/browser/managed_mode/managed_user_service_factory.h" | 37 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" |
38 #endif | 38 #endif |
39 | 39 |
40 using content::BrowserThread; | 40 using content::BrowserThread; |
41 | 41 |
42 namespace { | 42 namespace { |
43 | 43 |
44 // Constants for the show profile switcher experiment | 44 // Constants for the show profile switcher experiment |
45 const char kShowProfileSwitcherFieldTrialName[] = "ShowProfileSwitcher"; | 45 const char kShowProfileSwitcherFieldTrialName[] = "ShowProfileSwitcher"; |
46 const char kAlwaysShowSwitcherGroupName[] = "AlwaysShow"; | 46 const char kAlwaysShowSwitcherGroupName[] = "AlwaysShow"; |
47 | 47 |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 182 |
183 index = profile_list_->MenuIndexFromProfileIndex(index); | 183 index = profile_list_->MenuIndexFromProfileIndex(index); |
184 DCHECK_LT(index, profile_list_->GetNumberOfItems()); | 184 DCHECK_LT(index, profile_list_->GetNumberOfItems()); |
185 return index; | 185 return index; |
186 } | 186 } |
187 | 187 |
188 base::string16 AvatarMenu::GetSupervisedUserInformation() const { | 188 base::string16 AvatarMenu::GetSupervisedUserInformation() const { |
189 // |browser_| can be NULL in unit_tests. | 189 // |browser_| can be NULL in unit_tests. |
190 if (browser_ && browser_->profile()->IsSupervised()) { | 190 if (browser_ && browser_->profile()->IsSupervised()) { |
191 #if defined(ENABLE_MANAGED_USERS) | 191 #if defined(ENABLE_MANAGED_USERS) |
192 ManagedUserService* service = ManagedUserServiceFactory::GetForProfile( | 192 SupervisedUserService* service = |
193 browser_->profile()); | 193 SupervisedUserServiceFactory::GetForProfile(browser_->profile()); |
194 base::string16 custodian = | 194 base::string16 custodian = |
195 base::UTF8ToUTF16(service->GetCustodianEmailAddress()); | 195 base::UTF8ToUTF16(service->GetCustodianEmailAddress()); |
196 return l10n_util::GetStringFUTF16(IDS_MANAGED_USER_INFO, custodian); | 196 return l10n_util::GetStringFUTF16(IDS_MANAGED_USER_INFO, custodian); |
197 #endif | 197 #endif |
198 } | 198 } |
199 return base::string16(); | 199 return base::string16(); |
200 } | 200 } |
201 | 201 |
202 const gfx::Image& AvatarMenu::GetSupervisedUserIcon() const { | 202 const gfx::Image& AvatarMenu::GetSupervisedUserIcon() const { |
203 return ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 203 return ResourceBundle::GetSharedInstance().GetNativeImageNamed( |
(...skipping 20 matching lines...) Expand all Loading... |
224 } | 224 } |
225 | 225 |
226 void AvatarMenu::Observe(int type, | 226 void AvatarMenu::Observe(int type, |
227 const content::NotificationSource& source, | 227 const content::NotificationSource& source, |
228 const content::NotificationDetails& details) { | 228 const content::NotificationDetails& details) { |
229 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED, type); | 229 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED, type); |
230 RebuildMenu(); | 230 RebuildMenu(); |
231 if (observer_) | 231 if (observer_) |
232 observer_->OnAvatarMenuChanged(this); | 232 observer_->OnAvatarMenuChanged(this); |
233 } | 233 } |
OLD | NEW |