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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 SupervisedUserService* service = | 192 SupervisedUserService* service = |
193 SupervisedUserServiceFactory::GetForProfile(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_SUPERVISED_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( |
204 IDR_MANAGED_USER_ICON); | 204 IDR_SUPERVISED_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; |
213 if (browser) | 213 if (browser) |
214 path = browser->profile()->GetPath(); | 214 path = browser->profile()->GetPath(); |
215 profile_list_->ActiveProfilePathChanged(path); | 215 profile_list_->ActiveProfilePathChanged(path); |
216 } | 216 } |
217 | 217 |
218 bool AvatarMenu::ShouldShowAddNewProfileLink() const { | 218 bool AvatarMenu::ShouldShowAddNewProfileLink() const { |
219 return menu_actions_->ShouldShowAddNewProfileLink(); | 219 return menu_actions_->ShouldShowAddNewProfileLink(); |
220 } | 220 } |
221 | 221 |
222 bool AvatarMenu::ShouldShowEditProfileLink() const { | 222 bool AvatarMenu::ShouldShowEditProfileLink() const { |
223 return menu_actions_->ShouldShowEditProfileLink(); | 223 return menu_actions_->ShouldShowEditProfileLink(); |
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 |