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

Unified Diff: chrome/browser/ui/webui/history_ui.cc

Issue 10392084: WIP for integration between Chrome and Google Web History. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More work. Created 8 years, 7 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/ui/webui/history_ui.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/history_ui.cc
diff --git a/chrome/browser/ui/webui/history_ui.cc b/chrome/browser/ui/webui/history_ui.cc
index 5c6adce921c49ea5b42bc53456abbd809e613aa6..f3d82964c21f44b1a315b9a6844f8b75f2aac357 100644
--- a/chrome/browser/ui/webui/history_ui.cc
+++ b/chrome/browser/ui/webui/history_ui.cc
@@ -22,6 +22,7 @@
#include "chrome/browser/bookmarks/bookmark_utils.h"
#include "chrome/browser/history/history_notifications.h"
#include "chrome/browser/history/history_types.h"
+#include "chrome/browser/history/web_history_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
@@ -184,9 +185,6 @@ void BrowsingHistoryHandler::RegisterMessages() {
}
void BrowsingHistoryHandler::HandleGetHistory(const ListValue* args) {
- // Anything in-flight is invalid.
- cancelable_search_consumer_.CancelAllRequests();
-
// Get arguments (if any).
int day = 0;
bool res = ExtractIntegerValue(args, &day);
@@ -199,22 +197,10 @@ void BrowsingHistoryHandler::HandleGetHistory(const ListValue* args) {
options.end_time = base::Time::Now().LocalMidnight();
options.end_time -= base::TimeDelta::FromDays(day - 1);
- // Need to remember the query string for our results.
- search_text_ = string16();
-
- HistoryService* hs =
- Profile::FromWebUI(web_ui())->GetHistoryService(Profile::EXPLICIT_ACCESS);
- hs->QueryHistory(search_text_,
- options,
- &cancelable_search_consumer_,
- base::Bind(&BrowsingHistoryHandler::QueryComplete,
- base::Unretained(this)));
+ QueryHistory(string16(), options);
}
void BrowsingHistoryHandler::HandleSearchHistory(const ListValue* args) {
- // Anything in-flight is invalid.
- cancelable_search_consumer_.CancelAllRequests();
-
// Get arguments (if any).
int month = 0;
string16 query;
@@ -226,15 +212,37 @@ void BrowsingHistoryHandler::HandleSearchHistory(const ListValue* args) {
// When searching, limit the number of results returned.
options.max_count = kMaxSearchResults;
+ QueryHistory(query, options);
+}
+
+void BrowsingHistoryHandler::QueryHistory(const string16& text_query,
+ const history::QueryOptions& options) {
+ Profile* profile = Profile::FromWebUI(web_ui());
+
+ // Anything in-flight is invalid.
+ cancelable_search_consumer_.CancelAllRequests();
+
// Need to remember the query string for our results.
- search_text_ = query;
- HistoryService* hs =
- Profile::FromWebUI(web_ui())->GetHistoryService(Profile::EXPLICIT_ACCESS);
+ search_text_ = text_query;
+
+ HistoryService* hs = profile->GetHistoryService(Profile::EXPLICIT_ACCESS);
hs->QueryHistory(search_text_,
options,
&cancelable_search_consumer_,
base::Bind(&BrowsingHistoryHandler::QueryComplete,
base::Unretained(this)));
+
+ // TODO(dubroy): Should this be moved into the History Service?
+ history::WebHistoryService* web_history =
+ history::WebHistoryService::GetForProfile(profile);
+ if (web_history) {
+ web_history->QueryHistory(
+ search_text_,
+ options,
+ &cancelable_search_consumer_,
+ base::Bind(&BrowsingHistoryHandler::WebHistoryQueryComplete,
+ base::Unretained(this))); // FIXME: Probably need a weak ptr here.
+ }
}
void BrowsingHistoryHandler::HandleRemoveURLsOnOneDay(const ListValue* args) {
@@ -354,6 +362,10 @@ void BrowsingHistoryHandler::QueryComplete(
web_ui()->CallJavascriptFunction("historyResult", info_value, results_value);
}
+void BrowsingHistoryHandler::WebHistoryQueryComplete() {
+ LOG(WARNING) << "WebHistoryQueryComplete!";
+}
+
void BrowsingHistoryHandler::RemoveComplete() {
urls_to_be_deleted_.clear();
« no previous file with comments | « chrome/browser/ui/webui/history_ui.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698