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" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 web_flow_.release()->DetachDelegateAndDelete(); | 164 web_flow_.release()->DetachDelegateAndDelete(); |
165 | 165 |
166 std::string fragment = url.GetContent().substr( | 166 std::string fragment = url.GetContent().substr( |
167 redirect_path_prefix_.length(), std::string::npos); | 167 redirect_path_prefix_.length(), std::string::npos); |
168 base::StringPairs pairs; | 168 base::StringPairs pairs; |
169 base::SplitStringIntoKeyValuePairs(fragment, '=', '&', &pairs); | 169 base::SplitStringIntoKeyValuePairs(fragment, '=', '&', &pairs); |
170 std::string access_token; | 170 std::string access_token; |
171 std::string error; | 171 std::string error; |
172 std::string expiration; | 172 std::string expiration; |
173 | 173 |
174 for (std::vector<std::pair<std::string, std::string> >::iterator | 174 for (base::StringPairs::iterator it = pairs.begin(); |
175 it = pairs.begin(); | |
176 it != pairs.end(); | 175 it != pairs.end(); |
177 ++it) { | 176 ++it) { |
178 if (it->first == kOAuth2RedirectAccessTokenKey) | 177 if (it->first == kOAuth2RedirectAccessTokenKey) |
179 access_token = it->second; | 178 access_token = it->second; |
180 else if (it->first == kOAuth2RedirectErrorKey) | 179 else if (it->first == kOAuth2RedirectErrorKey) |
181 error = it->second; | 180 error = it->second; |
182 else if (it->first == kOAuth2ExpiresInKey) | 181 else if (it->first == kOAuth2ExpiresInKey) |
183 expiration = it->second; | 182 expiration = it->second; |
184 } | 183 } |
185 | 184 |
(...skipping 27 matching lines...) Expand all Loading... |
213 } | 212 } |
214 | 213 |
215 scoped_ptr<WebAuthFlow> GaiaWebAuthFlow::CreateWebAuthFlow(GURL url) { | 214 scoped_ptr<WebAuthFlow> GaiaWebAuthFlow::CreateWebAuthFlow(GURL url) { |
216 return scoped_ptr<WebAuthFlow>(new WebAuthFlow(this, | 215 return scoped_ptr<WebAuthFlow>(new WebAuthFlow(this, |
217 profile_, | 216 profile_, |
218 url, | 217 url, |
219 WebAuthFlow::INTERACTIVE)); | 218 WebAuthFlow::INTERACTIVE)); |
220 } | 219 } |
221 | 220 |
222 } // namespace extensions | 221 } // namespace extensions |
OLD | NEW |