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

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

Issue 144013009: Extensions: Replace PO2TS::GetPrimaryAccountId() with SMB::GetAuthenticatedAccountId. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/signin/profile_oauth2_token_service.h" 12 #include "chrome/browser/signin/profile_oauth2_token_service.h"
13 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 13 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
14 #include "chrome/browser/signin/signin_manager.h"
15 #include "chrome/browser/signin/signin_manager_factory.h"
14 #include "google_apis/gaia/gaia_urls.h" 16 #include "google_apis/gaia/gaia_urls.h"
15 #include "net/base/escape.h" 17 #include "net/base/escape.h"
16 18
17 namespace extensions { 19 namespace extensions {
18 20
19 GaiaWebAuthFlow::GaiaWebAuthFlow(Delegate* delegate, 21 GaiaWebAuthFlow::GaiaWebAuthFlow(Delegate* delegate,
20 Profile* profile, 22 Profile* profile,
21 const std::string& extension_id, 23 const std::string& extension_id,
22 const OAuth2Info& oauth2_info, 24 const OAuth2Info& oauth2_info,
23 const std::string& locale) 25 const std::string& locale)
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 if (web_flow_) 57 if (web_flow_)
56 web_flow_.release()->DetachDelegateAndDelete(); 58 web_flow_.release()->DetachDelegateAndDelete();
57 } 59 }
58 60
59 void GaiaWebAuthFlow::Start() { 61 void GaiaWebAuthFlow::Start() {
60 ProfileOAuth2TokenService* token_service = 62 ProfileOAuth2TokenService* token_service =
61 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_); 63 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_);
62 ubertoken_fetcher_.reset(new UbertokenFetcher(token_service, 64 ubertoken_fetcher_.reset(new UbertokenFetcher(token_service,
63 this, 65 this,
64 profile_->GetRequestContext())); 66 profile_->GetRequestContext()));
65 ubertoken_fetcher_->StartFetchingToken(token_service->GetPrimaryAccountId()); 67 SigninManagerBase* signin_manager =
68 SigninManagerFactory::GetForProfile(profile_);
69 ubertoken_fetcher_->StartFetchingToken(
70 signin_manager->GetAuthenticatedAccountId());
66 } 71 }
67 72
68 void GaiaWebAuthFlow::OnUbertokenSuccess(const std::string& token) { 73 void GaiaWebAuthFlow::OnUbertokenSuccess(const std::string& token) {
69 const char kMergeSessionQueryFormat[] = "?uberauth=%s&" 74 const char kMergeSessionQueryFormat[] = "?uberauth=%s&"
70 "continue=%s&" 75 "continue=%s&"
71 "source=appsv2"; 76 "source=appsv2";
72 77
73 std::string merge_query = base::StringPrintf( 78 std::string merge_query = base::StringPrintf(
74 kMergeSessionQueryFormat, 79 kMergeSessionQueryFormat,
75 net::EscapeUrlEncodedData(token, true).c_str(), 80 net::EscapeUrlEncodedData(token, true).c_str(),
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 } 178 }
174 179
175 scoped_ptr<WebAuthFlow> GaiaWebAuthFlow::CreateWebAuthFlow(GURL url) { 180 scoped_ptr<WebAuthFlow> GaiaWebAuthFlow::CreateWebAuthFlow(GURL url) {
176 return scoped_ptr<WebAuthFlow>(new WebAuthFlow(this, 181 return scoped_ptr<WebAuthFlow>(new WebAuthFlow(this,
177 profile_, 182 profile_,
178 url, 183 url,
179 WebAuthFlow::INTERACTIVE)); 184 WebAuthFlow::INTERACTIVE));
180 } 185 }
181 186
182 } // namespace extensions 187 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698