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

Side by Side Diff: chrome/browser/chromeos/login/session/user_session_manager.cc

Issue 898003002: [Cleanup] Const-correct the profile() method for the EasyUnlockService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 10 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/session/user_session_manager.h" 5 #include "chrome/browser/chromeos/login/session/user_session_manager.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/base_paths.h" 9 #include "base/base_paths.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 // linux_chromeos build on dev workstations w/o user_id parameters. 438 // linux_chromeos build on dev workstations w/o user_id parameters.
439 // Stub user is considered to be a regular GAIA user but it has special 439 // Stub user is considered to be a regular GAIA user but it has special
440 // user_id (kStubUser) and certain services like restoring OAuth session are 440 // user_id (kStubUser) and certain services like restoring OAuth session are
441 // explicitly disabled for it. 441 // explicitly disabled for it.
442 if (!user_manager->IsUserLoggedIn() || 442 if (!user_manager->IsUserLoggedIn() ||
443 !user_manager->IsLoggedInAsUserWithGaiaAccount() || 443 !user_manager->IsLoggedInAsUserWithGaiaAccount() ||
444 user_manager->IsLoggedInAsStub()) { 444 user_manager->IsLoggedInAsStub()) {
445 return; 445 return;
446 } 446 }
447 447
448 user_manager::User* user = 448 const user_manager::User* user =
449 ProfileHelper::Get()->GetUserByProfile(user_profile); 449 ProfileHelper::Get()->GetUserByProfile(user_profile);
450 DCHECK(user); 450 DCHECK(user);
451 if (!net::NetworkChangeNotifier::IsOffline()) { 451 if (!net::NetworkChangeNotifier::IsOffline()) {
452 pending_signin_restore_sessions_.erase(user->email()); 452 pending_signin_restore_sessions_.erase(user->email());
453 RestoreAuthSessionImpl(user_profile, false /* has_auth_cookies */); 453 RestoreAuthSessionImpl(user_profile, false /* has_auth_cookies */);
454 } else { 454 } else {
455 // Even if we're online we should wait till initial 455 // Even if we're online we should wait till initial
456 // OnConnectionTypeChanged() call. Otherwise starting fetchers too early may 456 // OnConnectionTypeChanged() call. Otherwise starting fetchers too early may
457 // end up canceling all request when initial network connection type is 457 // end up canceling all request when initial network connection type is
458 // processed. See http://crbug.com/121643. 458 // processed. See http://crbug.com/121643.
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 case Profile::CREATE_STATUS_CANCELED: 851 case Profile::CREATE_STATUS_CANCELED:
852 case Profile::MAX_CREATE_STATUS: 852 case Profile::MAX_CREATE_STATUS:
853 NOTREACHED(); 853 NOTREACHED();
854 break; 854 break;
855 } 855 }
856 } 856 }
857 857
858 void UserSessionManager::InitProfilePreferences( 858 void UserSessionManager::InitProfilePreferences(
859 Profile* profile, 859 Profile* profile,
860 const UserContext& user_context) { 860 const UserContext& user_context) {
861 user_manager::User* user = ProfileHelper::Get()->GetUserByProfile(profile); 861 const user_manager::User* user =
862 ProfileHelper::Get()->GetUserByProfile(profile);
862 if (user->is_active()) { 863 if (user->is_active()) {
863 input_method::InputMethodManager* manager = 864 input_method::InputMethodManager* manager =
864 input_method::InputMethodManager::Get(); 865 input_method::InputMethodManager::Get();
865 manager->SetState(GetDefaultIMEState(profile)); 866 manager->SetState(GetDefaultIMEState(profile));
866 } 867 }
867 if (user_manager::UserManager::Get()->IsCurrentUserNew()) { 868 if (user_manager::UserManager::Get()->IsCurrentUserNew()) {
868 SetFirstLoginPrefs(profile, 869 SetFirstLoginPrefs(profile,
869 user_context.GetPublicSessionLocale(), 870 user_context.GetPublicSessionLocale(),
870 user_context.GetPublicSessionInputMethod()); 871 user_context.GetPublicSessionInputMethod());
871 } 872 }
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
1506 chromeos::BootTimesRecorder::Get()->LoginDone( 1507 chromeos::BootTimesRecorder::Get()->LoginDone(
1507 user_manager::UserManager::Get()->IsCurrentUserNew()); 1508 user_manager::UserManager::Get()->IsCurrentUserNew());
1508 } 1509 }
1509 1510
1510 void UserSessionManager::RespectLocalePreferenceWrapper( 1511 void UserSessionManager::RespectLocalePreferenceWrapper(
1511 Profile* profile, 1512 Profile* profile,
1512 const base::Closure& callback) { 1513 const base::Closure& callback) {
1513 if (browser_shutdown::IsTryingToQuit()) 1514 if (browser_shutdown::IsTryingToQuit())
1514 return; 1515 return;
1515 1516
1516 user_manager::User* const user = 1517 const user_manager::User* const user =
1517 ProfileHelper::Get()->GetUserByProfile(profile); 1518 ProfileHelper::Get()->GetUserByProfile(profile);
1518 locale_util::SwitchLanguageCallback locale_switched_callback(base::Bind( 1519 locale_util::SwitchLanguageCallback locale_switched_callback(base::Bind(
1519 &UserSessionManager::RunCallbackOnLocaleLoaded, callback, 1520 &UserSessionManager::RunCallbackOnLocaleLoaded, callback,
1520 base::Owned(new InputEventsBlocker))); // Block UI events until 1521 base::Owned(new InputEventsBlocker))); // Block UI events until
1521 // the ResourceBundle is 1522 // the ResourceBundle is
1522 // reloaded. 1523 // reloaded.
1523 if (!RespectLocalePreference(profile, user, locale_switched_callback)) 1524 if (!RespectLocalePreference(profile, user, locale_switched_callback))
1524 callback.Run(); 1525 callback.Run();
1525 } 1526 }
1526 1527
1527 // static 1528 // static
1528 void UserSessionManager::RunCallbackOnLocaleLoaded( 1529 void UserSessionManager::RunCallbackOnLocaleLoaded(
1529 const base::Closure& callback, 1530 const base::Closure& callback,
1530 InputEventsBlocker* /* input_events_blocker */, 1531 InputEventsBlocker* /* input_events_blocker */,
1531 const locale_util::LanguageSwitchResult& /* result */) { 1532 const locale_util::LanguageSwitchResult& /* result */) {
1532 callback.Run(); 1533 callback.Run();
1533 } 1534 }
1534 1535
1535 void UserSessionManager::RemoveProfileForTesting(Profile* profile) { 1536 void UserSessionManager::RemoveProfileForTesting(Profile* profile) {
1536 default_ime_states_.erase(profile); 1537 default_ime_states_.erase(profile);
1537 } 1538 }
1538 1539
1539 void UserSessionManager::InjectStubUserContext( 1540 void UserSessionManager::InjectStubUserContext(
1540 const UserContext& user_context) { 1541 const UserContext& user_context) {
1541 injected_user_context_.reset(new UserContext(user_context)); 1542 injected_user_context_.reset(new UserContext(user_context));
1542 authenticator_ = NULL; 1543 authenticator_ = NULL;
1543 } 1544 }
1544 1545
1545 } // namespace chromeos 1546 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698