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

Side by Side Diff: chrome/browser/chromeos/login/login_utils.cc

Issue 658903004: Revert of Revert of ChromeOS NetworkScreenHandler should not call CheckAndResolveLocale on UI thread. (patchs… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/login_utils.h" 5 #include "chrome/browser/chromeos/login/login_utils.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 LoginDisplayHost* login_host, 205 LoginDisplayHost* login_host,
206 bool locale_pref_checked); 206 bool locale_pref_checked);
207 207
208 // Switch to the locale that |profile| wishes to use and invoke |callback|. 208 // Switch to the locale that |profile| wishes to use and invoke |callback|.
209 virtual void RespectLocalePreference(Profile* profile, 209 virtual void RespectLocalePreference(Profile* profile,
210 const base::Closure& callback); 210 const base::Closure& callback);
211 211
212 static void RunCallbackOnLocaleLoaded( 212 static void RunCallbackOnLocaleLoaded(
213 const base::Closure& callback, 213 const base::Closure& callback,
214 InputEventsBlocker* input_events_blocker, 214 InputEventsBlocker* input_events_blocker,
215 const std::string& locale, 215 const locale_util::LanguageSwitchResult& result);
216 const std::string& loaded_locale,
217 const bool success);
218 216
219 // Attempts restarting the browser process and esures that this does 217 // Attempts restarting the browser process and esures that this does
220 // not happen while we are still fetching new OAuth refresh tokens. 218 // not happen while we are still fetching new OAuth refresh tokens.
221 void AttemptRestart(Profile* profile); 219 void AttemptRestart(Profile* profile);
222 220
223 // Has to be scoped_refptr, see comment for CreateAuthenticator(...). 221 // Has to be scoped_refptr, see comment for CreateAuthenticator(...).
224 scoped_refptr<Authenticator> authenticator_; 222 scoped_refptr<Authenticator> authenticator_;
225 223
226 // Delegate to be fired when the profile will be prepared. 224 // Delegate to be fired when the profile will be prepared.
227 LoginUtils::Delegate* delegate_; 225 LoginUtils::Delegate* delegate_;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 login_host->Finalize(); 315 login_host->Finalize();
318 user_manager::UserManager::Get()->SessionStarted(); 316 user_manager::UserManager::Get()->SessionStarted();
319 chromeos::BootTimesLoader::Get()->LoginDone( 317 chromeos::BootTimesLoader::Get()->LoginDone(
320 user_manager::UserManager::Get()->IsCurrentUserNew()); 318 user_manager::UserManager::Get()->IsCurrentUserNew());
321 } 319 }
322 320
323 // static 321 // static
324 void LoginUtilsImpl::RunCallbackOnLocaleLoaded( 322 void LoginUtilsImpl::RunCallbackOnLocaleLoaded(
325 const base::Closure& callback, 323 const base::Closure& callback,
326 InputEventsBlocker* /* input_events_blocker */, 324 InputEventsBlocker* /* input_events_blocker */,
327 const std::string& /* locale */, 325 const locale_util::LanguageSwitchResult& /* result */) {
328 const std::string& /* loaded_locale */,
329 const bool /* success */) {
330 callback.Run(); 326 callback.Run();
331 } 327 }
332 328
333 void LoginUtilsImpl::RespectLocalePreference(Profile* profile, 329 void LoginUtilsImpl::RespectLocalePreference(Profile* profile,
334 const base::Closure& callback) { 330 const base::Closure& callback) {
335 if (browser_shutdown::IsTryingToQuit()) 331 if (browser_shutdown::IsTryingToQuit())
336 return; 332 return;
337 333
338 user_manager::User* const user = 334 user_manager::User* const user =
339 ProfileHelper::Get()->GetUserByProfile(profile); 335 ProfileHelper::Get()->GetUserByProfile(profile);
340 scoped_ptr<locale_util::SwitchLanguageCallback> locale_switched_callback( 336 locale_util::SwitchLanguageCallback locale_switched_callback(base::Bind(
341 new locale_util::SwitchLanguageCallback(base::Bind( 337 &LoginUtilsImpl::RunCallbackOnLocaleLoaded,
342 &LoginUtilsImpl::RunCallbackOnLocaleLoaded, 338 callback,
343 callback, 339 base::Owned(new InputEventsBlocker))); // Block UI events until
344 base::Owned(new InputEventsBlocker)))); // Block UI events until 340 // the ResourceBundle is
345 // the ResourceBundle is 341 // reloaded.
346 // reloaded.
347 if (!UserSessionManager::GetInstance()->RespectLocalePreference( 342 if (!UserSessionManager::GetInstance()->RespectLocalePreference(
348 profile, 343 profile, user, locale_switched_callback)) {
349 user,
350 locale_switched_callback.Pass())) {
351 callback.Run(); 344 callback.Run();
352 } 345 }
353 } 346 }
354 347
355 void LoginUtilsImpl::DoBrowserLaunch(Profile* profile, 348 void LoginUtilsImpl::DoBrowserLaunch(Profile* profile,
356 LoginDisplayHost* login_host) { 349 LoginDisplayHost* login_host) {
357 DoBrowserLaunchInternal(profile, login_host, false /* locale_pref_checked */); 350 DoBrowserLaunchInternal(profile, login_host, false /* locale_pref_checked */);
358 } 351 }
359 352
360 void LoginUtilsImpl::PrepareProfile( 353 void LoginUtilsImpl::PrepareProfile(
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 CrosSettings* cros_settings = CrosSettings::Get(); 482 CrosSettings* cros_settings = CrosSettings::Get();
490 bool allow_new_user = false; 483 bool allow_new_user = false;
491 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); 484 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user);
492 if (allow_new_user) 485 if (allow_new_user)
493 return true; 486 return true;
494 return cros_settings->FindEmailInList( 487 return cros_settings->FindEmailInList(
495 kAccountsPrefUsers, username, wildcard_match); 488 kAccountsPrefUsers, username, wildcard_match);
496 } 489 }
497 490
498 } // namespace chromeos 491 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/chrome_browser_main_chromeos.cc ('k') | chrome/browser/chromeos/login/session/user_session_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698