summaryrefslogtreecommitdiffstats
path: root/chrome/browser/dom_ui
diff options
context:
space:
mode:
authorglen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-11 01:24:08 +0000
committerglen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-11 01:24:08 +0000
commit153c6986284b7fc39fe5a875e0df5c8f29120957 (patch)
tree6f891ff5bbf3f2029d8c8a011d8916de6f2bfe1f /chrome/browser/dom_ui
parent193e1cdbcaac17d0fac6093f9bd63cd5477e4325 (diff)
downloadchromium_src-153c6986284b7fc39fe5a875e0df5c8f29120957.zip
chromium_src-153c6986284b7fc39fe5a875e0df5c8f29120957.tar.gz
chromium_src-153c6986284b7fc39fe5a875e0df5c8f29120957.tar.bz2
Stop history search going on beyond the start of history.
Stop losing first-searches on history page due to BUG=8438,8456 Review URL: http://codereview.chromium.org/43054 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11411 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/dom_ui')
-rw-r--r--chrome/browser/dom_ui/dom_ui_contents.cc2
-rw-r--r--chrome/browser/dom_ui/history_ui.cc26
-rw-r--r--chrome/browser/dom_ui/history_ui.h2
3 files changed, 20 insertions, 10 deletions
diff --git a/chrome/browser/dom_ui/dom_ui_contents.cc b/chrome/browser/dom_ui/dom_ui_contents.cc
index cad2dd4..9d80db3 100644
--- a/chrome/browser/dom_ui/dom_ui_contents.cc
+++ b/chrome/browser/dom_ui/dom_ui_contents.cc
@@ -246,7 +246,7 @@ bool DOMUIContents::InitCurrentUI(bool reload) {
if (url.is_empty() || !url.is_valid())
return false;
- if (reload || url != current_url_) {
+ if (reload || url.host() != current_url_.host()) {
// Shut down our existing DOMUI.
delete current_ui_;
current_ui_ = NULL;
diff --git a/chrome/browser/dom_ui/history_ui.cc b/chrome/browser/dom_ui/history_ui.cc
index 6e09592..8bc2013 100644
--- a/chrome/browser/dom_ui/history_ui.cc
+++ b/chrome/browser/dom_ui/history_ui.cc
@@ -76,6 +76,10 @@ void HistoryUIHTMLSource::StartDataRequest(const std::string& path,
localized_strings.SetString(L"deletedaywarning",
l10n_util::GetString(IDS_HISTORY_DELETE_PRIOR_VISITS_WARNING));
+ localized_strings.SetString(L"textdirection",
+ (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) ?
+ L"rtl" : L"ltr");
+
static const StringPiece history_html(
ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_HISTORY_HTML));
@@ -101,9 +105,9 @@ BrowsingHistoryHandler::BrowsingHistoryHandler(DOMUI* dom_ui)
dom_ui_->RegisterMessageCallback("getHistory",
NewCallback(this, &BrowsingHistoryHandler::HandleGetHistory));
dom_ui_->RegisterMessageCallback("searchHistory",
- NewCallback(this, &BrowsingHistoryHandler::HandleSearchHistory));
+ NewCallback(this, &BrowsingHistoryHandler::HandleSearchHistory));
dom_ui_->RegisterMessageCallback("deleteDay",
- NewCallback(this, &BrowsingHistoryHandler::HandleDeleteDay));
+ NewCallback(this, &BrowsingHistoryHandler::HandleDeleteDay));
// Create our favicon data source.
g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE,
@@ -143,6 +147,9 @@ void BrowsingHistoryHandler::HandleGetHistory(const Value* value) {
options.end_time = Time::Now().LocalMidnight();
options.end_time -= TimeDelta::FromDays(day - 1);
+ // As we're querying per-day, we can turn entry repeats off.
+ options.most_recent_visit_only = true;
+
// Need to remember the query string for our results.
search_text_ = std::wstring();
@@ -259,8 +266,11 @@ void BrowsingHistoryHandler::QueryComplete(
results_value.Append(page_value);
}
- StringValue temp(search_text_);
- dom_ui_->CallJavascriptFunction(L"historyResult", temp, results_value);
+ DictionaryValue info_value;
+ info_value.SetString(L"term", search_text_);
+ info_value.SetBoolean(L"finished", results->reached_beginning());
+
+ dom_ui_->CallJavascriptFunction(L"historyResult", info_value, results_value);
}
void BrowsingHistoryHandler::ExtractSearchHistoryArguments(const Value* value,
@@ -342,8 +352,8 @@ void BrowsingHistoryHandler::Observe(NotificationType type,
return;
}
- // Some URLs were deleted from history. Reload the most visited list.
- HandleGetHistory(NULL);
+ // Some URLs were deleted from history. Reload the list.
+ dom_ui_->CallJavascriptFunction(L"historyDeleted");
}
////////////////////////////////////////////////////////////////////////////////
@@ -377,7 +387,7 @@ GURL HistoryUI::GetBaseURL() {
// static
const GURL HistoryUI::GetHistoryURLWithSearchText(
- const std::wstring& text) {
- return GURL(GetBaseURL().spec() + "#q=" +
+ const std::wstring& text) {
+ return GURL(GetBaseURL().spec() + "#q=" +
EscapeQueryParamValue(WideToUTF8(text)));
}
diff --git a/chrome/browser/dom_ui/history_ui.h b/chrome/browser/dom_ui/history_ui.h
index 38ccc3a..3bc550e 100644
--- a/chrome/browser/dom_ui/history_ui.h
+++ b/chrome/browser/dom_ui/history_ui.h
@@ -74,7 +74,7 @@ class BrowsingHistoryHandler : public DOMMessageHandler,
scoped_ptr<BrowsingDataRemover> remover_;
// Our consumer for the history service.
- CancelableRequestConsumerTSimple<PageUsageData*> cancelable_consumer_;
+ CancelableRequestConsumerT<int, 0> cancelable_consumer_;
DISALLOW_COPY_AND_ASSIGN(BrowsingHistoryHandler);
};