OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "components/autofill/content/browser/wallet/wallet_service_url.h" | 5 #include "components/autofill/content/browser/wallet/wallet_service_url.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 bool IsSignInContinueUrl(const GURL& url, size_t* user_index) { | 173 bool IsSignInContinueUrl(const GURL& url, size_t* user_index) { |
174 GURL final_url = GetSignInContinueUrl(); | 174 GURL final_url = GetSignInContinueUrl(); |
175 if (url.scheme() != final_url.scheme() || | 175 if (url.scheme() != final_url.scheme() || |
176 url.host() != final_url.host() || | 176 url.host() != final_url.host() || |
177 url.path() != final_url.path()) { | 177 url.path() != final_url.path()) { |
178 return false; | 178 return false; |
179 } | 179 } |
180 | 180 |
181 *user_index = 0; | 181 *user_index = 0; |
182 std::string query_str = url.query(); | 182 std::string query_str = url.query(); |
183 url_parse::Component query(0, query_str.length()); | 183 url::Component query(0, query_str.length()); |
184 url_parse::Component key, value; | 184 url::Component key, value; |
185 const char kUserIndexKey[] = "authuser"; | 185 const char kUserIndexKey[] = "authuser"; |
186 while (url_parse::ExtractQueryKeyValue(query_str.c_str(), &query, &key, | 186 while (url::ExtractQueryKeyValue(query_str.c_str(), &query, &key, &value)) { |
187 &value)) { | |
188 if (key.is_nonempty() && | 187 if (key.is_nonempty() && |
189 query_str.substr(key.begin, key.len) == kUserIndexKey) { | 188 query_str.substr(key.begin, key.len) == kUserIndexKey) { |
190 base::StringToSizeT(query_str.substr(value.begin, value.len), user_index); | 189 base::StringToSizeT(query_str.substr(value.begin, value.len), user_index); |
191 break; | 190 break; |
192 } | 191 } |
193 } | 192 } |
194 | 193 |
195 return true; | 194 return true; |
196 } | 195 } |
197 | 196 |
198 bool IsSignInRelatedUrl(const GURL& url) { | 197 bool IsSignInRelatedUrl(const GURL& url) { |
199 size_t unused; | 198 size_t unused; |
200 return url.GetOrigin() == GetSignInUrl().GetOrigin() || | 199 return url.GetOrigin() == GetSignInUrl().GetOrigin() || |
201 StartsWith(base::UTF8ToUTF16(url.GetOrigin().host()), | 200 StartsWith(base::UTF8ToUTF16(url.GetOrigin().host()), |
202 base::ASCIIToUTF16("accounts."), | 201 base::ASCIIToUTF16("accounts."), |
203 false) || | 202 false) || |
204 IsSignInContinueUrl(url, &unused); | 203 IsSignInContinueUrl(url, &unused); |
205 } | 204 } |
206 | 205 |
207 bool IsUsingProd() { | 206 bool IsUsingProd() { |
208 return GetWalletHostUrl() == GURL(kProdWalletServiceUrl); | 207 return GetWalletHostUrl() == GURL(kProdWalletServiceUrl); |
209 } | 208 } |
210 | 209 |
211 } // namespace wallet | 210 } // namespace wallet |
212 } // namespace autofill | 211 } // namespace autofill |
OLD | NEW |