OLD | NEW |
---|---|
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/public/cpp/shell_window_ids.h" | 10 #include "ash/public/cpp/shell_window_ids.h" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
182 // ShowLoginWizard is split into two parts. This function is sometimes called | 182 // ShowLoginWizard is split into two parts. This function is sometimes called |
183 // from TriggerShowLoginWizardFinish() directly, and sometimes from | 183 // from TriggerShowLoginWizardFinish() directly, and sometimes from |
184 // OnLanguageSwitchedCallback() | 184 // OnLanguageSwitchedCallback() |
185 // (if locale was updated). | 185 // (if locale was updated). |
186 void ShowLoginWizardFinish( | 186 void ShowLoginWizardFinish( |
187 chromeos::OobeScreen first_screen, | 187 chromeos::OobeScreen first_screen, |
188 const chromeos::StartupCustomizationDocument* startup_manifest, | 188 const chromeos::StartupCustomizationDocument* startup_manifest, |
189 chromeos::LoginDisplayHost* display_host) { | 189 chromeos::LoginDisplayHost* display_host) { |
190 TRACE_EVENT0("chromeos", "ShowLoginWizard::ShowLoginWizardFinish"); | 190 TRACE_EVENT0("chromeos", "ShowLoginWizard::ShowLoginWizardFinish"); |
191 | 191 |
192 // Restore system timezone. | |
193 std::string timezone; | |
194 if (g_browser_process && g_browser_process->local_state()) { | |
michaelpg
2017/05/15 23:01:50
this might be a silly question, but when does OOBE
Alexander Alekseev
2017/05/16 01:11:56
In unit_tests, I suppose. We have similar check in
| |
195 timezone = g_browser_process->local_state()->GetString( | |
196 prefs::kSigninScreenTimezone); | |
197 } | |
198 | |
192 if (ShouldShowSigninScreen(first_screen)) { | 199 if (ShouldShowSigninScreen(first_screen)) { |
193 display_host->StartSignInScreen(chromeos::LoginScreenContext()); | 200 display_host->StartSignInScreen(chromeos::LoginScreenContext()); |
194 } else { | 201 } else { |
195 display_host->StartWizard(first_screen); | 202 display_host->StartWizard(first_screen); |
196 | |
197 // Set initial timezone if specified by customization. | 203 // Set initial timezone if specified by customization. |
198 const std::string timezone_name = startup_manifest->initial_timezone(); | 204 const std::string customization_timezone = |
199 VLOG(1) << "Initial time zone: " << timezone_name; | 205 startup_manifest->initial_timezone(); |
200 // Apply locale customizations only once to preserve whatever locale | 206 // Apply locale customizations only once to preserve whatever locale |
201 // user has changed to during OOBE. | 207 // user has changed to during OOBE. |
202 if (!timezone_name.empty()) { | 208 if (!customization_timezone.empty()) |
203 chromeos::system::TimezoneSettings::GetInstance()->SetTimezoneFromID( | 209 timezone = customization_timezone; |
204 base::UTF8ToUTF16(timezone_name)); | |
205 } | |
206 } | 210 } |
211 g_browser_process->local_state()->SetString(prefs::kSigninScreenTimezone, | |
212 timezone); | |
stevenjb
2017/05/15 17:08:02
This should only be necessary inside the else, and
michaelpg
2017/05/15 23:01:50
Seems that way, and then we wouldn't need to read
Alexander Alekseev
2017/05/16 01:11:56
Done.
Alexander Alekseev
2017/05/16 01:11:56
We still need to set system timezone value here.
| |
213 chromeos::CrosSettings::Get()->SetString(chromeos::kSystemTimezone, timezone); | |
stevenjb
2017/05/15 17:08:02
What if timezone is empty, should we still be sett
Alexander Alekseev
2017/05/16 01:11:56
You are right, we should probably use system::Time
| |
207 } | 214 } |
208 | 215 |
209 struct ShowLoginWizardSwitchLanguageCallbackData { | 216 struct ShowLoginWizardSwitchLanguageCallbackData { |
210 explicit ShowLoginWizardSwitchLanguageCallbackData( | 217 explicit ShowLoginWizardSwitchLanguageCallbackData( |
211 chromeos::OobeScreen first_screen, | 218 chromeos::OobeScreen first_screen, |
212 const chromeos::StartupCustomizationDocument* startup_manifest, | 219 const chromeos::StartupCustomizationDocument* startup_manifest, |
213 chromeos::LoginDisplayHost* display_host) | 220 chromeos::LoginDisplayHost* display_host) |
214 : first_screen(first_screen), | 221 : first_screen(first_screen), |
215 startup_manifest(startup_manifest), | 222 startup_manifest(startup_manifest), |
216 display_host(display_host) {} | 223 display_host(display_host) {} |
(...skipping 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1389 // Chrome locale. Otherwise it will be lost if Chrome restarts. | 1396 // Chrome locale. Otherwise it will be lost if Chrome restarts. |
1390 // Don't need to schedule pref save because setting initial local | 1397 // Don't need to schedule pref save because setting initial local |
1391 // will enforce preference saving. | 1398 // will enforce preference saving. |
1392 prefs->SetString(prefs::kApplicationLocale, locale); | 1399 prefs->SetString(prefs::kApplicationLocale, locale); |
1393 StartupUtils::SetInitialLocale(locale); | 1400 StartupUtils::SetInitialLocale(locale); |
1394 | 1401 |
1395 TriggerShowLoginWizardFinish(locale, std::move(data)); | 1402 TriggerShowLoginWizardFinish(locale, std::move(data)); |
1396 } | 1403 } |
1397 | 1404 |
1398 } // namespace chromeos | 1405 } // namespace chromeos |
OLD | NEW |