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

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: Fixed ifdef comments 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..0861971d2e6f598fc91e79de16655056bd774c90 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;
Peter Kasting 2013/03/04 23:01:18 Nit: If you change this as follows: // On deskt
Yusuf 2013/03/04 23:09:37 What I understood from Rohit's comment above was t
rohitrao (ping after 24h) 2013/03/04 23:16:35 Peter was suggesting changing this method to read:
Yusuf 2013/03/04 23:36:36 Oh, OK. Got it now. Fixed in latest patch. On 20
+#endif // defined(OS_IOS) || defined(OS_ANDROID)
}
// 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))
Peter Kasting 2013/03/04 23:01:18 You didn't answer my previous question about wheth
rohitrao (ping after 24h) 2013/03/04 23:16:35 I don't want to use switches::kEnableInstantExtend
Peter Kasting 2013/03/05 00:19:45 What other code does it trigger? I assumed everyo
rohitrao (ping after 24h) 2013/03/05 00:29:41 IsInstantExtendedAPIEnabled() triggers things like
Peter Kasting 2013/03/05 00:35:31 Yeah, I'm not asking IsIntantExtendedAPIEnabled()
Yusuf 2013/03/05 05:57:24 Uploaded a patch that removed kEnableQueryExtracti
+ 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,12 +276,12 @@ void EnableInstantExtendedAPIForTesting() {
}
void EnableQueryExtractionForTesting() {
-#if defined(OS_IOS)
+#if defined(OS_IOS) || defined(OS_ANDROID)
CommandLine* cl = CommandLine::ForCurrentProcess();
cl->AppendSwitch(switches::kEnableQueryExtraction);
#else
EnableInstantExtendedAPIForTesting();
-#endif
+#endif // defined(OS_IOS) || defined(OS_ANDROID)
}
bool ShouldAssignURLToInstantRendererImpl(const GURL& url,
« 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