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

Side by Side Diff: chrome/browser/chromeos/system/ash_system_tray_delegate.cc

Issue 21133012: Login screen and Guest mode should use device owner preference (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved Use24HourClock setting to Device Settings. Created 7 years, 4 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 (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/chromeos/system/ash_system_tray_delegate.h" 5 #include "chrome/browser/chromeos/system/ash_system_tray_delegate.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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 #include "chrome/browser/chromeos/login/login_display_host_impl.h" 59 #include "chrome/browser/chromeos/login/login_display_host_impl.h"
60 #include "chrome/browser/chromeos/login/login_wizard.h" 60 #include "chrome/browser/chromeos/login/login_wizard.h"
61 #include "chrome/browser/chromeos/login/startup_utils.h" 61 #include "chrome/browser/chromeos/login/startup_utils.h"
62 #include "chrome/browser/chromeos/login/user.h" 62 #include "chrome/browser/chromeos/login/user.h"
63 #include "chrome/browser/chromeos/login/user_adding_screen.h" 63 #include "chrome/browser/chromeos/login/user_adding_screen.h"
64 #include "chrome/browser/chromeos/login/user_manager.h" 64 #include "chrome/browser/chromeos/login/user_manager.h"
65 #include "chrome/browser/chromeos/mobile_config.h" 65 #include "chrome/browser/chromeos/mobile_config.h"
66 #include "chrome/browser/chromeos/options/network_config_view.h" 66 #include "chrome/browser/chromeos/options/network_config_view.h"
67 #include "chrome/browser/chromeos/options/network_connect.h" 67 #include "chrome/browser/chromeos/options/network_connect.h"
68 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" 68 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h"
69 #include "chrome/browser/chromeos/settings/cros_settings.h"
69 #include "chrome/browser/chromeos/sim_dialog_delegate.h" 70 #include "chrome/browser/chromeos/sim_dialog_delegate.h"
70 #include "chrome/browser/chromeos/status/data_promo_notification.h" 71 #include "chrome/browser/chromeos/status/data_promo_notification.h"
71 #include "chrome/browser/chromeos/system/timezone_settings.h" 72 #include "chrome/browser/chromeos/system/timezone_settings.h"
72 #include "chrome/browser/chromeos/system_key_event_listener.h" 73 #include "chrome/browser/chromeos/system_key_event_listener.h"
73 #include "chrome/browser/drive/drive_service_interface.h" 74 #include "chrome/browser/drive/drive_service_interface.h"
74 #include "chrome/browser/google/google_util.h" 75 #include "chrome/browser/google/google_util.h"
75 #include "chrome/browser/lifetime/application_lifetime.h" 76 #include "chrome/browser/lifetime/application_lifetime.h"
76 #include "chrome/browser/policy/browser_policy_connector.h" 77 #include "chrome/browser/policy/browser_policy_connector.h"
77 #include "chrome/browser/policy/cloud/cloud_policy_store.h" 78 #include "chrome/browser/policy/cloud/cloud_policy_store.h"
78 #include "chrome/browser/profiles/profile_manager.h" 79 #include "chrome/browser/profiles/profile_manager.h"
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 integration_service->job_list()->AddObserver(this); 964 integration_service->job_list()->AddObserver(this);
964 } 965 }
965 966
966 void UnobserveDriveUpdates() { 967 void UnobserveDriveUpdates() {
967 DriveIntegrationService* integration_service = 968 DriveIntegrationService* integration_service =
968 FindDriveIntegrationService(); 969 FindDriveIntegrationService();
969 if (integration_service) 970 if (integration_service)
970 integration_service->job_list()->RemoveObserver(this); 971 integration_service->job_list()->RemoveObserver(this);
971 } 972 }
972 973
974 bool ShouldUse24HourClock() const {
975 // On login screen and in guest mode owner default is used for
976 // kUse24HourClock preference.
977 // All other modes default to the default locale value.
978 const ash::user::LoginStatus status = GetUserLoginStatus();
979 const CrosSettings* const cros_settings = CrosSettings::Get();
980 bool system_use_24_hour_clock = true;
981 const bool system_value_found = cros_settings->GetBoolean(
982 kSystemUse24HourClock, &system_use_24_hour_clock);
983
984 if (status == ash::user::LOGGED_IN_NONE)
985 return (system_value_found ? system_use_24_hour_clock : true);
986
987 const PrefService::Preference* user_pref =
988 user_pref_registrar_->prefs()->FindPreference(prefs::kUse24HourClock);
989 if (status == ash::user::LOGGED_IN_GUEST && user_pref->IsDefaultValue())
990 return (system_value_found ? system_use_24_hour_clock : true);
991
992 bool use_24_hour_clock = true;
993 user_pref->GetValue()->GetAsBoolean(&use_24_hour_clock);
994 return use_24_hour_clock;
995 }
996
973 void UpdateClockType() { 997 void UpdateClockType() {
974 if (!user_pref_registrar_) 998 if (!user_pref_registrar_)
975 return; 999 return;
976 clock_type_ = 1000
977 user_pref_registrar_->prefs()->GetBoolean(prefs::kUse24HourClock) ? 1001 const bool use_24_hour_clock = ShouldUse24HourClock();
978 base::k24HourClock : base::k12HourClock; 1002 clock_type_ = use_24_hour_clock ? base::k24HourClock : base::k12HourClock;
979 GetSystemTrayNotifier()->NotifyDateFormatChanged(); 1003 GetSystemTrayNotifier()->NotifyDateFormatChanged();
1004 // This also works for enterprise-managed devices because they never have
1005 // local owner.
1006 if (chromeos::UserManager::Get()->IsCurrentUserOwner())
1007 CrosSettings::Get()->SetBoolean(kSystemUse24HourClock, use_24_hour_clock);
980 } 1008 }
981 1009
982 void UpdateShowLogoutButtonInTray() { 1010 void UpdateShowLogoutButtonInTray() {
983 GetSystemTrayNotifier()->NotifyShowLoginButtonChanged( 1011 GetSystemTrayNotifier()->NotifyShowLoginButtonChanged(
984 user_pref_registrar_->prefs()->GetBoolean( 1012 user_pref_registrar_->prefs()->GetBoolean(
985 prefs::kShowLogoutButtonInTray)); 1013 prefs::kShowLogoutButtonInTray));
986 } 1014 }
987 1015
988 void UpdateSessionStartTime() { 1016 void UpdateSessionStartTime() {
989 const PrefService* local_state = local_state_registrar_->prefs(); 1017 const PrefService* local_state = local_state_registrar_->prefs();
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
1340 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); 1368 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate);
1341 }; 1369 };
1342 1370
1343 } // namespace 1371 } // namespace
1344 1372
1345 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { 1373 ash::SystemTrayDelegate* CreateSystemTrayDelegate() {
1346 return new chromeos::SystemTrayDelegate(); 1374 return new chromeos::SystemTrayDelegate();
1347 } 1375 }
1348 1376
1349 } // namespace chromeos 1377 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698