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

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

Issue 686863002: Revert "Revert of Revert of Revert of ChromeOS NetworkScreenHandler should not call CheckAndResolve… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 LoginDisplayHost* login_host, 211 LoginDisplayHost* login_host,
212 bool locale_pref_checked); 212 bool locale_pref_checked);
213 213
214 // Switch to the locale that |profile| wishes to use and invoke |callback|. 214 // Switch to the locale that |profile| wishes to use and invoke |callback|.
215 virtual void RespectLocalePreference(Profile* profile, 215 virtual void RespectLocalePreference(Profile* profile,
216 const base::Closure& callback); 216 const base::Closure& callback);
217 217
218 static void RunCallbackOnLocaleLoaded( 218 static void RunCallbackOnLocaleLoaded(
219 const base::Closure& callback, 219 const base::Closure& callback,
220 InputEventsBlocker* input_events_blocker, 220 InputEventsBlocker* input_events_blocker,
221 const std::string& locale, 221 const locale_util::LanguageSwitchResult& result);
222 const std::string& loaded_locale,
223 const bool success);
224 222
225 // Attempts restarting the browser process and esures that this does 223 // Attempts restarting the browser process and esures that this does
226 // not happen while we are still fetching new OAuth refresh tokens. 224 // not happen while we are still fetching new OAuth refresh tokens.
227 void AttemptRestart(Profile* profile); 225 void AttemptRestart(Profile* profile);
228 226
229 // Has to be scoped_refptr, see comment for CreateAuthenticator(...). 227 // Has to be scoped_refptr, see comment for CreateAuthenticator(...).
230 scoped_refptr<Authenticator> authenticator_; 228 scoped_refptr<Authenticator> authenticator_;
231 229
232 // Delegate to be fired when the profile will be prepared. 230 // Delegate to be fired when the profile will be prepared.
233 LoginUtils::Delegate* delegate_; 231 LoginUtils::Delegate* delegate_;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 login_host->Finalize(); 321 login_host->Finalize();
324 user_manager::UserManager::Get()->SessionStarted(); 322 user_manager::UserManager::Get()->SessionStarted();
325 chromeos::BootTimesLoader::Get()->LoginDone( 323 chromeos::BootTimesLoader::Get()->LoginDone(
326 user_manager::UserManager::Get()->IsCurrentUserNew()); 324 user_manager::UserManager::Get()->IsCurrentUserNew());
327 } 325 }
328 326
329 // static 327 // static
330 void LoginUtilsImpl::RunCallbackOnLocaleLoaded( 328 void LoginUtilsImpl::RunCallbackOnLocaleLoaded(
331 const base::Closure& callback, 329 const base::Closure& callback,
332 InputEventsBlocker* /* input_events_blocker */, 330 InputEventsBlocker* /* input_events_blocker */,
333 const std::string& /* locale */, 331 const locale_util::LanguageSwitchResult& /* result */) {
334 const std::string& /* loaded_locale */,
335 const bool /* success */) {
336 callback.Run(); 332 callback.Run();
337 } 333 }
338 334
339 void LoginUtilsImpl::RespectLocalePreference(Profile* profile, 335 void LoginUtilsImpl::RespectLocalePreference(Profile* profile,
340 const base::Closure& callback) { 336 const base::Closure& callback) {
341 if (browser_shutdown::IsTryingToQuit()) 337 if (browser_shutdown::IsTryingToQuit())
342 return; 338 return;
343 339
344 user_manager::User* const user = 340 user_manager::User* const user =
345 ProfileHelper::Get()->GetUserByProfile(profile); 341 ProfileHelper::Get()->GetUserByProfile(profile);
346 scoped_ptr<locale_util::SwitchLanguageCallback> locale_switched_callback( 342 locale_util::SwitchLanguageCallback locale_switched_callback(base::Bind(
347 new locale_util::SwitchLanguageCallback(base::Bind( 343 &LoginUtilsImpl::RunCallbackOnLocaleLoaded,
348 &LoginUtilsImpl::RunCallbackOnLocaleLoaded, 344 callback,
349 callback, 345 base::Owned(new InputEventsBlocker))); // Block UI events until
350 base::Owned(new InputEventsBlocker)))); // Block UI events until 346 // the ResourceBundle is
351 // the ResourceBundle is 347 // reloaded.
352 // reloaded.
353 if (!UserSessionManager::GetInstance()->RespectLocalePreference( 348 if (!UserSessionManager::GetInstance()->RespectLocalePreference(
354 profile, 349 profile, user, locale_switched_callback)) {
355 user,
356 locale_switched_callback.Pass())) {
357 callback.Run(); 350 callback.Run();
358 } 351 }
359 } 352 }
360 353
361 void LoginUtilsImpl::DoBrowserLaunch(Profile* profile, 354 void LoginUtilsImpl::DoBrowserLaunch(Profile* profile,
362 LoginDisplayHost* login_host) { 355 LoginDisplayHost* login_host) {
363 DoBrowserLaunchInternal(profile, login_host, false /* locale_pref_checked */); 356 DoBrowserLaunchInternal(profile, login_host, false /* locale_pref_checked */);
364 } 357 }
365 358
366 void LoginUtilsImpl::PrepareProfile( 359 void LoginUtilsImpl::PrepareProfile(
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 CrosSettings* cros_settings = CrosSettings::Get(); 498 CrosSettings* cros_settings = CrosSettings::Get();
506 bool allow_new_user = false; 499 bool allow_new_user = false;
507 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); 500 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user);
508 if (allow_new_user) 501 if (allow_new_user)
509 return true; 502 return true;
510 return cros_settings->FindEmailInList( 503 return cros_settings->FindEmailInList(
511 kAccountsPrefUsers, username, wildcard_match); 504 kAccountsPrefUsers, username, wildcard_match);
512 } 505 }
513 506
514 } // namespace chromeos 507 } // 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