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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 active_profile = browser_->profile(); | 178 active_profile = browser_->profile(); |
179 | 179 |
180 size_t index = | 180 size_t index = |
181 profile_info_->GetIndexOfProfileWithPath(active_profile->GetPath()); | 181 profile_info_->GetIndexOfProfileWithPath(active_profile->GetPath()); |
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::GetManagedUserInformation() 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()->IsManaged()) { | 190 if (browser_ && browser_->profile()->IsSupervised()) { |
191 #if defined(ENABLE_MANAGED_USERS) | 191 #if defined(ENABLE_MANAGED_USERS) |
192 ManagedUserService* service = ManagedUserServiceFactory::GetForProfile( | 192 ManagedUserService* service = ManagedUserServiceFactory::GetForProfile( |
193 browser_->profile()); | 193 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::GetManagedUserIcon() const { | 202 const gfx::Image& AvatarMenu::GetSupervisedUserIcon() const { |
203 return ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 203 return ResourceBundle::GetSharedInstance().GetNativeImageNamed( |
204 IDR_MANAGED_USER_ICON); | 204 IDR_MANAGED_USER_ICON); |
205 } | 205 } |
206 | 206 |
207 void AvatarMenu::ActiveBrowserChanged(Browser* browser) { | 207 void AvatarMenu::ActiveBrowserChanged(Browser* browser) { |
208 browser_ = browser; | 208 browser_ = browser; |
209 menu_actions_->ActiveBrowserChanged(browser); | 209 menu_actions_->ActiveBrowserChanged(browser); |
210 | 210 |
211 // If browser is not NULL, get the path of its active profile. | 211 // If browser is not NULL, get the path of its active profile. |
212 base::FilePath path; | 212 base::FilePath path; |
(...skipping 11 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 |