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

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

Issue 2903123002: cros: Terminate if merge session fails for online sign-in (Closed)
Patch Set: add test Created 3 years, 7 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 849 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 // error. http://crbug.com/295245 860 // error. http://crbug.com/295245
861 if (!connection_error) { 861 if (!connection_error) {
862 // We are in one of "done" states here. 862 // We are in one of "done" states here.
863 user_manager::UserManager::Get()->SaveUserOAuthStatus( 863 user_manager::UserManager::Get()->SaveUserOAuthStatus(
864 user_manager::UserManager::Get()->GetActiveUser()->GetAccountId(), 864 user_manager::UserManager::Get()->GetActiveUser()->GetAccountId(),
865 user_status); 865 user_status);
866 } 866 }
867 867
868 login_manager->RemoveObserver(this); 868 login_manager->RemoveObserver(this);
869 869
870 const bool is_online_signin =
achuithb 2017/05/25 19:44:17 I think a comment explaining that this is necessar
xiyuan 2017/05/25 20:24:09 Done.
871 user_context_.GetAuthFlow() == UserContext::AUTH_FLOW_GAIA_WITH_SAML ||
872 user_context_.GetAuthFlow() == UserContext::AUTH_FLOW_GAIA_WITHOUT_SAML;
873 if (is_online_signin && state == OAuth2LoginManager::SESSION_RESTORE_FAILED) {
874 LOG(ERROR)
875 << "Session restore failed for online sign-in, terminating session.";
876 chrome::AttemptUserExit();
877 return;
878 }
879
870 if (exit_after_session_restore_ && 880 if (exit_after_session_restore_ &&
871 (state == OAuth2LoginManager::SESSION_RESTORE_DONE || 881 (state == OAuth2LoginManager::SESSION_RESTORE_DONE ||
872 state == OAuth2LoginManager::SESSION_RESTORE_FAILED || 882 state == OAuth2LoginManager::SESSION_RESTORE_FAILED ||
873 state == OAuth2LoginManager::SESSION_RESTORE_CONNECTION_FAILED)) { 883 state == OAuth2LoginManager::SESSION_RESTORE_CONNECTION_FAILED)) {
874 LOG(WARNING) << "Restarting Chrome after session restore finishes, " 884 LOG(WARNING) << "Restarting Chrome after session restore finishes, "
875 << "most likely due to custom flags."; 885 << "most likely due to custom flags.";
876 886
877 // We need to restart cleanly in this case to make sure OAuth2 RT is 887 // We need to restart cleanly in this case to make sure OAuth2 RT is
878 // actually saved. 888 // actually saved.
879 chrome::AttemptRestart(); 889 chrome::AttemptRestart();
(...skipping 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after
1944 ->browser_policy_connector_chromeos() 1954 ->browser_policy_connector_chromeos()
1945 ->IsEnterpriseManaged()) { 1955 ->IsEnterpriseManaged()) {
1946 return false; 1956 return false;
1947 } 1957 }
1948 1958
1949 // Do not show end of life notification if this is a guest session 1959 // Do not show end of life notification if this is a guest session
1950 return !profile->IsGuestSession(); 1960 return !profile->IsGuestSession();
1951 } 1961 }
1952 1962
1953 } // namespace chromeos 1963 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698