Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Side by Side Diff: chrome/browser/ui/ash/system_tray_delegate_chromeos.cc

Issue 1019283004: Switch to direct use of OwnerSettingsServiceChromeOS::Set() in tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use settings provider to set read-only device settings. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 #include "chrome/browser/chromeos/input_method/input_method_util.h" 50 #include "chrome/browser/chromeos/input_method/input_method_util.h"
51 #include "chrome/browser/chromeos/login/help_app_launcher.h" 51 #include "chrome/browser/chromeos/login/help_app_launcher.h"
52 #include "chrome/browser/chromeos/login/login_wizard.h" 52 #include "chrome/browser/chromeos/login/login_wizard.h"
53 #include "chrome/browser/chromeos/login/ui/login_display_host.h" 53 #include "chrome/browser/chromeos/login/ui/login_display_host.h"
54 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" 54 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h"
55 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" 55 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h"
56 #include "chrome/browser/chromeos/login/user_flow.h" 56 #include "chrome/browser/chromeos/login/user_flow.h"
57 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" 57 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h"
58 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" 58 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h"
59 #include "chrome/browser/chromeos/options/network_config_view.h" 59 #include "chrome/browser/chromeos/options/network_config_view.h"
60 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h"
61 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos_fact ory.h"
60 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" 62 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
61 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" 63 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h"
62 #include "chrome/browser/chromeos/profiles/multiprofiles_intro_dialog.h" 64 #include "chrome/browser/chromeos/profiles/multiprofiles_intro_dialog.h"
63 #include "chrome/browser/chromeos/profiles/profile_helper.h" 65 #include "chrome/browser/chromeos/profiles/profile_helper.h"
64 #include "chrome/browser/chromeos/set_time_dialog.h" 66 #include "chrome/browser/chromeos/set_time_dialog.h"
65 #include "chrome/browser/chromeos/settings/cros_settings.h" 67 #include "chrome/browser/chromeos/settings/cros_settings.h"
66 #include "chrome/browser/chromeos/ui/choose_mobile_network_dialog.h" 68 #include "chrome/browser/chromeos/ui/choose_mobile_network_dialog.h"
67 #include "chrome/browser/lifetime/application_lifetime.h" 69 #include "chrome/browser/lifetime/application_lifetime.h"
68 #include "chrome/browser/profiles/profile_manager.h" 70 #include "chrome/browser/profiles/profile_manager.h"
69 #include "chrome/browser/supervised_user/supervised_user_service.h" 71 #include "chrome/browser/supervised_user/supervised_user_service.h"
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 user_pref->GetValue()->GetAsBoolean(&use_24_hour_clock); 1006 user_pref->GetValue()->GetAsBoolean(&use_24_hour_clock);
1005 return use_24_hour_clock; 1007 return use_24_hour_clock;
1006 } 1008 }
1007 1009
1008 void SystemTrayDelegateChromeOS::UpdateClockType() { 1010 void SystemTrayDelegateChromeOS::UpdateClockType() {
1009 const bool use_24_hour_clock = ShouldUse24HourClock(); 1011 const bool use_24_hour_clock = ShouldUse24HourClock();
1010 clock_type_ = use_24_hour_clock ? base::k24HourClock : base::k12HourClock; 1012 clock_type_ = use_24_hour_clock ? base::k24HourClock : base::k12HourClock;
1011 GetSystemTrayNotifier()->NotifyDateFormatChanged(); 1013 GetSystemTrayNotifier()->NotifyDateFormatChanged();
1012 // This also works for enterprise-managed devices because they never have 1014 // This also works for enterprise-managed devices because they never have
1013 // local owner. 1015 // local owner.
1014 if (user_manager::UserManager::Get()->IsCurrentUserOwner()) 1016 if (user_manager::UserManager::Get()->IsCurrentUserOwner()) {
1015 CrosSettings::Get()->SetBoolean(kSystemUse24HourClock, use_24_hour_clock); 1017 Profile* profile = ProfileManager::GetActiveUserProfile();
1018 OwnerSettingsServiceChromeOS* service =
1019 OwnerSettingsServiceChromeOSFactory::GetForBrowserContext(profile);
1020 service->SetBoolean(kSystemUse24HourClock, use_24_hour_clock);
1021 }
1016 } 1022 }
1017 1023
1018 void SystemTrayDelegateChromeOS::UpdateShowLogoutButtonInTray() { 1024 void SystemTrayDelegateChromeOS::UpdateShowLogoutButtonInTray() {
1019 GetSystemTrayNotifier()->NotifyShowLoginButtonChanged( 1025 GetSystemTrayNotifier()->NotifyShowLoginButtonChanged(
1020 user_pref_registrar_->prefs()->GetBoolean( 1026 user_pref_registrar_->prefs()->GetBoolean(
1021 prefs::kShowLogoutButtonInTray)); 1027 prefs::kShowLogoutButtonInTray));
1022 } 1028 }
1023 1029
1024 void SystemTrayDelegateChromeOS::UpdateLogoutDialogDuration() { 1030 void SystemTrayDelegateChromeOS::UpdateLogoutDialogDuration() {
1025 const int duration_ms = 1031 const int duration_ms =
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
1106 // It apparently sometimes takes a while after login before the current user 1112 // It apparently sometimes takes a while after login before the current user
1107 // is recognized as the owner. Make sure that the system-wide clock setting 1113 // is recognized as the owner. Make sure that the system-wide clock setting
1108 // is updated when the recognition eventually happens 1114 // is updated when the recognition eventually happens
1109 // (http://crbug.com/278601). 1115 // (http://crbug.com/278601).
1110 // 1116 //
1111 // Note that it isn't safe to blindly call UpdateClockType() from this 1117 // Note that it isn't safe to blindly call UpdateClockType() from this
1112 // method, as LoggedInStateChanged() is also called before the logged-in 1118 // method, as LoggedInStateChanged() is also called before the logged-in
1113 // user's profile has actually been loaded (http://crbug.com/317745). The 1119 // user's profile has actually been loaded (http://crbug.com/317745). The
1114 // system tray's time format is updated at login via SetProfile(). 1120 // system tray's time format is updated at login via SetProfile().
1115 if (user_manager::UserManager::Get()->IsCurrentUserOwner()) { 1121 if (user_manager::UserManager::Get()->IsCurrentUserOwner()) {
1116 CrosSettings::Get()->SetBoolean(kSystemUse24HourClock, 1122 Profile* profile = ProfileManager::GetActiveUserProfile();
1117 ShouldUse24HourClock()); 1123 OwnerSettingsServiceChromeOS* service =
1124 OwnerSettingsServiceChromeOSFactory::GetForBrowserContext(profile);
1125 service->SetBoolean(kSystemUse24HourClock, ShouldUse24HourClock());
1118 } 1126 }
1119 } 1127 }
1120 1128
1121 // Overridden from SessionManagerClient::Observer. 1129 // Overridden from SessionManagerClient::Observer.
1122 void SystemTrayDelegateChromeOS::ScreenIsLocked() { 1130 void SystemTrayDelegateChromeOS::ScreenIsLocked() {
1123 screen_locked_ = true; 1131 screen_locked_ = true;
1124 ash::Shell::GetInstance()->UpdateAfterLoginStatusChange(GetUserLoginStatus()); 1132 ash::Shell::GetInstance()->UpdateAfterLoginStatusChange(GetUserLoginStatus());
1125 } 1133 }
1126 1134
1127 void SystemTrayDelegateChromeOS::ScreenIsUnlocked() { 1135 void SystemTrayDelegateChromeOS::ScreenIsUnlocked() {
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
1392 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " 1400 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while "
1393 << "ENABLE_SUPERVISED_USERS undefined."; 1401 << "ENABLE_SUPERVISED_USERS undefined.";
1394 return base::string16(); 1402 return base::string16();
1395 } 1403 }
1396 1404
1397 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { 1405 ash::SystemTrayDelegate* CreateSystemTrayDelegate() {
1398 return new SystemTrayDelegateChromeOS(); 1406 return new SystemTrayDelegateChromeOS();
1399 } 1407 }
1400 1408
1401 } // namespace chromeos 1409 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698