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

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: Rebased. Created 3 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
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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 // ShowLoginWizard is split into two parts. This function is sometimes called 183 // ShowLoginWizard is split into two parts. This function is sometimes called
184 // from TriggerShowLoginWizardFinish() directly, and sometimes from 184 // from TriggerShowLoginWizardFinish() directly, and sometimes from
185 // OnLanguageSwitchedCallback() 185 // OnLanguageSwitchedCallback()
186 // (if locale was updated). 186 // (if locale was updated).
187 void ShowLoginWizardFinish( 187 void ShowLoginWizardFinish(
188 chromeos::OobeScreen first_screen, 188 chromeos::OobeScreen first_screen,
189 const chromeos::StartupCustomizationDocument* startup_manifest, 189 const chromeos::StartupCustomizationDocument* startup_manifest,
190 chromeos::LoginDisplayHost* display_host) { 190 chromeos::LoginDisplayHost* display_host) {
191 TRACE_EVENT0("chromeos", "ShowLoginWizard::ShowLoginWizardFinish"); 191 TRACE_EVENT0("chromeos", "ShowLoginWizard::ShowLoginWizardFinish");
192 192
193 // Restore system timezone.
194 std::string timezone;
195 if (chromeos::system::PerUserTimezoneEnabled()) {
196 timezone = g_browser_process->local_state()->GetString(
197 prefs::kSigninScreenTimezone);
198 }
199
193 if (ShouldShowSigninScreen(first_screen)) { 200 if (ShouldShowSigninScreen(first_screen)) {
194 display_host->StartSignInScreen(chromeos::LoginScreenContext()); 201 display_host->StartSignInScreen(chromeos::LoginScreenContext());
195 } else { 202 } else {
196 display_host->StartWizard(first_screen); 203 display_host->StartWizard(first_screen);
197 204
198 // Set initial timezone if specified by customization. 205 // Set initial timezone if specified by customization.
199 const std::string timezone_name = startup_manifest->initial_timezone(); 206 const std::string customization_timezone =
200 VLOG(1) << "Initial time zone: " << timezone_name; 207 startup_manifest->initial_timezone();
208 VLOG(1) << "Initial time zone: " << customization_timezone;
201 // Apply locale customizations only once to preserve whatever locale 209 // Apply locale customizations only once to preserve whatever locale
202 // user has changed to during OOBE. 210 // user has changed to during OOBE.
203 if (!timezone_name.empty()) { 211 if (!customization_timezone.empty())
204 chromeos::system::TimezoneSettings::GetInstance()->SetTimezoneFromID( 212 timezone = customization_timezone;
205 base::UTF8ToUTF16(timezone_name)); 213 }
206 } 214 if (!timezone.empty()) {
215 chromeos::system::SetSystemAndSigninScreenTimezone(timezone);
207 } 216 }
208 } 217 }
209 218
210 struct ShowLoginWizardSwitchLanguageCallbackData { 219 struct ShowLoginWizardSwitchLanguageCallbackData {
211 explicit ShowLoginWizardSwitchLanguageCallbackData( 220 explicit ShowLoginWizardSwitchLanguageCallbackData(
212 chromeos::OobeScreen first_screen, 221 chromeos::OobeScreen first_screen,
213 const chromeos::StartupCustomizationDocument* startup_manifest, 222 const chromeos::StartupCustomizationDocument* startup_manifest,
214 chromeos::LoginDisplayHost* display_host) 223 chromeos::LoginDisplayHost* display_host)
215 : first_screen(first_screen), 224 : first_screen(first_screen),
216 startup_manifest(startup_manifest), 225 startup_manifest(startup_manifest),
(...skipping 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after
1426 // Chrome locale. Otherwise it will be lost if Chrome restarts. 1435 // Chrome locale. Otherwise it will be lost if Chrome restarts.
1427 // Don't need to schedule pref save because setting initial local 1436 // Don't need to schedule pref save because setting initial local
1428 // will enforce preference saving. 1437 // will enforce preference saving.
1429 prefs->SetString(prefs::kApplicationLocale, locale); 1438 prefs->SetString(prefs::kApplicationLocale, locale);
1430 StartupUtils::SetInitialLocale(locale); 1439 StartupUtils::SetInitialLocale(locale);
1431 1440
1432 TriggerShowLoginWizardFinish(locale, std::move(data)); 1441 TriggerShowLoginWizardFinish(locale, std::move(data));
1433 } 1442 }
1434 1443
1435 } // namespace chromeos 1444 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698