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

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

Issue 2752873002: Fix refresh token is not available after Chrome restart on crash. (Closed)
Patch Set: alternative solution Created 3 years, 9 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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 // user_id (kStubUser) and certain services like restoring OAuth session are 541 // user_id (kStubUser) and certain services like restoring OAuth session are
542 // explicitly disabled for it. 542 // explicitly disabled for it.
543 if (!user_manager->IsUserLoggedIn() || 543 if (!user_manager->IsUserLoggedIn() ||
544 !user_manager->IsLoggedInAsUserWithGaiaAccount() || 544 !user_manager->IsLoggedInAsUserWithGaiaAccount() ||
545 user_manager->IsLoggedInAsStub()) { 545 user_manager->IsLoggedInAsStub()) {
546 return; 546 return;
547 } 547 }
548 548
549 const user_manager::User* user = 549 const user_manager::User* user =
550 ProfileHelper::Get()->GetUserByProfile(user_profile); 550 ProfileHelper::Get()->GetUserByProfile(user_profile);
551
552 const SigninManagerBase* signin_manager =
553 SigninManagerFactory::GetForProfile(user_profile);
554 if (!signin_manager || signin_manager->GetAuthenticatedAccountId().empty())
555 LOG(ERROR) << "No account is associated with sign-in manager on restore.";
xiyuan 2017/03/16 15:59:02 nit: LOG_IF(ERROR, !signin_manager || signin_manag
556
551 DCHECK(user); 557 DCHECK(user);
552 if (!net::NetworkChangeNotifier::IsOffline()) { 558 if (!net::NetworkChangeNotifier::IsOffline()) {
553 pending_signin_restore_sessions_.erase(user->GetAccountId().GetUserEmail()); 559 pending_signin_restore_sessions_.erase(user->GetAccountId().GetUserEmail());
554 RestoreAuthSessionImpl(user_profile, false /* has_auth_cookies */); 560 RestoreAuthSessionImpl(user_profile, false /* has_auth_cookies */);
555 } else { 561 } else {
556 // Even if we're online we should wait till initial 562 // Even if we're online we should wait till initial
557 // OnConnectionTypeChanged() call. Otherwise starting fetchers too early may 563 // OnConnectionTypeChanged() call. Otherwise starting fetchers too early may
558 // end up canceling all request when initial network connection type is 564 // end up canceling all request when initial network connection type is
559 // processed. See http://crbug.com/121643. 565 // processed. See http://crbug.com/121643.
560 pending_signin_restore_sessions_.insert( 566 pending_signin_restore_sessions_.insert(
(...skipping 1353 matching lines...) Expand 10 before | Expand all | Expand 10 after
1914 ->browser_policy_connector_chromeos() 1920 ->browser_policy_connector_chromeos()
1915 ->IsEnterpriseManaged()) { 1921 ->IsEnterpriseManaged()) {
1916 return false; 1922 return false;
1917 } 1923 }
1918 1924
1919 // Do not show end of life notification if this is a guest session 1925 // Do not show end of life notification if this is a guest session
1920 return !profile->IsGuestSession(); 1926 return !profile->IsGuestSession();
1921 } 1927 }
1922 1928
1923 } // namespace chromeos 1929 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698