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

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: Try remove g_browser_process check Created 3 years, 7 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 timezone =
195 g_browser_process->local_state()->GetString(prefs::kSigninScreenTimezone);
196
192 if (ShouldShowSigninScreen(first_screen)) { 197 if (ShouldShowSigninScreen(first_screen)) {
193 display_host->StartSignInScreen(chromeos::LoginScreenContext()); 198 display_host->StartSignInScreen(chromeos::LoginScreenContext());
194 } else { 199 } else {
195 display_host->StartWizard(first_screen); 200 display_host->StartWizard(first_screen);
196
197 // Set initial timezone if specified by customization. 201 // Set initial timezone if specified by customization.
198 const std::string timezone_name = startup_manifest->initial_timezone(); 202 const std::string customization_timezone =
199 VLOG(1) << "Initial time zone: " << timezone_name; 203 startup_manifest->initial_timezone();
200 // Apply locale customizations only once to preserve whatever locale 204 // Apply locale customizations only once to preserve whatever locale
201 // user has changed to during OOBE. 205 // user has changed to during OOBE.
202 if (!timezone_name.empty()) { 206 if (!customization_timezone.empty())
203 chromeos::system::TimezoneSettings::GetInstance()->SetTimezoneFromID( 207 timezone = customization_timezone;
204 base::UTF8ToUTF16(timezone_name)); 208 }
205 } 209 if (!timezone.empty()) {
210 chromeos::system::SetSigninScreenTimezone(timezone,
211 true /* set_system_timezone */);
206 } 212 }
207 } 213 }
208 214
209 struct ShowLoginWizardSwitchLanguageCallbackData { 215 struct ShowLoginWizardSwitchLanguageCallbackData {
210 explicit ShowLoginWizardSwitchLanguageCallbackData( 216 explicit ShowLoginWizardSwitchLanguageCallbackData(
211 chromeos::OobeScreen first_screen, 217 chromeos::OobeScreen first_screen,
212 const chromeos::StartupCustomizationDocument* startup_manifest, 218 const chromeos::StartupCustomizationDocument* startup_manifest,
213 chromeos::LoginDisplayHost* display_host) 219 chromeos::LoginDisplayHost* display_host)
214 : first_screen(first_screen), 220 : first_screen(first_screen),
215 startup_manifest(startup_manifest), 221 startup_manifest(startup_manifest),
(...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after
1389 // Chrome locale. Otherwise it will be lost if Chrome restarts. 1395 // Chrome locale. Otherwise it will be lost if Chrome restarts.
1390 // Don't need to schedule pref save because setting initial local 1396 // Don't need to schedule pref save because setting initial local
1391 // will enforce preference saving. 1397 // will enforce preference saving.
1392 prefs->SetString(prefs::kApplicationLocale, locale); 1398 prefs->SetString(prefs::kApplicationLocale, locale);
1393 StartupUtils::SetInitialLocale(locale); 1399 StartupUtils::SetInitialLocale(locale);
1394 1400
1395 TriggerShowLoginWizardFinish(locale, std::move(data)); 1401 TriggerShowLoginWizardFinish(locale, std::move(data));
1396 } 1402 }
1397 1403
1398 } // namespace chromeos 1404 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698