diff options
author | glen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-25 17:47:58 +0000 |
---|---|---|
committer | glen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-25 17:47:58 +0000 |
commit | 9e4c033c4f88780c47ebf13ab4b9f180bf63df29 (patch) | |
tree | dcea8183f667edf646f7584064a2ca86af573471 /chrome/browser/dom_ui/history_ui.cc | |
parent | d7e85c5dd9c2c8dfb38d1e7c6aacb1c3bd0bf590 (diff) | |
download | chromium_src-9e4c033c4f88780c47ebf13ab4b9f180bf63df29.zip chromium_src-9e4c033c4f88780c47ebf13ab4b9f180bf63df29.tar.gz chromium_src-9e4c033c4f88780c47ebf13ab4b9f180bf63df29.tar.bz2 |
Enable history and downloads by default, port NewTabUI from DOMUIHost to DOMUI.
NewTabUI is only included on OS(WIN) because DOMUI doesn't appear to have been ported.
Review URL: http://codereview.chromium.org/28104
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10344 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/dom_ui/history_ui.cc')
-rw-r--r-- | chrome/browser/dom_ui/history_ui.cc | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/chrome/browser/dom_ui/history_ui.cc b/chrome/browser/dom_ui/history_ui.cc index c1c0805..fcabc19 100644 --- a/chrome/browser/dom_ui/history_ui.cc +++ b/chrome/browser/dom_ui/history_ui.cc @@ -19,6 +19,8 @@ #include "chrome/common/notification_service.h" #include "chrome/common/resource_bundle.h" #include "chrome/common/time_format.h" +#include "net/base/escape.h" + #include "grit/browser_resources.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" @@ -29,7 +31,7 @@ using base::TimeDelta; // HistoryUI is accessible from chrome-ui://history. static const char kHistoryHost[] = "history"; -// Maximum number of search results to return in a given search. We should +// Maximum number of search results to return in a given search. We should // eventually remove this. static const int kMaxSearchResults = 100; @@ -145,7 +147,7 @@ void BrowsingHistoryHandler::HandleGetHistory(const Value* value) { dom_ui_->get_profile()->GetHistoryService(Profile::EXPLICIT_ACCESS); hs->QueryHistory(search_text_, options, - &cancelable_consumer_, + &cancelable_consumer_, NewCallback(this, &BrowsingHistoryHandler::QueryComplete)); } @@ -172,7 +174,7 @@ void BrowsingHistoryHandler::HandleSearchHistory(const Value* value) { dom_ui_->get_profile()->GetHistoryService(Profile::EXPLICIT_ACCESS); hs->QueryHistory(search_text_, options, - &cancelable_consumer_, + &cancelable_consumer_, NewCallback(this, &BrowsingHistoryHandler::QueryComplete)); } @@ -217,11 +219,11 @@ void BrowsingHistoryHandler::QueryComplete( SetURLAndTitle(page_value, page.title(), page.url()); // Need to pass the time in epoch time (fastest JS conversion). - page_value->SetInteger(L"time", + page_value->SetInteger(L"time", static_cast<int>(page.visit_time().ToTimeT())); // Until we get some JS i18n infrastructure, we also need to - // pass the dates in as strings. This could use some + // pass the dates in as strings. This could use some // optimization. // Only pass in the strings we need (search results need a shortdate @@ -238,10 +240,10 @@ void BrowsingHistoryHandler::QueryComplete( date_str, base::TimeFormatFriendlyDate(page.visit_time())); } page_value->SetString(L"dateRelativeDay", date_str); - page_value->SetString(L"dateTimeOfDay", + page_value->SetString(L"dateTimeOfDay", base::TimeFormatTimeOfDay(page.visit_time())); } else { - page_value->SetString(L"dateShort", + page_value->SetString(L"dateShort", base::TimeFormatShortDate(page.visit_time())); page_value->SetString(L"snippet", page.snippet().text()); } @@ -253,7 +255,7 @@ void BrowsingHistoryHandler::QueryComplete( dom_ui_->CallJavascriptFunction(L"historyResult", temp, results_value); } -void BrowsingHistoryHandler::ExtractSearchHistoryArguments(const Value* value, +void BrowsingHistoryHandler::ExtractSearchHistoryArguments(const Value* value, int* month, std::wstring* query) { *month = 0; @@ -364,3 +366,10 @@ GURL HistoryUI::GetBaseURL() { url += kHistoryHost; return GURL(url); } + +// static +const GURL HistoryUI::GetHistoryURLWithSearchText( + const std::wstring& text) { + return GURL(GetBaseURL().spec() + "/?q=" + + EscapeQueryParamValue(WideToUTF8(text))); +} |