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

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

Issue 1143183002: Proof of concept implementation of context based history filtering. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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') | components/history/core/browser/history_backend.h » ('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 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(),
« no previous file with comments | « chrome/browser/ui/webui/history_ui.h ('k') | components/history/core/browser/history_backend.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698