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

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: Rearrange device settings list. Created 5 years, 9 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 user_manager::User* user =
1018 user_manager::UserManager::Get()->GetActiveUser();
1019 Profile* profile = ProfileHelper::Get()->GetProfileByUser(user);
Mattias Nissler (ping if slow) 2015/03/27 12:42:06 Might be simpler to use ProfileManager::GetActiveU
Ivan Podogov 2015/03/27 12:51:14 Hm... Yes, it would probably be better. Maybe I sh
1020 OwnerSettingsServiceChromeOS* service =
1021 OwnerSettingsServiceChromeOSFactory::GetForBrowserContext(profile);
1022 service->SetBoolean(kSystemUse24HourClock, use_24_hour_clock);
1023 }
1016 } 1024 }
1017 1025
1018 void SystemTrayDelegateChromeOS::UpdateShowLogoutButtonInTray() { 1026 void SystemTrayDelegateChromeOS::UpdateShowLogoutButtonInTray() {
1019 GetSystemTrayNotifier()->NotifyShowLoginButtonChanged( 1027 GetSystemTrayNotifier()->NotifyShowLoginButtonChanged(
1020 user_pref_registrar_->prefs()->GetBoolean( 1028 user_pref_registrar_->prefs()->GetBoolean(
1021 prefs::kShowLogoutButtonInTray)); 1029 prefs::kShowLogoutButtonInTray));
1022 } 1030 }
1023 1031
1024 void SystemTrayDelegateChromeOS::UpdateLogoutDialogDuration() { 1032 void SystemTrayDelegateChromeOS::UpdateLogoutDialogDuration() {
1025 const int duration_ms = 1033 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 1114 // 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 1115 // is recognized as the owner. Make sure that the system-wide clock setting
1108 // is updated when the recognition eventually happens 1116 // is updated when the recognition eventually happens
1109 // (http://crbug.com/278601). 1117 // (http://crbug.com/278601).
1110 // 1118 //
1111 // Note that it isn't safe to blindly call UpdateClockType() from this 1119 // Note that it isn't safe to blindly call UpdateClockType() from this
1112 // method, as LoggedInStateChanged() is also called before the logged-in 1120 // method, as LoggedInStateChanged() is also called before the logged-in
1113 // user's profile has actually been loaded (http://crbug.com/317745). The 1121 // user's profile has actually been loaded (http://crbug.com/317745). The
1114 // system tray's time format is updated at login via SetProfile(). 1122 // system tray's time format is updated at login via SetProfile().
1115 if (user_manager::UserManager::Get()->IsCurrentUserOwner()) { 1123 if (user_manager::UserManager::Get()->IsCurrentUserOwner()) {
1116 CrosSettings::Get()->SetBoolean(kSystemUse24HourClock, 1124 user_manager::User* user =
1117 ShouldUse24HourClock()); 1125 user_manager::UserManager::Get()->GetActiveUser();
1126 Profile* profile = ProfileHelper::Get()->GetProfileByUser(user);
Mattias Nissler (ping if slow) 2015/03/27 12:42:06 ditto
1127 OwnerSettingsServiceChromeOS* service =
1128 OwnerSettingsServiceChromeOSFactory::GetForBrowserContext(profile);
1129 service->SetBoolean(kSystemUse24HourClock, ShouldUse24HourClock());
1118 } 1130 }
1119 } 1131 }
1120 1132
1121 // Overridden from SessionManagerClient::Observer. 1133 // Overridden from SessionManagerClient::Observer.
1122 void SystemTrayDelegateChromeOS::ScreenIsLocked() { 1134 void SystemTrayDelegateChromeOS::ScreenIsLocked() {
1123 screen_locked_ = true; 1135 screen_locked_ = true;
1124 ash::Shell::GetInstance()->UpdateAfterLoginStatusChange(GetUserLoginStatus()); 1136 ash::Shell::GetInstance()->UpdateAfterLoginStatusChange(GetUserLoginStatus());
1125 } 1137 }
1126 1138
1127 void SystemTrayDelegateChromeOS::ScreenIsUnlocked() { 1139 void SystemTrayDelegateChromeOS::ScreenIsUnlocked() {
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
1392 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " 1404 LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while "
1393 << "ENABLE_SUPERVISED_USERS undefined."; 1405 << "ENABLE_SUPERVISED_USERS undefined.";
1394 return base::string16(); 1406 return base::string16();
1395 } 1407 }
1396 1408
1397 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { 1409 ash::SystemTrayDelegate* CreateSystemTrayDelegate() {
1398 return new SystemTrayDelegateChromeOS(); 1410 return new SystemTrayDelegateChromeOS();
1399 } 1411 }
1400 1412
1401 } // namespace chromeos 1413 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698