| 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..b25d9a28beef409b44b42f28cfb02b6e44fffbd0 100644
|
| --- a/chrome/browser/google/google_util.cc
|
| +++ b/chrome/browser/google/google_util.cc
|
| @@ -18,6 +18,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 +204,26 @@ 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.substr(key.begin, key.len) == embedded_search_key) {
|
| + return value.is_nonempty() && url.substr(value.begin, value.len) != "0";
|
| + }
|
| + }
|
| + return false;
|
| +}
|
| +
|
| bool IsOrganic(const std::string& brand) {
|
| const CommandLine& command_line = *CommandLine::ForCurrentProcess();
|
| if (command_line.HasSwitch(switches::kOrganicInstall))
|
|
|