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

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

Issue 11876045: [Search] Store and recall search terms using NavigationEntry to improve search term extraction (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: const Created 7 years, 11 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
Index: chrome/browser/ui/search/search.cc
diff --git a/chrome/browser/ui/search/search.cc b/chrome/browser/ui/search/search.cc
index 796edb4ee64bf23013c73c455ea65b7d8c84b63d..4d89dbcba763bcd665cccc74694d32b29234d329 100644
--- a/chrome/browser/ui/search/search.cc
+++ b/chrome/browser/ui/search/search.cc
@@ -6,12 +6,14 @@
#include "base/command_line.h"
#include "base/metrics/field_trial.h"
+#include "base/string16.h"
sreeram 2013/01/30 21:41:39 Nit: No need for this (since it's already included
Mathieu 2013/01/30 21:55:12 Done.
#include "base/string_number_conversions.h"
#include "base/string_split.h"
#include "base/string_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/chrome_version_info.h"
+#include "content/public/browser/navigation_entry.h"
#if !defined(OS_ANDROID)
#include "chrome/browser/themes/theme_service.h"
@@ -46,6 +48,9 @@ const char kDisablingSuffix[] = "DISABLED";
namespace chrome {
namespace search {
+// static
+const char kInstantExtendedSearchTermsKey[] = "search_terms";
+
// Check whether or not the Extended API should be used on the given profile.
bool IsInstantExtendedAPIEnabled(Profile* profile) {
return EmbeddedSearchPageVersion(profile) != 0;
@@ -139,6 +144,16 @@ void EnableQueryExtractionForTesting() {
#endif
}
+string16 GetSearchTermsFromNavigationEntry(
+ const content::NavigationEntry* entry) {
+ string16 out_value;
+ if (entry->GetExtraData(
+ std::string(kInstantExtendedSearchTermsKey),
+ &out_value))
+ return out_value;
+ return string16();
sreeram 2013/01/30 21:41:39 Nit: If you rewrite this as the following, it will
Mathieu 2013/01/30 21:55:12 Done.
+}
+
bool IsForcedInstantURL(const GURL& url) {
CommandLine* command_line = CommandLine::ForCurrentProcess();
if (!command_line->HasSwitch(switches::kInstantURL))

Powered by Google App Engine
This is Rietveld 408576698