| 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..97a16a71542218656c77463fc861e1aa9d83afe4 100644
|
| --- a/chrome/browser/google/google_util.cc
|
| +++ b/chrome/browser/google/google_util.cc
|
| @@ -9,6 +9,7 @@
|
|
|
| #include "base/command_line.h"
|
| #include "base/string16.h"
|
| +#include "base/string_number_conversions.h"
|
| #include "base/string_split.h"
|
| #include "base/string_util.h"
|
| #include "base/utf_string_conversions.h"
|
| @@ -18,6 +19,7 @@
|
| #include "chrome/common/net/url_util.h"
|
| #include "chrome/installer/util/google_update_settings.h"
|
| #include "googleurl/src/gurl.h"
|
| +#include "googleurl/src/url_parse.h"
|
| #include "net/base/registry_controlled_domain.h"
|
|
|
| #if defined(OS_MACOSX)
|
| @@ -203,6 +205,29 @@ bool IsGoogleSearchUrl(const std::string& url) {
|
| (!is_home_page_base && HasQueryParameter(query));
|
| }
|
|
|
| +bool IsInstantExtendedAPIGoogleSearchUrl(const std::string& url) {
|
| + if (!IsGoogleSearchUrl(url))
|
| + return false;
|
| +
|
| + const std::string embedded_search_key = "espv";
|
| +
|
| + url_parse::Parsed parsed_url;
|
| + url_parse::ParseStandardURL(url.c_str(), url.length(), &parsed_url);
|
| + url_parse::Component key, value;
|
| + while (url_parse::ExtractQueryKeyValue(
|
| + url.c_str(), &parsed_url.query, &key, &value)) {
|
| + // If the parameter key is |embedded_search_key| and the value is not 0 this
|
| + // is an Instant Extended API Google search URL.
|
| + if (!url.compare(key.begin, key.len, embedded_search_key)) {
|
| + int int_value = 0;
|
| + if (value.is_nonempty())
|
| + base::StringToInt(url.substr(value.begin, value.len), &int_value);
|
| + return int_value != 0;
|
| + }
|
| + }
|
| + return false;
|
| +}
|
| +
|
| bool IsOrganic(const std::string& brand) {
|
| const CommandLine& command_line = *CommandLine::ForCurrentProcess();
|
| if (command_line.HasSwitch(switches::kOrganicInstall))
|
|
|