| 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 ca2612eddfc0255c19faed4466596e0d9df77fb0..59cdf38ab1ebcb30a793737a475db727480466de 100644
|
| --- a/chrome/browser/ui/webui/history_ui.cc
|
| +++ b/chrome/browser/ui/webui/history_ui.cc
|
| @@ -136,6 +136,7 @@ content::WebUIDataSource* CreateHistoryUIHTMLSource(Profile* profile) {
|
| source->AddLocalizedString("xMore", IDS_OTHER_DEVICES_X_MORE);
|
| source->AddLocalizedString("loading", IDS_HISTORY_LOADING);
|
| source->AddLocalizedString("title", IDS_HISTORY_TITLE);
|
| + source->AddLocalizedString("context", IDS_HISTORY_CONTEXT);
|
| source->AddLocalizedString("newest", IDS_HISTORY_NEWEST);
|
| source->AddLocalizedString("newer", IDS_HISTORY_NEWER);
|
| source->AddLocalizedString("older", IDS_HISTORY_OLDER);
|
| @@ -292,13 +293,14 @@ void GetDeviceNameAndType(const ProfileSyncService* sync_service,
|
|
|
| BrowsingHistoryHandler::HistoryEntry::HistoryEntry(
|
| BrowsingHistoryHandler::HistoryEntry::EntryType entry_type,
|
| - const GURL& url, const base::string16& title, base::Time time,
|
| + const GURL& url, const base::string16& title, history::HistoryContext context, base::Time time,
|
| const std::string& client_id, bool is_search_result,
|
| const base::string16& snippet, bool blocked_visit,
|
| const std::string& accept_languages) {
|
| this->entry_type = entry_type;
|
| this->url = url;
|
| this->title = title;
|
| + this->context = context;
|
| this->time = time;
|
| this->client_id = client_id;
|
| all_timestamps.insert(time.ToInternalValue());
|
| @@ -318,6 +320,7 @@ BrowsingHistoryHandler::HistoryEntry::~HistoryEntry() {
|
| void BrowsingHistoryHandler::HistoryEntry::SetUrlAndTitle(
|
| base::DictionaryValue* result) const {
|
| result->SetString("url", url.spec());
|
| + result->SetInteger("context", static_cast<int>(context));
|
|
|
| bool using_url_as_the_title = false;
|
| base::string16 title_to_set(title);
|
| @@ -558,13 +561,21 @@ void BrowsingHistoryHandler::HandleQueryHistory(const base::ListValue* args) {
|
| }
|
| if (end_time)
|
| options.end_time = base::Time::FromJsTime(end_time);
|
| -
|
| - if (!ExtractIntegerValueAtIndex(args, 4, &options.max_count)) {
|
| + int context;
|
| + if (!ExtractIntegerValueAtIndex(args, 4, &context)) {
|
| NOTREACHED() << "Failed to convert argument 4.";
|
| return;
|
| }
|
| + if (context)
|
| + options.context = static_cast<history::HistoryContext>(context);
|
| +
|
| + if (!ExtractIntegerValueAtIndex(args, 5, &options.max_count)) {
|
| + NOTREACHED() << "Failed to convert argument 5.";
|
| + return;
|
| + }
|
|
|
| options.duplicate_policy = history::QueryOptions::REMOVE_DUPLICATES_PER_DAY;
|
| +
|
| QueryHistory(search_text, options);
|
| }
|
|
|
| @@ -806,11 +817,13 @@ void BrowsingHistoryHandler::QueryComplete(
|
| for (size_t i = 0; i < results->size(); ++i) {
|
| history::URLResult const &page = (*results)[i];
|
| // TODO(dubroy): Use sane time (crbug.com/146090) here when it's ready.
|
| + printf("\npage.context() %d %s\n", page.context(), page.url().spec().c_str());
|
| query_results_.push_back(
|
| HistoryEntry(
|
| HistoryEntry::LOCAL_ENTRY,
|
| page.url(),
|
| page.title(),
|
| + page.context(),
|
| page.visit_time(),
|
| std::string(),
|
| !search_text.empty(),
|
| @@ -914,6 +927,7 @@ void BrowsingHistoryHandler::WebHistoryQueryComplete(
|
| HistoryEntry::REMOTE_ENTRY,
|
| GURL(url),
|
| title,
|
| + history::HistoryContext::CONTEXT_NONE,
|
| time,
|
| client_id,
|
| !search_text.empty(),
|
|
|