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

Side by Side Diff: chrome/browser/chromeos/login/ui/login_display_host_impl.cc

Issue 1837893003: ChromeOS: Refactor TimeZoneResolver, add TimeZoneResolverManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update after review. Created 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/login/ui/login_display_host_impl.h" 5 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/audio/sounds.h" 10 #include "ash/audio/sounds.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" 45 #include "chrome/browser/chromeos/login/ui/webui_login_display.h"
46 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" 46 #include "chrome/browser/chromeos/login/ui/webui_login_view.h"
47 #include "chrome/browser/chromeos/login/wizard_controller.h" 47 #include "chrome/browser/chromeos/login/wizard_controller.h"
48 #include "chrome/browser/chromeos/mobile_config.h" 48 #include "chrome/browser/chromeos/mobile_config.h"
49 #include "chrome/browser/chromeos/net/delay_network_call.h" 49 #include "chrome/browser/chromeos/net/delay_network_call.h"
50 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" 50 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
51 #include "chrome/browser/chromeos/policy/enrollment_config.h" 51 #include "chrome/browser/chromeos/policy/enrollment_config.h"
52 #include "chrome/browser/chromeos/settings/cros_settings.h" 52 #include "chrome/browser/chromeos/settings/cros_settings.h"
53 #include "chrome/browser/chromeos/system/device_disabling_manager.h" 53 #include "chrome/browser/chromeos/system/device_disabling_manager.h"
54 #include "chrome/browser/chromeos/system/input_device_settings.h" 54 #include "chrome/browser/chromeos/system/input_device_settings.h"
55 #include "chrome/browser/chromeos/system/timezone_resolver_manager.h"
55 #include "chrome/browser/chromeos/system/timezone_util.h" 56 #include "chrome/browser/chromeos/system/timezone_util.h"
56 #include "chrome/browser/chromeos/ui/focus_ring_controller.h" 57 #include "chrome/browser/chromeos/ui/focus_ring_controller.h"
57 #include "chrome/browser/lifetime/keep_alive_types.h" 58 #include "chrome/browser/lifetime/keep_alive_types.h"
58 #include "chrome/browser/lifetime/scoped_keep_alive.h" 59 #include "chrome/browser/lifetime/scoped_keep_alive.h"
59 #include "chrome/browser/profiles/profile_manager.h" 60 #include "chrome/browser/profiles/profile_manager.h"
60 #include "chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h" 61 #include "chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h"
61 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" 62 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
62 #include "chrome/common/chrome_constants.h" 63 #include "chrome/common/chrome_constants.h"
63 #include "chrome/common/chrome_switches.h" 64 #include "chrome/common/chrome_switches.h"
64 #include "chrome/common/pref_names.h" 65 #include "chrome/common/pref_names.h"
(...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after
1122 media::SoundsManager::Get()->GetDuration(SOUND_STARTUP)); 1123 media::SoundsManager::Get()->GetDuration(SOUND_STARTUP));
1123 } 1124 }
1124 1125
1125 void LoginDisplayHostImpl::OnLoginPromptVisible() { 1126 void LoginDisplayHostImpl::OnLoginPromptVisible() {
1126 if (!login_prompt_visible_time_.is_null()) 1127 if (!login_prompt_visible_time_.is_null())
1127 return; 1128 return;
1128 login_prompt_visible_time_ = base::TimeTicks::Now(); 1129 login_prompt_visible_time_ = base::TimeTicks::Now();
1129 TryToPlayStartupSound(); 1130 TryToPlayStartupSound();
1130 } 1131 }
1131 1132
1132 void LoginDisplayHostImpl::StartTimeZoneResolve() {
1133 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
1134 chromeos::switches::kDisableTimeZoneTrackingOption)) {
1135 return;
1136 }
1137
1138 if (!g_browser_process->local_state()->GetBoolean(
1139 prefs::kResolveDeviceTimezoneByGeolocation)) {
1140 return;
1141 }
1142
1143 if (system::HasSystemTimezonePolicy())
1144 return;
1145
1146 // Do not start resolver if we are inside active user session.
1147 // If user preferences permit, it will be started on preferences
1148 // initialization.
1149 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kLoginUser))
1150 return;
1151
1152 g_browser_process->platform_part()->GetTimezoneResolver()->Start();
1153 }
1154
1155 // static 1133 // static
1156 void LoginDisplayHostImpl::DisableRestrictiveProxyCheckForTest() { 1134 void LoginDisplayHostImpl::DisableRestrictiveProxyCheckForTest() {
1157 static_cast<chromeos::LoginDisplayHostImpl*>(default_host()) 1135 static_cast<chromeos::LoginDisplayHostImpl*>(default_host())
1158 ->GetOobeUI() 1136 ->GetOobeUI()
1159 ->GetGaiaScreenActor() 1137 ->GetGaiaScreenActor()
1160 ->DisableRestrictiveProxyCheckForTest(); 1138 ->DisableRestrictiveProxyCheckForTest();
1161 } 1139 }
1162 1140
1163 //////////////////////////////////////////////////////////////////////////////// 1141 ////////////////////////////////////////////////////////////////////////////////
1164 // external 1142 // external
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1225 display_host->StartWizard(WizardController::kNetworkScreenName); 1203 display_host->StartWizard(WizardController::kNetworkScreenName);
1226 return; 1204 return;
1227 } 1205 }
1228 1206
1229 if (StartupUtils::IsEulaAccepted()) { 1207 if (StartupUtils::IsEulaAccepted()) {
1230 DelayNetworkCall( 1208 DelayNetworkCall(
1231 base::TimeDelta::FromMilliseconds(kDefaultNetworkRetryDelayMS), 1209 base::TimeDelta::FromMilliseconds(kDefaultNetworkRetryDelayMS),
1232 ServicesCustomizationDocument::GetInstance() 1210 ServicesCustomizationDocument::GetInstance()
1233 ->EnsureCustomizationAppliedClosure()); 1211 ->EnsureCustomizationAppliedClosure());
1234 1212
1235 display_host->StartTimeZoneResolve(); 1213 g_browser_process->platform_part()
1214 ->GetTimezoneResolverManager()
1215 ->UpdateTimezoneResolver();
1236 } 1216 }
1237 1217
1238 bool show_login_screen = 1218 bool show_login_screen =
1239 (first_screen_name.empty() && StartupUtils::IsOobeCompleted()) || 1219 (first_screen_name.empty() && StartupUtils::IsOobeCompleted()) ||
1240 first_screen_name == WizardController::kLoginScreenName; 1220 first_screen_name == WizardController::kLoginScreenName;
1241 1221
1242 if (show_login_screen) { 1222 if (show_login_screen) {
1243 display_host->StartSignInScreen(LoginScreenContext()); 1223 display_host->StartSignInScreen(LoginScreenContext());
1244 return; 1224 return;
1245 } 1225 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1284 1264
1285 locale_util::SwitchLanguageCallback callback( 1265 locale_util::SwitchLanguageCallback callback(
1286 base::Bind(&OnLanguageSwitchedCallback, base::Passed(std::move(data)))); 1266 base::Bind(&OnLanguageSwitchedCallback, base::Passed(std::move(data))));
1287 1267
1288 // Load locale keyboards here. Hardware layout would be automatically enabled. 1268 // Load locale keyboards here. Hardware layout would be automatically enabled.
1289 locale_util::SwitchLanguage(locale, true, true /* login_layouts_only */, 1269 locale_util::SwitchLanguage(locale, true, true /* login_layouts_only */,
1290 callback, ProfileManager::GetActiveUserProfile()); 1270 callback, ProfileManager::GetActiveUserProfile());
1291 } 1271 }
1292 1272
1293 } // namespace chromeos 1273 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698