Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4202)

Unified Diff: chrome/browser/ui/search/search.cc

Issue 12319124: Enable query extraction for Android (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added ifdefs back and made IsExtendedInstantEnabled clearer Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/android/chrome_startup_flags.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/search/search.cc
diff --git a/chrome/browser/ui/search/search.cc b/chrome/browser/ui/search/search.cc
index e6d79bd0b396f29bd7fe61063768d7ef381625c2..0307227831eeeb8088611fb5bd9a3691ebddda1e 100644
--- a/chrome/browser/ui/search/search.cc
+++ b/chrome/browser/ui/search/search.cc
@@ -29,7 +29,12 @@ namespace {
// The first token is always GroupN for some integer N, followed by a
// space-delimited list of key:value pairs which correspond to these flags:
const char kEmbeddedPageVersionFlagName[] = "espv";
+
+#if defined(OS_IOS) || defined(OS_ANDROID)
+const int kEmbeddedPageVersionDefault = 1;
+#else
const int kEmbeddedPageVersionDefault = 2;
+#endif
const char kInstantExtendedActivationName[] = "instant";
const chrome::search::InstantExtendedDefault kInstantExtendedActivationDefault =
@@ -138,12 +143,21 @@ InstantExtendedDefault GetInstantExtendedDefaultSetting() {
}
bool IsInstantExtendedAPIEnabled(const Profile* profile) {
+#if defined(OS_IOS) || defined(OS_ANDROID)
+ return false;
+#else
return EmbeddedSearchPageVersion(profile) != 0;
+#endif // defined(OS_IOS) || defined(OS_ANDROID)
sreeram 2013/03/02 00:16:18 Nit: I meant two spaces _before_ the "//", not aft
Yusuf 2013/03/02 00:26:29 :) Sorry about that.Fixed now. On 2013/03/02 00:1
}
// Determine what embedded search page version to request from the user's
// default search provider. If 0, the embedded search UI should not be enabled.
uint64 EmbeddedSearchPageVersion(const Profile* profile) {
+#if defined(OS_IOS) || defined(OS_ANDROID)
+ const CommandLine* cl = CommandLine::ForCurrentProcess();
+ if (cl->HasSwitch(switches::kEnableQueryExtraction))
+ return kEmbeddedPageVersionDefault;
+#else
if (!profile || profile->IsOffTheRecord())
return 0;
@@ -162,19 +176,19 @@ uint64 EmbeddedSearchPageVersion(const Profile* profile) {
// UI version.
return kEmbeddedPageVersionDefault;
}
-
+#endif // defined(OS_IOS) || defined(OS_ANDROID)
return 0;
}
bool IsQueryExtractionEnabled(const Profile* profile) {
-#if defined(OS_IOS)
+#if defined(OS_IOS) || defined(OS_ANDROID)
const CommandLine* cl = CommandLine::ForCurrentProcess();
return cl->HasSwitch(switches::kEnableQueryExtraction);
#else
// On desktop, query extraction is controlled by the instant-extended-api
// flag.
return IsInstantExtendedAPIEnabled(profile);
-#endif
+#endif // defined(OS_IOS) || defined(OS_ANDROID)
}
string16 GetSearchTermsFromNavigationEntry(
@@ -262,7 +276,7 @@ void EnableInstantExtendedAPIForTesting() {
}
void EnableQueryExtractionForTesting() {
-#if defined(OS_IOS)
+#if defined(OS_IOS) || defined(OS_ANDROID)
CommandLine* cl = CommandLine::ForCurrentProcess();
cl->AppendSwitch(switches::kEnableQueryExtraction);
#else
« no previous file with comments | « chrome/browser/android/chrome_startup_flags.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698