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

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

Issue 1838333004: Add a notice about other forms of browsing history to the History WebUI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@desktop-ui-after-rebase
Patch Set: Rebase. Created 4 years, 8 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/browsing_history_handler.h ('k') | chrome/browser/ui/webui/history_ui.cc » ('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 504688715e8859a00fa74eaaf746fa1431ee9a9b..c229f418e17fd4783244829321d4e555d06ef6c3 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"
@@ -310,6 +311,8 @@ bool BrowsingHistoryHandler::HistoryEntry::SortByTimeDescending(
BrowsingHistoryHandler::BrowsingHistoryHandler()
: has_pending_delete_request_(false),
history_service_observer_(this),
+ has_synced_results_(false),
+ has_other_forms_of_browsing_history_(false),
weak_factory_(this) {
}
@@ -388,6 +391,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 +423,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 +703,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 +846,21 @@ void BrowsingHistoryHandler::WebHistoryQueryComplete(
}
}
}
- results_info_value_.SetBoolean("hasSyncedResults", results_value != NULL);
+ has_synced_results_ = results_value != nullptr;
+ results_info_value_.SetBoolean("hasSyncedResults", has_synced_results_);
if (!query_task_tracker_.HasTrackedTasks())
ReturnResultsToFrontEnd();
}
+void BrowsingHistoryHandler::OtherFormsOfBrowsingHistoryQueryComplete(
+ bool found_other_forms_of_browsing_history) {
+ has_other_forms_of_browsing_history_ = found_other_forms_of_browsing_history;
+ 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();
« no previous file with comments | « chrome/browser/ui/webui/browsing_history_handler.h ('k') | chrome/browser/ui/webui/history_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698