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

Unified Diff: chrome/browser/chromeos/login/existing_user_controller.cc

Issue 1097663003: Fetch OAuth2 tokens prior to profile creation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: set up default networks Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/existing_user_controller.cc
diff --git a/chrome/browser/chromeos/login/existing_user_controller.cc b/chrome/browser/chromeos/login/existing_user_controller.cc
index ce08f36771da070ae3dbfda1040d72af7ae36b0d..5e35e2ae29592e08efd4b537f306e10c2d7c2ec3 100644
--- a/chrome/browser/chromeos/login/existing_user_controller.cc
+++ b/chrome/browser/chromeos/login/existing_user_controller.cc
@@ -29,6 +29,7 @@
#include "chrome/browser/chromeos/login/easy_unlock/bootstrap_user_flow.h"
#include "chrome/browser/chromeos/login/helper.h"
#include "chrome/browser/chromeos/login/session/user_session_manager.h"
+#include "chrome/browser/chromeos/login/signin/oauth2_token_initializer.h"
#include "chrome/browser/chromeos/login/signin_specifics.h"
#include "chrome/browser/chromeos/login/startup_utils.h"
#include "chrome/browser/chromeos/login/ui/login_display_host.h"
@@ -596,7 +597,7 @@ void ExistingUserController::OnAuthSuccess(const UserContext& user_context) {
// Bootstrap experiment F N/A
const bool has_auth_cookies =
login_performer_->auth_mode() == LoginPerformer::AUTH_MODE_EXTENSION &&
- (user_context.GetAuthCode().empty() ||
+ (user_context.GetAccessToken().empty() ||
user_context.GetAuthFlow() == UserContext::AUTH_FLOW_GAIA_WITH_SAML) &&
user_context.GetAuthFlow() != UserContext::AUTH_FLOW_EASY_BOOTSTRAP;
@@ -1122,6 +1123,15 @@ void ExistingUserController::DoCompleteLogin(const UserContext& user_context) {
return;
}
+ if (!user_context.GetAuthCode().empty() &&
+ user_context.GetAuthFlow() == UserContext::AUTH_FLOW_GAIA_WITHOUT_SAML) {
Nikita (slow) 2015/04/23 10:59:25 What about AUTH_FLOW_EASY_BOOTSTRAP?
Nikita (slow) 2015/04/23 10:59:25 What happens for AUTH_FLOW_GAIA_WITH_SAML case? Sh
xiyuan 2015/04/23 16:09:23 AUTH_FLOW_EASY_BOOTSTRAP uses the branch at line 1
achuithb 2015/04/23 22:11:16 Done.
achuithb 2015/04/23 22:11:16 Done.
achuithb 2015/04/23 22:11:16 Done.
xiyuan 2015/04/24 03:36:06 Oops. What Achuith had before is actually correct.
achuithb 2015/04/25 00:53:32 Done.
+ oauth2_token_initializer_.reset(new OAuth2TokenInitializer);
+ oauth2_token_initializer_->Start(
+ user_context, base::Bind(&ExistingUserController::OnOAuth2TokensFetched,
+ weak_factory_.GetWeakPtr()));
+ return;
+ }
+
PerformLogin(user_context, LoginPerformer::AUTH_MODE_EXTENSION);
}
@@ -1199,4 +1209,15 @@ void ExistingUserController::OnBootstrapUserContextInitialized(
PerformLogin(user_context, LoginPerformer::AUTH_MODE_EXTENSION);
}
+void ExistingUserController::OnOAuth2TokensFetched(
+ bool success,
+ const UserContext& user_context) {
+ if (!success) {
+ LOG(ERROR) << "OAuth2 token fetch failed.";
+ OnAuthFailure(AuthFailure(AuthFailure::NETWORK_AUTH_FAILED));
+ return;
+ }
+ PerformLogin(user_context, LoginPerformer::AUTH_MODE_EXTENSION);
+}
+
} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698