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

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: 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
« no previous file with comments | « chrome/browser/browser_process_impl.cc ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 962 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 integration_service->job_list()->AddObserver(this); 973 integration_service->job_list()->AddObserver(this);
974 } 974 }
975 975
976 void UnobserveDriveUpdates() { 976 void UnobserveDriveUpdates() {
977 DriveIntegrationService* integration_service = 977 DriveIntegrationService* integration_service =
978 FindDriveIntegrationService(); 978 FindDriveIntegrationService();
979 if (integration_service) 979 if (integration_service)
980 integration_service->job_list()->RemoveObserver(this); 980 integration_service->job_list()->RemoveObserver(this);
981 } 981 }
982 982
983 bool ShouldUse24HourClock() const {
984 // On login screen and in guest mode owner default is used for
985 // use24HourClock preference.
986 // All other modes default to the default locale value.
987 const ash::user::LoginStatus status = GetUserLoginStatus();
988
stevenjb 2013/07/31 17:42:53 nit: Probably don't need quite so much vertical wh
Alexander Alekseev 2013/08/05 15:30:22 Done.
989 const PrefService* local_state = local_state_registrar_->prefs();
990
991 if (status == ash::user::LOGGED_IN_NONE)
992 return local_state->GetBoolean(prefs::kOwnerPrefUse24HourClock);
993
994 const PrefService::Preference* user_pref =
995 user_pref_registrar_->prefs()->FindPreference(prefs::kUse24HourClock);
996
997 if (status == ash::user::LOGGED_IN_GUEST && user_pref->IsDefaultValue())
998 return local_state->GetBoolean(prefs::kOwnerPrefUse24HourClock);
999
1000 bool use24HourClock = true;
jam 2013/07/31 21:04:25 nit: here and in line 1009, use google style guide
Alexander Alekseev 2013/08/05 15:30:22 Done.
1001 user_pref->GetValue()->GetAsBoolean(&use24HourClock);
1002 return use24HourClock;
1003 }
1004
983 void UpdateClockType() { 1005 void UpdateClockType() {
984 if (!user_pref_registrar_) 1006 if (!user_pref_registrar_)
985 return; 1007 return;
986 clock_type_ = 1008
987 user_pref_registrar_->prefs()->GetBoolean(prefs::kUse24HourClock) ? 1009 const bool use24HourClock = ShouldUse24HourClock();
988 base::k24HourClock : base::k12HourClock; 1010
1011 clock_type_ = use24HourClock ? base::k24HourClock : base::k12HourClock;
1012
989 GetSystemTrayNotifier()->NotifyDateFormatChanged(); 1013 GetSystemTrayNotifier()->NotifyDateFormatChanged();
1014
1015 if (chromeos::UserManager::Get()->IsCurrentUserOwner())
Mattias Nissler (ping if slow) 2013/08/01 08:57:58 There's one issue with this: If the device doesn't
1016 local_state_registrar_->prefs()
1017 ->SetBoolean(prefs::kOwnerPrefUse24HourClock, use24HourClock);
stevenjb 2013/07/31 17:42:53 nit: Prefer separating this line after ( instead o
jam 2013/07/31 21:04:25 nit: don't start lines with "->"
Alexander Alekseev 2013/08/05 15:30:22 Done. (Actually it was suggested by "git clang-for
990 } 1018 }
991 1019
992 void UpdateShowLogoutButtonInTray() { 1020 void UpdateShowLogoutButtonInTray() {
993 GetSystemTrayNotifier()->NotifyShowLoginButtonChanged( 1021 GetSystemTrayNotifier()->NotifyShowLoginButtonChanged(
994 user_pref_registrar_->prefs()->GetBoolean( 1022 user_pref_registrar_->prefs()->GetBoolean(
995 prefs::kShowLogoutButtonInTray)); 1023 prefs::kShowLogoutButtonInTray));
996 } 1024 }
997 1025
998 void UpdateSessionStartTime() { 1026 void UpdateSessionStartTime() {
999 const PrefService* local_state = local_state_registrar_->prefs(); 1027 const PrefService* local_state = local_state_registrar_->prefs();
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
1361 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); 1389 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate);
1362 }; 1390 };
1363 1391
1364 } // namespace 1392 } // namespace
1365 1393
1366 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { 1394 ash::SystemTrayDelegate* CreateSystemTrayDelegate() {
1367 return new chromeos::SystemTrayDelegate(); 1395 return new chromeos::SystemTrayDelegate();
1368 } 1396 }
1369 1397
1370 } // namespace chromeos 1398 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/browser_process_impl.cc ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698