OLD | NEW |
---|---|
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/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.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_factory.h" | 14 #include "chrome/browser/signin/signin_manager_factory.h" |
15 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 15 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
16 #include "components/signin/core/browser/signin_manager.h" | 16 #include "components/signin/core/browser/signin_manager.h" |
17 #include "google_apis/gaia/gaia_constants.h" | |
17 #include "google_apis/gaia/gaia_urls.h" | 18 #include "google_apis/gaia/gaia_urls.h" |
18 #include "net/base/escape.h" | 19 #include "net/base/escape.h" |
19 | 20 |
20 namespace extensions { | 21 namespace extensions { |
21 | 22 |
22 GaiaWebAuthFlow::GaiaWebAuthFlow(Delegate* delegate, | 23 GaiaWebAuthFlow::GaiaWebAuthFlow(Delegate* delegate, |
23 Profile* profile, | 24 Profile* profile, |
24 const ExtensionTokenKey* token_key, | 25 const ExtensionTokenKey* token_key, |
25 const std::string& oauth2_client_id, | 26 const std::string& oauth2_client_id, |
26 const std::string& locale) | 27 const std::string& locale) |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
70 | 71 |
71 if (web_flow_) | 72 if (web_flow_) |
72 web_flow_.release()->DetachDelegateAndDelete(); | 73 web_flow_.release()->DetachDelegateAndDelete(); |
73 } | 74 } |
74 | 75 |
75 void GaiaWebAuthFlow::Start() { | 76 void GaiaWebAuthFlow::Start() { |
76 ProfileOAuth2TokenService* token_service = | 77 ProfileOAuth2TokenService* token_service = |
77 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_); | 78 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_); |
78 ubertoken_fetcher_.reset(new UbertokenFetcher(token_service, | 79 ubertoken_fetcher_.reset(new UbertokenFetcher(token_service, |
79 this, | 80 this, |
81 GaiaConstants::kChromeSource, | |
Mike Lerman
2014/09/26 16:57:07
Should this be a distinct constant like kChromeExt
Roger Tawa OOO till Jul 10th
2014/09/26 19:42:39
For now I want to separate reconcilor from everyth
| |
80 profile_->GetRequestContext())); | 82 profile_->GetRequestContext())); |
81 ubertoken_fetcher_->StartFetchingToken(account_id_); | 83 ubertoken_fetcher_->StartFetchingToken(account_id_); |
82 } | 84 } |
83 | 85 |
84 void GaiaWebAuthFlow::OnUbertokenSuccess(const std::string& token) { | 86 void GaiaWebAuthFlow::OnUbertokenSuccess(const std::string& token) { |
85 TRACE_EVENT_ASYNC_STEP_PAST0( | 87 TRACE_EVENT_ASYNC_STEP_PAST0( |
86 "identity", "GaiaWebAuthFlow", this, "OnUbertokenSuccess"); | 88 "identity", "GaiaWebAuthFlow", this, "OnUbertokenSuccess"); |
87 | 89 |
88 const char kMergeSessionQueryFormat[] = "?uberauth=%s&" | 90 const char kMergeSessionQueryFormat[] = "?uberauth=%s&" |
89 "continue=%s&" | 91 "continue=%s&" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
212 } | 214 } |
213 | 215 |
214 scoped_ptr<WebAuthFlow> GaiaWebAuthFlow::CreateWebAuthFlow(GURL url) { | 216 scoped_ptr<WebAuthFlow> GaiaWebAuthFlow::CreateWebAuthFlow(GURL url) { |
215 return scoped_ptr<WebAuthFlow>(new WebAuthFlow(this, | 217 return scoped_ptr<WebAuthFlow>(new WebAuthFlow(this, |
216 profile_, | 218 profile_, |
217 url, | 219 url, |
218 WebAuthFlow::INTERACTIVE)); | 220 WebAuthFlow::INTERACTIVE)); |
219 } | 221 } |
220 | 222 |
221 } // namespace extensions | 223 } // namespace extensions |
OLD | NEW |