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

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

Issue 136723009: Move UbertokenFetcher from //chrome to //google_apis. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase 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/profiles/profile.h"
11 #include "chrome/browser/signin/profile_oauth2_token_service.h" 12 #include "chrome/browser/signin/profile_oauth2_token_service.h"
12 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 13 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
13 #include "google_apis/gaia/gaia_urls.h" 14 #include "google_apis/gaia/gaia_urls.h"
14 #include "net/base/escape.h" 15 #include "net/base/escape.h"
15 16
16 namespace extensions { 17 namespace extensions {
17 18
18 GaiaWebAuthFlow::GaiaWebAuthFlow(Delegate* delegate, 19 GaiaWebAuthFlow::GaiaWebAuthFlow(Delegate* delegate,
19 Profile* profile, 20 Profile* profile,
20 const std::string& extension_id, 21 const std::string& extension_id,
(...skipping 30 matching lines...) Expand all
51 } 52 }
52 53
53 GaiaWebAuthFlow::~GaiaWebAuthFlow() { 54 GaiaWebAuthFlow::~GaiaWebAuthFlow() {
54 if (web_flow_) 55 if (web_flow_)
55 web_flow_.release()->DetachDelegateAndDelete(); 56 web_flow_.release()->DetachDelegateAndDelete();
56 } 57 }
57 58
58 void GaiaWebAuthFlow::Start() { 59 void GaiaWebAuthFlow::Start() {
59 ProfileOAuth2TokenService* token_service = 60 ProfileOAuth2TokenService* token_service =
60 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_); 61 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_);
61 ubertoken_fetcher_.reset(new UbertokenFetcher(profile_, this)); 62 ubertoken_fetcher_.reset(new UbertokenFetcher(token_service,
63 this,
64 profile_->GetRequestContext()));
62 ubertoken_fetcher_->StartFetchingToken(token_service->GetPrimaryAccountId()); 65 ubertoken_fetcher_->StartFetchingToken(token_service->GetPrimaryAccountId());
63 } 66 }
64 67
65 void GaiaWebAuthFlow::OnUbertokenSuccess(const std::string& token) { 68 void GaiaWebAuthFlow::OnUbertokenSuccess(const std::string& token) {
66 const char kMergeSessionQueryFormat[] = "?uberauth=%s&" 69 const char kMergeSessionQueryFormat[] = "?uberauth=%s&"
67 "continue=%s&" 70 "continue=%s&"
68 "source=appsv2"; 71 "source=appsv2";
69 72
70 std::string merge_query = base::StringPrintf( 73 std::string merge_query = base::StringPrintf(
71 kMergeSessionQueryFormat, 74 kMergeSessionQueryFormat,
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 } 173 }
171 174
172 scoped_ptr<WebAuthFlow> GaiaWebAuthFlow::CreateWebAuthFlow(GURL url) { 175 scoped_ptr<WebAuthFlow> GaiaWebAuthFlow::CreateWebAuthFlow(GURL url) {
173 return scoped_ptr<WebAuthFlow>(new WebAuthFlow(this, 176 return scoped_ptr<WebAuthFlow>(new WebAuthFlow(this,
174 profile_, 177 profile_,
175 url, 178 url,
176 WebAuthFlow::INTERACTIVE)); 179 WebAuthFlow::INTERACTIVE));
177 } 180 }
178 181
179 } // namespace extensions 182 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/identity/gaia_web_auth_flow.h ('k') | chrome/browser/signin/google_auto_login_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698