Chromium Code Reviews| 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..8c840fa9259393cf0d7103f265974cb272b60bb8 100644 |
| --- a/chrome/browser/ui/webui/browsing_history_handler.cc |
| +++ b/chrome/browser/ui/webui/browsing_history_handler.cc |
| @@ -235,9 +235,12 @@ scoped_ptr<base::DictionaryValue> BrowsingHistoryHandler::HistoryEntry::ToValue( |
| result->SetString("dateShort", base::TimeFormatShortDate(time)); |
| // 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); |
| + result->SetString("dateRelativeDay", ""); |
| + result->SetString("dateTimeOfDay", ""); |
|
Dan Beam
2016/01/27 03:07:31
general nit: std::string() is preferred over "" fo
yingran
2016/01/27 05:05:04
Done.
|
| } else { |
| base::Time midnight = base::Time::Now().LocalMidnight(); |
| base::string16 date_str = ui::TimeFormat::RelativeDate(time, &midnight); |
| @@ -251,8 +254,11 @@ scoped_ptr<base::DictionaryValue> BrowsingHistoryHandler::HistoryEntry::ToValue( |
| } |
| result->SetString("dateRelativeDay", date_str); |
| result->SetString("dateTimeOfDay", base::TimeFormatTimeOfDay(time)); |
| + result->SetString("snippet", ""); |
| } |
|
Dan Beam
2016/01/27 03:07:31
this seems like a slightly better overall pattern
yingran
2016/01/27 05:05:04
Done.
|
| result->SetBoolean("starred", bookmark_model->IsBookmarked(url)); |
| + result->SetInteger("hostFilteringBehavior", -1); |
| + result->SetBoolean("blockedVisit", false); |
| std::string device_name; |
| std::string device_type; |
| @@ -366,6 +372,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 +389,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); |
| } |
| } |