| 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();
|
|
|
|
|