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

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

Issue 664503003: Revert of 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 locale_util::LanguageSwitchResult& result); 215 const std::string& locale,
216 const std::string& loaded_locale,
217 const bool success);
216 218
217 // Attempts restarting the browser process and esures that this does 219 // Attempts restarting the browser process and esures that this does
218 // not happen while we are still fetching new OAuth refresh tokens. 220 // not happen while we are still fetching new OAuth refresh tokens.
219 void AttemptRestart(Profile* profile); 221 void AttemptRestart(Profile* profile);
220 222
221 // Has to be scoped_refptr, see comment for CreateAuthenticator(...). 223 // Has to be scoped_refptr, see comment for CreateAuthenticator(...).
222 scoped_refptr<Authenticator> authenticator_; 224 scoped_refptr<Authenticator> authenticator_;
223 225
224 // Delegate to be fired when the profile will be prepared. 226 // Delegate to be fired when the profile will be prepared.
225 LoginUtils::Delegate* delegate_; 227 LoginUtils::Delegate* delegate_;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 login_host->Finalize(); 317 login_host->Finalize();
316 user_manager::UserManager::Get()->SessionStarted(); 318 user_manager::UserManager::Get()->SessionStarted();
317 chromeos::BootTimesLoader::Get()->LoginDone( 319 chromeos::BootTimesLoader::Get()->LoginDone(
318 user_manager::UserManager::Get()->IsCurrentUserNew()); 320 user_manager::UserManager::Get()->IsCurrentUserNew());
319 } 321 }
320 322
321 // static 323 // static
322 void LoginUtilsImpl::RunCallbackOnLocaleLoaded( 324 void LoginUtilsImpl::RunCallbackOnLocaleLoaded(
323 const base::Closure& callback, 325 const base::Closure& callback,
324 InputEventsBlocker* /* input_events_blocker */, 326 InputEventsBlocker* /* input_events_blocker */,
325 const locale_util::LanguageSwitchResult& /* result */) { 327 const std::string& /* locale */,
328 const std::string& /* loaded_locale */,
329 const bool /* success */) {
326 callback.Run(); 330 callback.Run();
327 } 331 }
328 332
329 void LoginUtilsImpl::RespectLocalePreference(Profile* profile, 333 void LoginUtilsImpl::RespectLocalePreference(Profile* profile,
330 const base::Closure& callback) { 334 const base::Closure& callback) {
331 if (browser_shutdown::IsTryingToQuit()) 335 if (browser_shutdown::IsTryingToQuit())
332 return; 336 return;
333 337
334 user_manager::User* const user = 338 user_manager::User* const user =
335 ProfileHelper::Get()->GetUserByProfile(profile); 339 ProfileHelper::Get()->GetUserByProfile(profile);
336 locale_util::SwitchLanguageCallback locale_switched_callback(base::Bind( 340 scoped_ptr<locale_util::SwitchLanguageCallback> locale_switched_callback(
337 &LoginUtilsImpl::RunCallbackOnLocaleLoaded, 341 new locale_util::SwitchLanguageCallback(base::Bind(
338 callback, 342 &LoginUtilsImpl::RunCallbackOnLocaleLoaded,
339 base::Owned(new InputEventsBlocker))); // Block UI events until 343 callback,
340 // the ResourceBundle is 344 base::Owned(new InputEventsBlocker)))); // Block UI events until
341 // reloaded. 345 // the ResourceBundle is
346 // reloaded.
342 if (!UserSessionManager::GetInstance()->RespectLocalePreference( 347 if (!UserSessionManager::GetInstance()->RespectLocalePreference(
343 profile, user, locale_switched_callback)) { 348 profile,
349 user,
350 locale_switched_callback.Pass())) {
344 callback.Run(); 351 callback.Run();
345 } 352 }
346 } 353 }
347 354
348 void LoginUtilsImpl::DoBrowserLaunch(Profile* profile, 355 void LoginUtilsImpl::DoBrowserLaunch(Profile* profile,
349 LoginDisplayHost* login_host) { 356 LoginDisplayHost* login_host) {
350 DoBrowserLaunchInternal(profile, login_host, false /* locale_pref_checked */); 357 DoBrowserLaunchInternal(profile, login_host, false /* locale_pref_checked */);
351 } 358 }
352 359
353 void LoginUtilsImpl::PrepareProfile( 360 void LoginUtilsImpl::PrepareProfile(
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 CrosSettings* cros_settings = CrosSettings::Get(); 489 CrosSettings* cros_settings = CrosSettings::Get();
483 bool allow_new_user = false; 490 bool allow_new_user = false;
484 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); 491 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user);
485 if (allow_new_user) 492 if (allow_new_user)
486 return true; 493 return true;
487 return cros_settings->FindEmailInList( 494 return cros_settings->FindEmailInList(
488 kAccountsPrefUsers, username, wildcard_match); 495 kAccountsPrefUsers, username, wildcard_match);
489 } 496 }
490 497
491 } // namespace chromeos 498 } // 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