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

Side by Side Diff: chrome/browser/extensions/api/identity/gaia_web_auth_flow.cc

Issue 131973004: Eliminate usage of PO2TS::GetPrimaryAccountID() in UbertokenFetcher. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile failure Created 6 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/extensions/api/identity/gaia_web_auth_flow.h" 5 #include "chrome/browser/extensions/api/identity/gaia_web_auth_flow.h"
6 6
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "base/strings/string_split.h" 8 #include "base/strings/string_split.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
11 #include "chrome/browser/signin/profile_oauth2_token_service.h"
12 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
11 #include "google_apis/gaia/gaia_urls.h" 13 #include "google_apis/gaia/gaia_urls.h"
12 #include "net/base/escape.h" 14 #include "net/base/escape.h"
13 15
14 namespace extensions { 16 namespace extensions {
15 17
16 GaiaWebAuthFlow::GaiaWebAuthFlow(Delegate* delegate, 18 GaiaWebAuthFlow::GaiaWebAuthFlow(Delegate* delegate,
17 Profile* profile, 19 Profile* profile,
18 const std::string& extension_id, 20 const std::string& extension_id,
19 const OAuth2Info& oauth2_info, 21 const OAuth2Info& oauth2_info,
20 const std::string& locale) 22 const std::string& locale)
(...skipping 26 matching lines...) Expand all
47 extension_id.c_str(), 49 extension_id.c_str(),
48 locale.c_str())); 50 locale.c_str()));
49 } 51 }
50 52
51 GaiaWebAuthFlow::~GaiaWebAuthFlow() { 53 GaiaWebAuthFlow::~GaiaWebAuthFlow() {
52 if (web_flow_) 54 if (web_flow_)
53 web_flow_.release()->DetachDelegateAndDelete(); 55 web_flow_.release()->DetachDelegateAndDelete();
54 } 56 }
55 57
56 void GaiaWebAuthFlow::Start() { 58 void GaiaWebAuthFlow::Start() {
59 ProfileOAuth2TokenService* token_service =
60 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_);
57 ubertoken_fetcher_.reset(new UbertokenFetcher(profile_, this)); 61 ubertoken_fetcher_.reset(new UbertokenFetcher(profile_, this));
58 ubertoken_fetcher_->StartFetchingToken(); 62 ubertoken_fetcher_->StartFetchingToken(token_service->GetPrimaryAccountId());
59 } 63 }
60 64
61 void GaiaWebAuthFlow::OnUbertokenSuccess(const std::string& token) { 65 void GaiaWebAuthFlow::OnUbertokenSuccess(const std::string& token) {
62 const char kMergeSessionQueryFormat[] = "?uberauth=%s&" 66 const char kMergeSessionQueryFormat[] = "?uberauth=%s&"
63 "continue=%s&" 67 "continue=%s&"
64 "source=appsv2"; 68 "source=appsv2";
65 69
66 std::string merge_query = base::StringPrintf( 70 std::string merge_query = base::StringPrintf(
67 kMergeSessionQueryFormat, 71 kMergeSessionQueryFormat,
68 net::EscapeUrlEncodedData(token, true).c_str(), 72 net::EscapeUrlEncodedData(token, true).c_str(),
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 } 170 }
167 171
168 scoped_ptr<WebAuthFlow> GaiaWebAuthFlow::CreateWebAuthFlow(GURL url) { 172 scoped_ptr<WebAuthFlow> GaiaWebAuthFlow::CreateWebAuthFlow(GURL url) {
169 return scoped_ptr<WebAuthFlow>(new WebAuthFlow(this, 173 return scoped_ptr<WebAuthFlow>(new WebAuthFlow(this,
170 profile_, 174 profile_,
171 url, 175 url,
172 WebAuthFlow::INTERACTIVE)); 176 WebAuthFlow::INTERACTIVE));
173 } 177 }
174 178
175 } // namespace extensions 179 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/android/signin/signin_manager_android.cc ('k') | chrome/browser/signin/google_auto_login_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698