| 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 // | 158 // |
| 159 // Because there is no double slash, everything after the scheme is | 159 // Because there is no double slash, everything after the scheme is |
| 160 // interpreted as a path, including the fragment. | 160 // interpreted as a path, including the fragment. |
| 161 | 161 |
| 162 if (url.scheme() == redirect_scheme_ && !url.has_host() && !url.has_port() && | 162 if (url.scheme() == redirect_scheme_ && !url.has_host() && !url.has_port() && |
| 163 StartsWithASCII(url.GetContent(), redirect_path_prefix_, true)) { | 163 StartsWithASCII(url.GetContent(), redirect_path_prefix_, true)) { |
| 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 std::vector<std::pair<std::string, std::string> > 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 (std::vector<std::pair<std::string, std::string> >::iterator |
| 175 it = pairs.begin(); | 175 it = pairs.begin(); |
| 176 it != pairs.end(); | 176 it != pairs.end(); |
| 177 ++it) { | 177 ++it) { |
| 178 if (it->first == kOAuth2RedirectAccessTokenKey) | 178 if (it->first == kOAuth2RedirectAccessTokenKey) |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 } | 213 } |
| 214 | 214 |
| 215 scoped_ptr<WebAuthFlow> GaiaWebAuthFlow::CreateWebAuthFlow(GURL url) { | 215 scoped_ptr<WebAuthFlow> GaiaWebAuthFlow::CreateWebAuthFlow(GURL url) { |
| 216 return scoped_ptr<WebAuthFlow>(new WebAuthFlow(this, | 216 return scoped_ptr<WebAuthFlow>(new WebAuthFlow(this, |
| 217 profile_, | 217 profile_, |
| 218 url, | 218 url, |
| 219 WebAuthFlow::INTERACTIVE)); | 219 WebAuthFlow::INTERACTIVE)); |
| 220 } | 220 } |
| 221 | 221 |
| 222 } // namespace extensions | 222 } // namespace extensions |
| OLD | NEW |