Chromium Code Reviews| Index: chrome/browser/google/google_util.cc |
| diff --git a/chrome/browser/google/google_util.cc b/chrome/browser/google/google_util.cc |
| index eda66b334eb9ae10da12bec84c65276edf8ab0cc..ef297f1ae8346abe3c8a5695a53266019e88fdab 100644 |
| --- a/chrome/browser/google/google_util.cc |
| +++ b/chrome/browser/google/google_util.cc |
| @@ -203,6 +203,27 @@ bool IsGoogleSearchUrl(const std::string& url) { |
| (!is_home_page_base && HasQueryParameter(query)); |
| } |
| +bool IsEmbeddedGoogleSearchUrl(const std::string& url) { |
| + if (!IsGoogleSearchUrl(url)) |
| + return false; |
| + |
| + const std::string embedded_search_key = "espv="; |
| + |
| + GURL original_url(url); |
| + std::vector<std::string> parameters; |
| + base::SplitString(original_url.query(), '&', ¶meters); |
| + for (std::vector<std::string>::const_iterator it = parameters.begin(); |
| + it != parameters.end(); ++it) { |
| + // If the parameter key is |embedded_search_key| and the value is not 0 this |
| + // is an embedded Google search URL. |
| + if (StartsWithASCII(*it, embedded_search_key, true)) { |
| + std::string value = it->substr(embedded_search_key.length()); |
| + return value.length() > 0 && value != "0"; |
|
Ilya Sherman
2012/06/21 17:46:58
Optional nit: "value.length() > 0" -> "!value.empt
dhollowa
2012/06/21 22:16:43
Done. Rephrased with |Component| terminology.
|
| + } |
| + } |
|
Ilya Sherman
2012/06/21 17:46:58
You might want to use GURL's implementation [1] fo
dhollowa
2012/06/21 22:16:43
Much better. Thanks for the tip!
On 2012/06/21 1
|
| + return false; |
| +} |
| + |
| bool IsOrganic(const std::string& brand) { |
| const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| if (command_line.HasSwitch(switches::kOrganicInstall)) |