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 504688715e8859a00fa74eaaf746fa1431ee9a9b..8c290ed246ad6ab1f71f44b84696a261d92a8788 100644 |
| --- a/chrome/browser/ui/webui/browsing_history_handler.cc |
| +++ b/chrome/browser/ui/webui/browsing_history_handler.cc |
| @@ -37,6 +37,7 @@ |
| #include "components/bookmarks/browser/bookmark_model.h" |
| #include "components/bookmarks/browser/bookmark_utils.h" |
| #include "components/browser_sync/browser/profile_sync_service.h" |
| +#include "components/browsing_data_ui/history_notice_utils.h" |
| #include "components/favicon/core/fallback_icon_service.h" |
| #include "components/favicon/core/fallback_url_util.h" |
| #include "components/favicon/core/large_icon_service.h" |
| @@ -388,6 +389,8 @@ void BrowsingHistoryHandler::QueryHistory( |
| query_results_.clear(); |
| results_info_value_.Clear(); |
| + has_synced_results_ = false; |
| + has_other_forms_of_browsing_history_ = false; |
| history::HistoryService* hs = HistoryServiceFactory::GetForProfile( |
| profile, ServiceAccessType::EXPLICIT_ACCESS); |
| @@ -418,6 +421,14 @@ void BrowsingHistoryHandler::QueryHistory( |
| web_history_timer_.Start( |
| FROM_HERE, base::TimeDelta::FromSeconds(kWebHistoryTimeoutSeconds), |
| this, &BrowsingHistoryHandler::WebHistoryTimeout); |
| + |
| + // Test the existence of other forms of browsing history. |
| + browsing_data_ui::ShouldShowNoticeAboutOtherFormsOfBrowsingHistory( |
| + ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile), |
| + web_history, |
| + base::Bind( |
| + &BrowsingHistoryHandler::OtherFormsOfBrowsingHistoryQueryComplete, |
| + weak_factory_.GetWeakPtr())); |
| } |
| } |
| @@ -690,6 +701,10 @@ void BrowsingHistoryHandler::ReturnResultsToFrontEnd() { |
| web_ui()->CallJavascriptFunction( |
| "historyResult", results_info_value_, results_value); |
| + web_ui()->CallJavascriptFunction( |
| + "showNotification", |
| + base::FundamentalValue(has_synced_results_), |
| + base::FundamentalValue(has_other_forms_of_browsing_history_)); |
| results_info_value_.Clear(); |
| query_results_.clear(); |
| web_history_query_results_.clear(); |
| @@ -829,11 +844,21 @@ void BrowsingHistoryHandler::WebHistoryQueryComplete( |
| } |
| } |
| } |
| - results_info_value_.SetBoolean("hasSyncedResults", results_value != NULL); |
| + has_synced_results_ = (results_value != NULL); |
|
Dan Beam
2016/03/31 01:05:44
nit: nullptr
Dan Beam
2016/03/31 01:05:44
nit: remove extra parens
msramek
2016/03/31 19:20:01
Done.
msramek
2016/03/31 19:20:02
Done.
|
| + results_info_value_.SetBoolean("hasSyncedResults", has_synced_results_); |
| if (!query_task_tracker_.HasTrackedTasks()) |
| ReturnResultsToFrontEnd(); |
| } |
| +void BrowsingHistoryHandler::OtherFormsOfBrowsingHistoryQueryComplete( |
| + bool foundOtherFormsOfBrowsingHistory) { |
| + has_other_forms_of_browsing_history_ = foundOtherFormsOfBrowsingHistory; |
| + web_ui()->CallJavascriptFunction( |
| + "showNotification", |
| + base::FundamentalValue(has_synced_results_), |
| + base::FundamentalValue(has_other_forms_of_browsing_history_)); |
| +} |
| + |
| void BrowsingHistoryHandler::RemoveComplete() { |
| urls_to_be_deleted_.clear(); |