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

Side by Side Diff: components/signin/core/browser/signin_oauth_helper.cc

Issue 362613002: Implementation of SigninClient::GetSigninScopedDeviceId (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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 "components/signin/core/browser/signin_oauth_helper.h" 5 #include "components/signin/core/browser/signin_oauth_helper.h"
6 6
7 #include "base/command_line.h"
7 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "components/signin/core/common/signin_switches.h"
8 #include "google_apis/gaia/gaia_auth_fetcher.h" 10 #include "google_apis/gaia/gaia_auth_fetcher.h"
9 #include "google_apis/gaia/gaia_constants.h" 11 #include "google_apis/gaia/gaia_constants.h"
10 12
11 SigninOAuthHelper::SigninOAuthHelper(net::URLRequestContextGetter* getter, 13 SigninOAuthHelper::SigninOAuthHelper(net::URLRequestContextGetter* getter,
12 const std::string& session_index, 14 const std::string& session_index,
13 const std::string& signin_scoped_device_id, 15 const std::string& signin_scoped_device_id,
14 Consumer* consumer) 16 Consumer* consumer)
15 : gaia_auth_fetcher_(this, GaiaConstants::kChromeSource, getter), 17 : gaia_auth_fetcher_(this, GaiaConstants::kChromeSource, getter),
16 consumer_(consumer) { 18 consumer_(consumer) {
17 DCHECK(consumer_); 19 DCHECK(consumer_);
18 DCHECK(getter); 20 DCHECK(getter);
19 DCHECK(!session_index.empty()); 21 DCHECK(!session_index.empty());
20 gaia_auth_fetcher_.StartCookieForOAuthLoginTokenExchangeWithDeviceId( 22 if (CommandLine::ForCurrentProcess()->HasSwitch(
21 session_index, signin_scoped_device_id); 23 switches::kEnableNewProfileManagement)) {
Roger Tawa OOO till Jul 10th 2014/07/01 13:42:54 Please use switches::IsNewProfileManagement() from
pavely 2014/07/01 21:41:47 Sorry, missed the line when copy pasting from swit
24 gaia_auth_fetcher_.StartCookieForOAuthLoginTokenExchangeWithDeviceId(
25 session_index, signin_scoped_device_id);
26 } else {
27 gaia_auth_fetcher_.StartCookieForOAuthLoginTokenExchange(session_index);
28 }
22 } 29 }
23 30
24 SigninOAuthHelper::~SigninOAuthHelper() {} 31 SigninOAuthHelper::~SigninOAuthHelper() {}
25 32
26 void SigninOAuthHelper::OnClientOAuthSuccess(const ClientOAuthResult& result) { 33 void SigninOAuthHelper::OnClientOAuthSuccess(const ClientOAuthResult& result) {
27 refresh_token_ = result.refresh_token; 34 refresh_token_ = result.refresh_token;
28 gaia_auth_fetcher_.StartOAuthLogin(result.access_token, 35 gaia_auth_fetcher_.StartOAuthLogin(result.access_token,
29 GaiaConstants::kGaiaService); 36 GaiaConstants::kGaiaService);
30 } 37 }
31 38
(...skipping 29 matching lines...) Expand all
61 consumer_->OnSigninOAuthInformationAvailable( 68 consumer_->OnSigninOAuthInformationAvailable(
62 email_iter->second, display_email_iter->second, refresh_token_); 69 email_iter->second, display_email_iter->second, refresh_token_);
63 } 70 }
64 } 71 }
65 72
66 void SigninOAuthHelper::OnGetUserInfoFailure( 73 void SigninOAuthHelper::OnGetUserInfoFailure(
67 const GoogleServiceAuthError& error) { 74 const GoogleServiceAuthError& error) {
68 VLOG(1) << "SigninOAuthHelper::OnGetUserInfoFailure : " << error.ToString(); 75 VLOG(1) << "SigninOAuthHelper::OnGetUserInfoFailure : " << error.ToString();
69 consumer_->OnSigninOAuthInformationFailure(error); 76 consumer_->OnSigninOAuthInformationFailure(error);
70 } 77 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698