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

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

Issue 1574063003: MD History: Add basic material design history cards and history items (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: PLS Created 4 years, 11 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/resources/md_history/history_item.js ('k') | ui/webui/resources/js/cr/ui/position_util.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/browsing_history_handler.cc
diff --git a/chrome/browser/ui/webui/browsing_history_handler.cc b/chrome/browser/ui/webui/browsing_history_handler.cc
index fbcdc981cd8b46c3676f316b8d8ec66d234b545e..9747f162515802805283d16a4bbd6901426cd5dc 100644
--- a/chrome/browser/ui/webui/browsing_history_handler.cc
+++ b/chrome/browser/ui/webui/browsing_history_handler.cc
@@ -234,10 +234,17 @@ scoped_ptr<base::DictionaryValue> BrowsingHistoryHandler::HistoryEntry::ToValue(
// the monthly view.
result->SetString("dateShort", base::TimeFormatShortDate(time));
+ base::string16 snippet_string;
+ base::string16 date_relative_day;
+ base::string16 date_time_of_day;
+ bool is_blocked_visit = false;
+ int host_filtering_behavior = -1;
+
// Only pass in the strings we need (search results need a shortdate
- // and snippet, browse results need day and time information).
+ // and snippet, browse results need day and time information). Makes sure that
+ // values of result are never undefined
if (is_search_result) {
- result->SetString("snippet", snippet);
+ snippet_string = snippet;
} else {
base::Time midnight = base::Time::Now().LocalMidnight();
base::string16 date_str = ui::TimeFormat::RelativeDate(time, &midnight);
@@ -249,10 +256,9 @@ scoped_ptr<base::DictionaryValue> BrowsingHistoryHandler::HistoryEntry::ToValue(
date_str,
base::TimeFormatFriendlyDate(time));
}
- result->SetString("dateRelativeDay", date_str);
- result->SetString("dateTimeOfDay", base::TimeFormatTimeOfDay(time));
+ date_relative_day = date_str;
+ date_time_of_day = base::TimeFormatTimeOfDay(time);
}
- result->SetBoolean("starred", bookmark_model->IsBookmarked(url));
std::string device_name;
std::string device_type;
@@ -267,12 +273,18 @@ scoped_ptr<base::DictionaryValue> BrowsingHistoryHandler::HistoryEntry::ToValue(
supervised_user_service->GetURLFilterForUIThread();
int filtering_behavior =
url_filter->GetFilteringBehaviorForURL(url.GetWithEmptyPath());
- result->SetInteger("hostFilteringBehavior", filtering_behavior);
-
- result->SetBoolean("blockedVisit", blocked_visit);
+ is_blocked_visit = blocked_visit;
+ host_filtering_behavior = filtering_behavior;
}
#endif
+ result->SetString("dateTimeOfDay", date_time_of_day);
+ result->SetString("dateRelativeDay", date_relative_day);
+ result->SetString("snippet", snippet_string);
+ result->SetBoolean("starred", bookmark_model->IsBookmarked(url));
+ result->SetInteger("hostFilteringBehavior", host_filtering_behavior);
+ result->SetBoolean("blockedVisit", is_blocked_visit);
+
return result;
}
@@ -366,6 +378,10 @@ void BrowsingHistoryHandler::QueryHistory(
history::WebHistoryService* web_history =
WebHistoryServiceFactory::GetForProfile(profile);
+
+ // Set this to false until the results actually arrive.
+ results_info_value_.SetBoolean("hasSyncedResults", false);
+
if (web_history) {
web_history_query_results_.clear();
web_history_request_ = web_history->QueryHistory(
@@ -379,9 +395,6 @@ void BrowsingHistoryHandler::QueryHistory(
web_history_timer_.Start(
FROM_HERE, base::TimeDelta::FromSeconds(kWebHistoryTimeoutSeconds),
this, &BrowsingHistoryHandler::WebHistoryTimeout);
-
- // Set this to false until the results actually arrive.
- results_info_value_.SetBoolean("hasSyncedResults", false);
}
}
« no previous file with comments | « chrome/browser/resources/md_history/history_item.js ('k') | ui/webui/resources/js/cr/ui/position_util.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698