OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/ash/system_tray_delegate_chromeos.h" | 5 #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "base/time/time.h" | 32 #include "base/time/time.h" |
33 #include "chrome/browser/browser_process.h" | 33 #include "chrome/browser/browser_process.h" |
34 #include "chrome/browser/chrome_notification_types.h" | 34 #include "chrome/browser/chrome_notification_types.h" |
35 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" | 35 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" |
36 #include "chrome/browser/chromeos/events/system_key_event_listener.h" | 36 #include "chrome/browser/chromeos/events/system_key_event_listener.h" |
37 #include "chrome/browser/chromeos/input_method/input_method_switch_recorder.h" | 37 #include "chrome/browser/chromeos/input_method/input_method_switch_recorder.h" |
38 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 38 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
39 #include "chrome/browser/chromeos/login/help_app_launcher.h" | 39 #include "chrome/browser/chromeos/login/help_app_launcher.h" |
40 #include "chrome/browser/chromeos/login/login_wizard.h" | 40 #include "chrome/browser/chromeos/login/login_wizard.h" |
41 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" | 41 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" |
42 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" | |
43 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 42 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
44 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" | 43 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" |
45 #include "chrome/browser/chromeos/profiles/multiprofiles_intro_dialog.h" | 44 #include "chrome/browser/chromeos/profiles/multiprofiles_intro_dialog.h" |
46 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 45 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
47 #include "chrome/browser/profiles/profile_manager.h" | 46 #include "chrome/browser/profiles/profile_manager.h" |
48 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" | 47 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" |
49 #include "chrome/browser/ui/ash/networking_config_delegate_chromeos.h" | 48 #include "chrome/browser/ui/ash/networking_config_delegate_chromeos.h" |
50 #include "chrome/browser/ui/ash/system_tray_client.h" | 49 #include "chrome/browser/ui/ash/system_tray_client.h" |
51 #include "chrome/browser/ui/browser.h" | 50 #include "chrome/browser/ui/browser.h" |
52 #include "chrome/browser/ui/browser_list.h" | 51 #include "chrome/browser/ui/browser_list.h" |
(...skipping 18 matching lines...) Expand all Loading... |
71 #include "content/public/browser/notification_observer.h" | 70 #include "content/public/browser/notification_observer.h" |
72 #include "content/public/browser/notification_service.h" | 71 #include "content/public/browser/notification_service.h" |
73 #include "ui/base/ime/chromeos/extension_ime_util.h" | 72 #include "ui/base/ime/chromeos/extension_ime_util.h" |
74 #include "ui/base/ime/chromeos/input_method_manager.h" | 73 #include "ui/base/ime/chromeos/input_method_manager.h" |
75 #include "ui/base/l10n/l10n_util.h" | 74 #include "ui/base/l10n/l10n_util.h" |
76 #include "ui/base/l10n/time_format.h" | 75 #include "ui/base/l10n/time_format.h" |
77 #include "ui/chromeos/events/pref_names.h" | 76 #include "ui/chromeos/events/pref_names.h" |
78 #include "ui/chromeos/ime/input_method_menu_item.h" | 77 #include "ui/chromeos/ime/input_method_menu_item.h" |
79 #include "ui/chromeos/ime/input_method_menu_manager.h" | 78 #include "ui/chromeos/ime/input_method_menu_manager.h" |
80 | 79 |
81 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) | |
82 #include "chrome/browser/supervised_user/supervised_user_service.h" | |
83 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" | |
84 #endif | |
85 | |
86 namespace chromeos { | 80 namespace chromeos { |
87 | 81 |
88 namespace { | 82 namespace { |
89 | 83 |
90 // The minimum session length limit that can be set. | 84 // The minimum session length limit that can be set. |
91 const int kSessionLengthLimitMinMs = 30 * 1000; // 30 seconds. | 85 const int kSessionLengthLimitMinMs = 30 * 1000; // 30 seconds. |
92 | 86 |
93 // The maximum session length limit that can be set. | 87 // The maximum session length limit that can be set. |
94 const int kSessionLengthLimitMaxMs = 24 * 60 * 60 * 1000; // 24 hours. | 88 const int kSessionLengthLimitMaxMs = 24 * 60 * 60 * 1000; // 24 hours. |
95 | 89 |
(...skipping 10 matching lines...) Expand all Loading... |
106 void OnAcceptMultiprofilesIntro(bool no_show_again) { | 100 void OnAcceptMultiprofilesIntro(bool no_show_again) { |
107 PrefService* prefs = ProfileManager::GetActiveUserProfile()->GetPrefs(); | 101 PrefService* prefs = ProfileManager::GetActiveUserProfile()->GetPrefs(); |
108 prefs->SetBoolean(prefs::kMultiProfileNeverShowIntro, no_show_again); | 102 prefs->SetBoolean(prefs::kMultiProfileNeverShowIntro, no_show_again); |
109 UserAddingScreen::Get()->Start(); | 103 UserAddingScreen::Get()->Start(); |
110 } | 104 } |
111 | 105 |
112 bool IsSessionInSecondaryLoginScreen() { | 106 bool IsSessionInSecondaryLoginScreen() { |
113 return session_manager::SessionManager::Get()->IsInSecondaryLoginScreen(); | 107 return session_manager::SessionManager::Get()->IsInSecondaryLoginScreen(); |
114 } | 108 } |
115 | 109 |
116 bool IsUserSupervised() { | |
117 user_manager::User* user = user_manager::UserManager::Get()->GetActiveUser(); | |
118 return user && user->IsSupervised(); | |
119 } | |
120 | |
121 } // namespace | 110 } // namespace |
122 | 111 |
123 SystemTrayDelegateChromeOS::SystemTrayDelegateChromeOS() | 112 SystemTrayDelegateChromeOS::SystemTrayDelegateChromeOS() |
124 : networking_config_delegate_( | 113 : networking_config_delegate_( |
125 base::MakeUnique<NetworkingConfigDelegateChromeos>()) { | 114 base::MakeUnique<NetworkingConfigDelegateChromeos>()) { |
126 // Register notifications on construction so that events such as | 115 // Register notifications on construction so that events such as |
127 // PROFILE_CREATED do not get missed if they happen before Initialize(). | 116 // PROFILE_CREATED do not get missed if they happen before Initialize(). |
128 registrar_.reset(new content::NotificationRegistrar); | 117 registrar_.reset(new content::NotificationRegistrar); |
129 if (GetUserLoginStatus() == ash::LoginStatus::NOT_LOGGED_IN) { | 118 if (GetUserLoginStatus() == ash::LoginStatus::NOT_LOGGED_IN) { |
130 registrar_->Add(this, | 119 registrar_->Add(this, |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 registrar_.reset(); | 174 registrar_.reset(); |
186 | 175 |
187 // Unregister a11y status subscription. | 176 // Unregister a11y status subscription. |
188 accessibility_subscription_.reset(); | 177 accessibility_subscription_.reset(); |
189 | 178 |
190 input_method::InputMethodManager::Get()->RemoveObserver(this); | 179 input_method::InputMethodManager::Get()->RemoveObserver(this); |
191 ui::ime::InputMethodMenuManager::GetInstance()->RemoveObserver(this); | 180 ui::ime::InputMethodMenuManager::GetInstance()->RemoveObserver(this); |
192 | 181 |
193 BrowserList::RemoveObserver(this); | 182 BrowserList::RemoveObserver(this); |
194 StopObservingAppWindowRegistry(); | 183 StopObservingAppWindowRegistry(); |
195 StopObservingCustodianInfoChanges(); | |
196 | 184 |
197 policy::BrowserPolicyConnectorChromeOS* connector = | 185 policy::BrowserPolicyConnectorChromeOS* connector = |
198 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 186 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
199 policy::DeviceCloudPolicyManagerChromeOS* policy_manager = | 187 policy::DeviceCloudPolicyManagerChromeOS* policy_manager = |
200 connector->GetDeviceCloudPolicyManager(); | 188 connector->GetDeviceCloudPolicyManager(); |
201 if (policy_manager) | 189 if (policy_manager) |
202 policy_manager->core()->store()->RemoveObserver(this); | 190 policy_manager->core()->store()->RemoveObserver(this); |
203 } | 191 } |
204 | 192 |
205 ash::LoginStatus SystemTrayDelegateChromeOS::GetUserLoginStatus() const { | 193 ash::LoginStatus SystemTrayDelegateChromeOS::GetUserLoginStatus() const { |
206 return SystemTrayClient::GetUserLoginStatus(); | 194 return SystemTrayClient::GetUserLoginStatus(); |
207 } | 195 } |
208 | 196 |
209 std::string SystemTrayDelegateChromeOS::GetEnterpriseDomain() const { | 197 std::string SystemTrayDelegateChromeOS::GetEnterpriseDomain() const { |
210 return enterprise_domain_; | 198 return enterprise_domain_; |
211 } | 199 } |
212 | 200 |
213 base::string16 SystemTrayDelegateChromeOS::GetEnterpriseMessage() const { | 201 base::string16 SystemTrayDelegateChromeOS::GetEnterpriseMessage() const { |
214 if (is_active_directory_managed_) | 202 if (is_active_directory_managed_) |
215 return l10n_util::GetStringUTF16(IDS_DEVICE_ENTERPRISE_MANAGED_NOTICE); | 203 return l10n_util::GetStringUTF16(IDS_DEVICE_ENTERPRISE_MANAGED_NOTICE); |
216 if (!GetEnterpriseDomain().empty()) { | 204 if (!GetEnterpriseDomain().empty()) { |
217 return l10n_util::GetStringFUTF16(IDS_DEVICE_OWNED_BY_NOTICE, | 205 return l10n_util::GetStringFUTF16(IDS_DEVICE_OWNED_BY_NOTICE, |
218 base::UTF8ToUTF16(GetEnterpriseDomain())); | 206 base::UTF8ToUTF16(GetEnterpriseDomain())); |
219 } | 207 } |
220 return base::string16(); | 208 return base::string16(); |
221 } | 209 } |
222 | 210 |
223 std::string SystemTrayDelegateChromeOS::GetSupervisedUserManager() const { | |
224 if (!IsUserSupervised()) | |
225 return std::string(); | |
226 return SupervisedUserServiceFactory::GetForProfile(user_profile_)-> | |
227 GetCustodianEmailAddress(); | |
228 } | |
229 | |
230 base::string16 | |
231 SystemTrayDelegateChromeOS::GetSupervisedUserManagerName() const { | |
232 if (!IsUserSupervised()) | |
233 return base::string16(); | |
234 return base::UTF8ToUTF16(SupervisedUserServiceFactory::GetForProfile( | |
235 user_profile_)->GetCustodianName()); | |
236 } | |
237 | |
238 base::string16 SystemTrayDelegateChromeOS::GetSupervisedUserMessage() | |
239 const { | |
240 if (!IsUserSupervised()) | |
241 return base::string16(); | |
242 if (user_manager::UserManager::Get()->IsLoggedInAsChildUser()) | |
243 return GetChildUserMessage(); | |
244 return GetLegacySupervisedUserMessage(); | |
245 } | |
246 | |
247 void SystemTrayDelegateChromeOS::ShowEnterpriseInfo() { | 211 void SystemTrayDelegateChromeOS::ShowEnterpriseInfo() { |
248 // TODO(mash): Refactor out SessionStateDelegate and move to SystemTrayClient. | 212 // TODO(mash): Refactor out SessionStateDelegate and move to SystemTrayClient. |
249 ash::LoginStatus status = GetUserLoginStatus(); | 213 ash::LoginStatus status = GetUserLoginStatus(); |
250 if (status == ash::LoginStatus::NOT_LOGGED_IN || | 214 if (status == ash::LoginStatus::NOT_LOGGED_IN || |
251 status == ash::LoginStatus::LOCKED || IsSessionInSecondaryLoginScreen()) { | 215 status == ash::LoginStatus::LOCKED || IsSessionInSecondaryLoginScreen()) { |
252 scoped_refptr<chromeos::HelpAppLauncher> help_app( | 216 scoped_refptr<chromeos::HelpAppLauncher> help_app( |
253 new chromeos::HelpAppLauncher(nullptr /* parent_window */)); | 217 new chromeos::HelpAppLauncher(nullptr /* parent_window */)); |
254 help_app->ShowHelpTopic(chromeos::HelpAppLauncher::HELP_ENTERPRISE); | 218 help_app->ShowHelpTopic(chromeos::HelpAppLauncher::HELP_ENTERPRISE); |
255 } else { | 219 } else { |
256 chrome::ScopedTabbedBrowserDisplayer displayer( | 220 chrome::ScopedTabbedBrowserDisplayer displayer( |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 } | 346 } |
383 | 347 |
384 void SystemTrayDelegateChromeOS::ActiveUserWasChanged() { | 348 void SystemTrayDelegateChromeOS::ActiveUserWasChanged() { |
385 SetProfile(ProfileManager::GetActiveUserProfile()); | 349 SetProfile(ProfileManager::GetActiveUserProfile()); |
386 } | 350 } |
387 | 351 |
388 bool SystemTrayDelegateChromeOS::IsSearchKeyMappedToCapsLock() { | 352 bool SystemTrayDelegateChromeOS::IsSearchKeyMappedToCapsLock() { |
389 return search_key_mapped_to_ == input_method::kCapsLockKey; | 353 return search_key_mapped_to_ == input_method::kCapsLockKey; |
390 } | 354 } |
391 | 355 |
392 void SystemTrayDelegateChromeOS::AddCustodianInfoTrayObserver( | |
393 ash::CustodianInfoTrayObserver* observer) { | |
394 custodian_info_changed_observers_.AddObserver(observer); | |
395 } | |
396 | |
397 void SystemTrayDelegateChromeOS::RemoveCustodianInfoTrayObserver( | |
398 ash::CustodianInfoTrayObserver* observer) { | |
399 custodian_info_changed_observers_.RemoveObserver(observer); | |
400 } | |
401 | |
402 std::unique_ptr<ash::SystemTrayItem> | 356 std::unique_ptr<ash::SystemTrayItem> |
403 SystemTrayDelegateChromeOS::CreateRotationLockTrayItem(ash::SystemTray* tray) { | 357 SystemTrayDelegateChromeOS::CreateRotationLockTrayItem(ash::SystemTray* tray) { |
404 return base::MakeUnique<ash::TrayRotationLock>(tray); | 358 return base::MakeUnique<ash::TrayRotationLock>(tray); |
405 } | 359 } |
406 | 360 |
407 ash::SystemTrayNotifier* SystemTrayDelegateChromeOS::GetSystemTrayNotifier() { | 361 ash::SystemTrayNotifier* SystemTrayDelegateChromeOS::GetSystemTrayNotifier() { |
408 return ash::Shell::Get()->system_tray_notifier(); | 362 return ash::Shell::Get()->system_tray_notifier(); |
409 } | 363 } |
410 | 364 |
411 void SystemTrayDelegateChromeOS::SetProfile(Profile* profile) { | 365 void SystemTrayDelegateChromeOS::SetProfile(Profile* profile) { |
412 // Stop observing the AppWindowRegistry of the current |user_profile_|. | 366 // Stop observing the AppWindowRegistry of the current |user_profile_|. |
413 StopObservingAppWindowRegistry(); | 367 StopObservingAppWindowRegistry(); |
414 | 368 |
415 // Stop observing custodian info changes of the current |user_profile_|. | |
416 StopObservingCustodianInfoChanges(); | |
417 | |
418 user_profile_ = profile; | 369 user_profile_ = profile; |
419 | 370 |
420 // Start observing the AppWindowRegistry of the newly set |user_profile_|. | 371 // Start observing the AppWindowRegistry of the newly set |user_profile_|. |
421 extensions::AppWindowRegistry::Get(user_profile_)->AddObserver(this); | 372 extensions::AppWindowRegistry::Get(user_profile_)->AddObserver(this); |
422 | 373 |
423 // Start observing custodian info changes of the newly set |user_profile_|. | |
424 SupervisedUserServiceFactory::GetForProfile(profile)->AddObserver(this); | |
425 | |
426 PrefService* prefs = profile->GetPrefs(); | 374 PrefService* prefs = profile->GetPrefs(); |
427 user_pref_registrar_.reset(new PrefChangeRegistrar); | 375 user_pref_registrar_.reset(new PrefChangeRegistrar); |
428 user_pref_registrar_->Init(prefs); | 376 user_pref_registrar_->Init(prefs); |
429 user_pref_registrar_->Add( | 377 user_pref_registrar_->Add( |
430 prefs::kLanguageRemapSearchKeyTo, | 378 prefs::kLanguageRemapSearchKeyTo, |
431 base::Bind(&SystemTrayDelegateChromeOS::OnLanguageRemapSearchKeyToChanged, | 379 base::Bind(&SystemTrayDelegateChromeOS::OnLanguageRemapSearchKeyToChanged, |
432 base::Unretained(this))); | 380 base::Unretained(this))); |
433 user_pref_registrar_->Add( | 381 user_pref_registrar_->Add( |
434 prefs::kShowLogoutButtonInTray, | 382 prefs::kShowLogoutButtonInTray, |
435 base::Bind(&SystemTrayDelegateChromeOS::UpdateShowLogoutButtonInTray, | 383 base::Bind(&SystemTrayDelegateChromeOS::UpdateShowLogoutButtonInTray, |
(...skipping 15 matching lines...) Expand all Loading... |
451 base::Bind(&SystemTrayDelegateChromeOS::OnAccessibilityModeChanged, | 399 base::Bind(&SystemTrayDelegateChromeOS::OnAccessibilityModeChanged, |
452 base::Unretained(this), ash::A11Y_NOTIFICATION_NONE)); | 400 base::Unretained(this), ash::A11Y_NOTIFICATION_NONE)); |
453 user_pref_registrar_->Add( | 401 user_pref_registrar_->Add( |
454 prefs::kPerformanceTracingEnabled, | 402 prefs::kPerformanceTracingEnabled, |
455 base::Bind(&SystemTrayDelegateChromeOS::UpdatePerformanceTracing, | 403 base::Bind(&SystemTrayDelegateChromeOS::UpdatePerformanceTracing, |
456 base::Unretained(this))); | 404 base::Unretained(this))); |
457 | 405 |
458 UpdateShowLogoutButtonInTray(); | 406 UpdateShowLogoutButtonInTray(); |
459 UpdateLogoutDialogDuration(); | 407 UpdateLogoutDialogDuration(); |
460 UpdatePerformanceTracing(); | 408 UpdatePerformanceTracing(); |
461 OnCustodianInfoChanged(); | |
462 search_key_mapped_to_ = | 409 search_key_mapped_to_ = |
463 profile->GetPrefs()->GetInteger(prefs::kLanguageRemapSearchKeyTo); | 410 profile->GetPrefs()->GetInteger(prefs::kLanguageRemapSearchKeyTo); |
464 } | 411 } |
465 | 412 |
466 bool SystemTrayDelegateChromeOS::UnsetProfile(Profile* profile) { | 413 bool SystemTrayDelegateChromeOS::UnsetProfile(Profile* profile) { |
467 if (profile != user_profile_) | 414 if (profile != user_profile_) |
468 return false; | 415 return false; |
469 user_pref_registrar_.reset(); | 416 user_pref_registrar_.reset(); |
470 user_profile_ = NULL; | 417 user_profile_ = NULL; |
471 return true; | 418 return true; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 if (!user_profile_) | 463 if (!user_profile_) |
517 return; | 464 return; |
518 | 465 |
519 extensions::AppWindowRegistry* registry = | 466 extensions::AppWindowRegistry* registry = |
520 extensions::AppWindowRegistry::Factory::GetForBrowserContext( | 467 extensions::AppWindowRegistry::Factory::GetForBrowserContext( |
521 user_profile_, false); | 468 user_profile_, false); |
522 if (registry) | 469 if (registry) |
523 registry->RemoveObserver(this); | 470 registry->RemoveObserver(this); |
524 } | 471 } |
525 | 472 |
526 void SystemTrayDelegateChromeOS::StopObservingCustodianInfoChanges() { | |
527 if (!user_profile_) | |
528 return; | |
529 | |
530 SupervisedUserService* service = SupervisedUserServiceFactory::GetForProfile( | |
531 user_profile_); | |
532 if (service) | |
533 service->RemoveObserver(this); | |
534 } | |
535 | |
536 void SystemTrayDelegateChromeOS::NotifyIfLastWindowClosed() { | 473 void SystemTrayDelegateChromeOS::NotifyIfLastWindowClosed() { |
537 if (!user_profile_) | 474 if (!user_profile_) |
538 return; | 475 return; |
539 | 476 |
540 BrowserList* browser_list = BrowserList::GetInstance(); | 477 BrowserList* browser_list = BrowserList::GetInstance(); |
541 for (BrowserList::const_iterator it = browser_list->begin(); | 478 for (BrowserList::const_iterator it = browser_list->begin(); |
542 it != browser_list->end(); | 479 it != browser_list->end(); |
543 ++it) { | 480 ++it) { |
544 if ((*it)->profile()->IsSameProfile(user_profile_)) { | 481 if ((*it)->profile()->IsSameProfile(user_profile_)) { |
545 // The current user has at least one open browser window. | 482 // The current user has at least one open browser window. |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 void SystemTrayDelegateChromeOS::OnBrowserRemoved(Browser* browser) { | 584 void SystemTrayDelegateChromeOS::OnBrowserRemoved(Browser* browser) { |
648 NotifyIfLastWindowClosed(); | 585 NotifyIfLastWindowClosed(); |
649 } | 586 } |
650 | 587 |
651 // Overridden from extensions::AppWindowRegistry::Observer. | 588 // Overridden from extensions::AppWindowRegistry::Observer. |
652 void SystemTrayDelegateChromeOS::OnAppWindowRemoved( | 589 void SystemTrayDelegateChromeOS::OnAppWindowRemoved( |
653 extensions::AppWindow* app_window) { | 590 extensions::AppWindow* app_window) { |
654 NotifyIfLastWindowClosed(); | 591 NotifyIfLastWindowClosed(); |
655 } | 592 } |
656 | 593 |
657 // Overridden from SupervisedUserServiceObserver. | |
658 void SystemTrayDelegateChromeOS::OnCustodianInfoChanged() { | |
659 for (ash::CustodianInfoTrayObserver& observer : | |
660 custodian_info_changed_observers_) { | |
661 observer.OnCustodianInfoChanged(); | |
662 } | |
663 } | |
664 | |
665 void SystemTrayDelegateChromeOS::OnAccessibilityStatusChanged( | 594 void SystemTrayDelegateChromeOS::OnAccessibilityStatusChanged( |
666 const AccessibilityStatusEventDetails& details) { | 595 const AccessibilityStatusEventDetails& details) { |
667 if (details.notification_type == ACCESSIBILITY_MANAGER_SHUTDOWN) | 596 if (details.notification_type == ACCESSIBILITY_MANAGER_SHUTDOWN) |
668 accessibility_subscription_.reset(); | 597 accessibility_subscription_.reset(); |
669 else | 598 else |
670 OnAccessibilityModeChanged(details.notify); | 599 OnAccessibilityModeChanged(details.notify); |
671 } | 600 } |
672 | 601 |
673 void SystemTrayDelegateChromeOS::ImeMenuActivationChanged(bool is_active) { | 602 void SystemTrayDelegateChromeOS::ImeMenuActivationChanged(bool is_active) { |
674 GetSystemTrayNotifier()->NotifyRefreshIMEMenu(is_active); | 603 GetSystemTrayNotifier()->NotifyRefreshIMEMenu(is_active); |
675 } | 604 } |
676 | 605 |
677 void SystemTrayDelegateChromeOS::ImeMenuListChanged() {} | 606 void SystemTrayDelegateChromeOS::ImeMenuListChanged() {} |
678 | 607 |
679 void SystemTrayDelegateChromeOS::ImeMenuItemsChanged( | 608 void SystemTrayDelegateChromeOS::ImeMenuItemsChanged( |
680 const std::string& engine_id, | 609 const std::string& engine_id, |
681 const std::vector<input_method::InputMethodManager::MenuItem>& items) {} | 610 const std::vector<input_method::InputMethodManager::MenuItem>& items) {} |
682 | 611 |
683 const base::string16 | |
684 SystemTrayDelegateChromeOS::GetLegacySupervisedUserMessage() const { | |
685 std::string user_manager_name = GetSupervisedUserManager(); | |
686 return l10n_util::GetStringFUTF16( | |
687 IDS_USER_IS_SUPERVISED_BY_NOTICE, | |
688 base::UTF8ToUTF16(user_manager_name)); | |
689 } | |
690 | |
691 const base::string16 | |
692 SystemTrayDelegateChromeOS::GetChildUserMessage() const { | |
693 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) | |
694 // TODO(jamescook): If supervised users are always enabled on Chrome OS then | |
695 // these ifdefs can be removed. | |
696 SupervisedUserService* service = | |
697 SupervisedUserServiceFactory::GetForProfile(user_profile_); | |
698 base::string16 first_custodian = | |
699 base::UTF8ToUTF16(service->GetCustodianEmailAddress()); | |
700 base::string16 second_custodian = | |
701 base::UTF8ToUTF16(service->GetSecondCustodianEmailAddress()); | |
702 LOG_IF(WARNING, first_custodian.empty()) << | |
703 "Returning incomplete child user message as manager not known yet."; | |
704 if (second_custodian.empty()) { | |
705 return l10n_util::GetStringFUTF16( | |
706 IDS_CHILD_USER_IS_MANAGED_BY_ONE_PARENT_NOTICE, first_custodian); | |
707 } else { | |
708 return l10n_util::GetStringFUTF16( | |
709 IDS_CHILD_USER_IS_MANAGED_BY_TWO_PARENTS_NOTICE, | |
710 first_custodian, | |
711 second_custodian); | |
712 } | |
713 #endif | |
714 | |
715 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " | |
716 << "ENABLE_SUPERVISED_USERS undefined."; | |
717 return base::string16(); | |
718 } | |
719 | |
720 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 612 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
721 return new SystemTrayDelegateChromeOS(); | 613 return new SystemTrayDelegateChromeOS(); |
722 } | 614 } |
723 | 615 |
724 } // namespace chromeos | 616 } // namespace chromeos |
OLD | NEW |