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

Unified Diff: chrome/browser/history/web_history_service.cc

Issue 12930011: History: Include search term in queries to history server. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Saved by dbeam. Created 7 years, 9 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 | « no previous file | chrome/browser/ui/webui/history_ui.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/history/web_history_service.cc
diff --git a/chrome/browser/history/web_history_service.cc b/chrome/browser/history/web_history_service.cc
index 4ef92322266af4150b8fa30503380ea2725f36f5..91f102174180cee369cc544a2d441a61d5dec847 100644
--- a/chrome/browser/history/web_history_service.cc
+++ b/chrome/browser/history/web_history_service.cc
@@ -8,6 +8,7 @@
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "base/strings/string_number_conversions.h"
+#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/signin/oauth2_token_service.h"
#include "chrome/browser/signin/oauth2_token_service_factory.h"
@@ -177,7 +178,8 @@ std::string ServerTimeString(base::Time time) {
// Returns a URL for querying the history server for a query specified by
// |options|.
-std::string GetQueryUrl(const QueryOptions& options) {
+std::string GetQueryUrl(const string16& text_query,
+ const QueryOptions& options) {
GURL url = GURL(kHistoryQueryHistoryUrl);
url = net::AppendQueryParameter(url, "titles", "1");
@@ -199,6 +201,9 @@ std::string GetQueryUrl(const QueryOptions& options) {
url, "num", base::IntToString(options.max_count));
}
+ if (!text_query.empty())
+ url = net::AppendQueryParameter(url, "q", UTF16ToUTF8(text_query));
+
return url.spec();
}
@@ -241,8 +246,9 @@ scoped_ptr<WebHistoryService::Request> WebHistoryService::QueryHistory(
RequestImpl::CompletionCallback completion_callback = base::Bind(
&QueryHistoryCompletionCallback, callback);
+ std::string url = GetQueryUrl(text_query, options);
Dan Beam 2013/03/25 21:48:55 nit: this could probably be const[-ref]
scoped_ptr<RequestImpl> request(
- new RequestImpl(profile_, GetQueryUrl(options), completion_callback));
+ new RequestImpl(profile_, url, completion_callback));
request->Start();
return request.PassAs<Request>();
}
« no previous file with comments | « no previous file | chrome/browser/ui/webui/history_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698