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

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

Issue 2849823003: ChromeOS: implement per-user time zone preferences. (Closed)
Patch Set: Update after review. Created 3 years, 5 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/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
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 (chromeos::system::PerUserTimezoneEnabled()) {
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 203
197 // Set initial timezone if specified by customization. 204 // Set initial timezone if specified by customization.
198 const std::string timezone_name = startup_manifest->initial_timezone(); 205 const std::string customization_timezone =
199 VLOG(1) << "Initial time zone: " << timezone_name; 206 startup_manifest->initial_timezone();
207 VLOG(1) << "Initial time zone: " << customization_timezone;
200 // Apply locale customizations only once to preserve whatever locale 208 // Apply locale customizations only once to preserve whatever locale
201 // user has changed to during OOBE. 209 // user has changed to during OOBE.
202 if (!timezone_name.empty()) { 210 if (!customization_timezone.empty())
203 chromeos::system::TimezoneSettings::GetInstance()->SetTimezoneFromID( 211 timezone = customization_timezone;
204 base::UTF8ToUTF16(timezone_name)); 212 }
205 } 213 if (!timezone.empty()) {
214 chromeos::system::SetSystemAndSigninScreenTimezone(timezone);
206 } 215 }
207 } 216 }
208 217
209 struct ShowLoginWizardSwitchLanguageCallbackData { 218 struct ShowLoginWizardSwitchLanguageCallbackData {
210 explicit ShowLoginWizardSwitchLanguageCallbackData( 219 explicit ShowLoginWizardSwitchLanguageCallbackData(
211 chromeos::OobeScreen first_screen, 220 chromeos::OobeScreen first_screen,
212 const chromeos::StartupCustomizationDocument* startup_manifest, 221 const chromeos::StartupCustomizationDocument* startup_manifest,
213 chromeos::LoginDisplayHost* display_host) 222 chromeos::LoginDisplayHost* display_host)
214 : first_screen(first_screen), 223 : first_screen(first_screen),
215 startup_manifest(startup_manifest), 224 startup_manifest(startup_manifest),
(...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1406 // Chrome locale. Otherwise it will be lost if Chrome restarts. 1415 // Chrome locale. Otherwise it will be lost if Chrome restarts.
1407 // Don't need to schedule pref save because setting initial local 1416 // Don't need to schedule pref save because setting initial local
1408 // will enforce preference saving. 1417 // will enforce preference saving.
1409 prefs->SetString(prefs::kApplicationLocale, locale); 1418 prefs->SetString(prefs::kApplicationLocale, locale);
1410 StartupUtils::SetInitialLocale(locale); 1419 StartupUtils::SetInitialLocale(locale);
1411 1420
1412 TriggerShowLoginWizardFinish(locale, std::move(data)); 1421 TriggerShowLoginWizardFinish(locale, std::move(data));
1413 } 1422 }
1414 1423
1415 } // namespace chromeos 1424 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698