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 <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 51 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
52 #include "chrome/browser/chromeos/login/help_app_launcher.h" | 52 #include "chrome/browser/chromeos/login/help_app_launcher.h" |
53 #include "chrome/browser/chromeos/login/login_wizard.h" | 53 #include "chrome/browser/chromeos/login/login_wizard.h" |
54 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | 54 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
55 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 55 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
56 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" | 56 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" |
57 #include "chrome/browser/chromeos/login/user_flow.h" | 57 #include "chrome/browser/chromeos/login/user_flow.h" |
58 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" | 58 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
59 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" | 59 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" |
60 #include "chrome/browser/chromeos/options/network_config_view.h" | 60 #include "chrome/browser/chromeos/options/network_config_view.h" |
| 61 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h" |
| 62 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos_fact
ory.h" |
61 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 63 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
62 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" | 64 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" |
63 #include "chrome/browser/chromeos/profiles/multiprofiles_intro_dialog.h" | 65 #include "chrome/browser/chromeos/profiles/multiprofiles_intro_dialog.h" |
64 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 66 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
65 #include "chrome/browser/chromeos/set_time_dialog.h" | 67 #include "chrome/browser/chromeos/set_time_dialog.h" |
66 #include "chrome/browser/chromeos/settings/cros_settings.h" | 68 #include "chrome/browser/chromeos/settings/cros_settings.h" |
67 #include "chrome/browser/chromeos/ui/choose_mobile_network_dialog.h" | 69 #include "chrome/browser/chromeos/ui/choose_mobile_network_dialog.h" |
68 #include "chrome/browser/lifetime/application_lifetime.h" | 70 #include "chrome/browser/lifetime/application_lifetime.h" |
69 #include "chrome/browser/profiles/profile_manager.h" | 71 #include "chrome/browser/profiles/profile_manager.h" |
70 #include "chrome/browser/supervised_user/supervised_user_service.h" | 72 #include "chrome/browser/supervised_user/supervised_user_service.h" |
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1011 user_pref->GetValue()->GetAsBoolean(&use_24_hour_clock); | 1013 user_pref->GetValue()->GetAsBoolean(&use_24_hour_clock); |
1012 return use_24_hour_clock; | 1014 return use_24_hour_clock; |
1013 } | 1015 } |
1014 | 1016 |
1015 void SystemTrayDelegateChromeOS::UpdateClockType() { | 1017 void SystemTrayDelegateChromeOS::UpdateClockType() { |
1016 const bool use_24_hour_clock = ShouldUse24HourClock(); | 1018 const bool use_24_hour_clock = ShouldUse24HourClock(); |
1017 clock_type_ = use_24_hour_clock ? base::k24HourClock : base::k12HourClock; | 1019 clock_type_ = use_24_hour_clock ? base::k24HourClock : base::k12HourClock; |
1018 GetSystemTrayNotifier()->NotifyDateFormatChanged(); | 1020 GetSystemTrayNotifier()->NotifyDateFormatChanged(); |
1019 // This also works for enterprise-managed devices because they never have | 1021 // This also works for enterprise-managed devices because they never have |
1020 // local owner. | 1022 // local owner. |
1021 if (user_manager::UserManager::Get()->IsCurrentUserOwner()) | 1023 if (user_manager::UserManager::Get()->IsCurrentUserOwner()) { |
1022 CrosSettings::Get()->SetBoolean(kSystemUse24HourClock, use_24_hour_clock); | 1024 user_manager::User* const user = |
| 1025 user_manager::UserManager::Get()->GetActiveUser(); |
| 1026 CHECK(user); |
| 1027 Profile* const profile = ProfileHelper::Get()->GetProfileByUser(user); |
| 1028 CHECK(profile); |
| 1029 OwnerSettingsServiceChromeOS* const service = |
| 1030 OwnerSettingsServiceChromeOSFactory::GetForBrowserContext(profile); |
| 1031 CHECK(service); |
| 1032 service->SetBoolean(kSystemUse24HourClock, use_24_hour_clock); |
| 1033 } |
1023 } | 1034 } |
1024 | 1035 |
1025 void SystemTrayDelegateChromeOS::UpdateShowLogoutButtonInTray() { | 1036 void SystemTrayDelegateChromeOS::UpdateShowLogoutButtonInTray() { |
1026 GetSystemTrayNotifier()->NotifyShowLoginButtonChanged( | 1037 GetSystemTrayNotifier()->NotifyShowLoginButtonChanged( |
1027 user_pref_registrar_->prefs()->GetBoolean( | 1038 user_pref_registrar_->prefs()->GetBoolean( |
1028 prefs::kShowLogoutButtonInTray)); | 1039 prefs::kShowLogoutButtonInTray)); |
1029 } | 1040 } |
1030 | 1041 |
1031 void SystemTrayDelegateChromeOS::UpdateLogoutDialogDuration() { | 1042 void SystemTrayDelegateChromeOS::UpdateLogoutDialogDuration() { |
1032 const int duration_ms = | 1043 const int duration_ms = |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1113 // It apparently sometimes takes a while after login before the current user | 1124 // It apparently sometimes takes a while after login before the current user |
1114 // is recognized as the owner. Make sure that the system-wide clock setting | 1125 // is recognized as the owner. Make sure that the system-wide clock setting |
1115 // is updated when the recognition eventually happens | 1126 // is updated when the recognition eventually happens |
1116 // (http://crbug.com/278601). | 1127 // (http://crbug.com/278601). |
1117 // | 1128 // |
1118 // Note that it isn't safe to blindly call UpdateClockType() from this | 1129 // Note that it isn't safe to blindly call UpdateClockType() from this |
1119 // method, as LoggedInStateChanged() is also called before the logged-in | 1130 // method, as LoggedInStateChanged() is also called before the logged-in |
1120 // user's profile has actually been loaded (http://crbug.com/317745). The | 1131 // user's profile has actually been loaded (http://crbug.com/317745). The |
1121 // system tray's time format is updated at login via SetProfile(). | 1132 // system tray's time format is updated at login via SetProfile(). |
1122 if (user_manager::UserManager::Get()->IsCurrentUserOwner()) { | 1133 if (user_manager::UserManager::Get()->IsCurrentUserOwner()) { |
1123 CrosSettings::Get()->SetBoolean(kSystemUse24HourClock, | 1134 user_manager::User* const user = |
1124 ShouldUse24HourClock()); | 1135 user_manager::UserManager::Get()->GetActiveUser(); |
| 1136 CHECK(user); |
| 1137 Profile* const profile = ProfileHelper::Get()->GetProfileByUser(user); |
| 1138 CHECK(profile); |
| 1139 OwnerSettingsServiceChromeOS* const service = |
| 1140 OwnerSettingsServiceChromeOSFactory::GetForBrowserContext(profile); |
| 1141 CHECK(service); |
| 1142 service->SetBoolean(kSystemUse24HourClock, ShouldUse24HourClock()); |
1125 } | 1143 } |
1126 } | 1144 } |
1127 | 1145 |
1128 // Overridden from SessionManagerClient::Observer. | 1146 // Overridden from SessionManagerClient::Observer. |
1129 void SystemTrayDelegateChromeOS::ScreenIsLocked() { | 1147 void SystemTrayDelegateChromeOS::ScreenIsLocked() { |
1130 screen_locked_ = true; | 1148 screen_locked_ = true; |
1131 ash::Shell::GetInstance()->UpdateAfterLoginStatusChange(GetUserLoginStatus()); | 1149 ash::Shell::GetInstance()->UpdateAfterLoginStatusChange(GetUserLoginStatus()); |
1132 } | 1150 } |
1133 | 1151 |
1134 void SystemTrayDelegateChromeOS::ScreenIsUnlocked() { | 1152 void SystemTrayDelegateChromeOS::ScreenIsUnlocked() { |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1399 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " | 1417 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " |
1400 << "ENABLE_SUPERVISED_USERS undefined."; | 1418 << "ENABLE_SUPERVISED_USERS undefined."; |
1401 return base::string16(); | 1419 return base::string16(); |
1402 } | 1420 } |
1403 | 1421 |
1404 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1422 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
1405 return new SystemTrayDelegateChromeOS(); | 1423 return new SystemTrayDelegateChromeOS(); |
1406 } | 1424 } |
1407 | 1425 |
1408 } // namespace chromeos | 1426 } // namespace chromeos |
OLD | NEW |