Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/google/core/browser/google_util.h" | 5 #include "components/google/core/browser/google_util.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 72 } | 72 } |
| 73 | 73 |
| 74 } // namespace | 74 } // namespace |
| 75 | 75 |
| 76 | 76 |
| 77 namespace google_util { | 77 namespace google_util { |
| 78 | 78 |
| 79 // Global functions ----------------------------------------------------------- | 79 // Global functions ----------------------------------------------------------- |
| 80 | 80 |
| 81 bool HasGoogleSearchQueryParam(const std::string& str) { | 81 bool HasGoogleSearchQueryParam(const std::string& str) { |
| 82 url::Component query(0, str.length()), key, value; | 82 url::Component query(0, static_cast<int>(str.length())), key, value; |
|
Ilya Sherman
2015/01/06 00:39:58
nit: Would checked_cast be better?
Peter Kasting
2015/01/06 00:54:26
I don't think it's necessary. This just makes exp
| |
| 83 while (url::ExtractQueryKeyValue(str.c_str(), &query, &key, &value)) { | 83 while (url::ExtractQueryKeyValue(str.c_str(), &query, &key, &value)) { |
| 84 if ((key.len == 1) && (str[key.begin] == 'q') && value.is_nonempty()) | 84 if ((key.len == 1) && (str[key.begin] == 'q') && value.is_nonempty()) |
| 85 return true; | 85 return true; |
| 86 } | 86 } |
| 87 return false; | 87 return false; |
| 88 } | 88 } |
| 89 | 89 |
| 90 GURL LinkDoctorBaseURL() { | 90 GURL LinkDoctorBaseURL() { |
| 91 if (gUseMockLinkDoctorBaseURLForTesting) | 91 if (gUseMockLinkDoctorBaseURLForTesting) |
| 92 return GURL("http://mock.linkdoctor.url/for?testing"); | 92 return GURL("http://mock.linkdoctor.url/for?testing"); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 208 } | 208 } |
| 209 | 209 |
| 210 bool IsYoutubeDomainUrl(const GURL& url, | 210 bool IsYoutubeDomainUrl(const GURL& url, |
| 211 SubdomainPermission subdomain_permission, | 211 SubdomainPermission subdomain_permission, |
| 212 PortPermission port_permission) { | 212 PortPermission port_permission) { |
| 213 return IsValidURL(url, port_permission) && | 213 return IsValidURL(url, port_permission) && |
| 214 IsValidHostName(url.host(), "youtube", subdomain_permission); | 214 IsValidHostName(url.host(), "youtube", subdomain_permission); |
| 215 } | 215 } |
| 216 | 216 |
| 217 } // namespace google_util | 217 } // namespace google_util |
| OLD | NEW |