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

Unified Diff: chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.h

Issue 1912483003: Expand the footer in the material design Clear Browsing Data dialog. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix the test. 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
Index: chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.h
diff --git a/chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.h b/chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.h
index 905909473dd33d7ec6731efd8435a7661ef27fd2..fa5520c580673682280431dd2569c5fc6da2e958 100644
--- a/chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.h
+++ b/chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.h
@@ -10,6 +10,7 @@
#include "chrome/browser/browsing_data/browsing_data_remover.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
+#include "components/browser_sync/browser/profile_sync_service.h"
#include "components/prefs/pref_member.h"
namespace base {
@@ -24,12 +25,13 @@ namespace settings {
// Chrome browser startup settings handler.
class ClearBrowsingDataHandler : public SettingsPageUIHandler,
- public BrowsingDataRemover::Observer {
+ public BrowsingDataRemover::Observer,
+ public sync_driver::SyncServiceObserver {
public:
explicit ClearBrowsingDataHandler(content::WebUI* webui);
~ClearBrowsingDataHandler() override;
- // OptionsPageUIHandler:
+ // WebUIMessageHandler implementation.
void RegisterMessages() override;
private:
@@ -43,6 +45,25 @@ class ClearBrowsingDataHandler : public SettingsPageUIHandler,
// Updates UI when the pref to allow clearing history changes.
virtual void OnBrowsingHistoryPrefChanged();
+ // Initializes the footer of the dialog. Called by JavaScript when the DOM
+ // is attached.
+ void InitializeFooter(const base::ListValue* args);
+
+ // Implementation of SyncServiceObserver. Updates the footer of the dialog
+ // when the sync state changes.
+ void OnStateChanged() override;
+
+ // Finds out whether we should show notice about other forms of history stored
+ // in user's account.
+ void RefreshHistoryNotice();
+
+ // Called as an asynchronous response to |RefreshHistoryNotice()|. Shows or
+ // hides the footer about other forms of history stored in user's account.
+ void UpdateHistoryNotice(bool show);
+
+ // ProfileSyncService to observe sync state changes.
+ ProfileSyncService* sync_service_;
+
// If non-null it means removal is in progress.
BrowsingDataRemover* remover_;
@@ -60,6 +81,14 @@ class ClearBrowsingDataHandler : public SettingsPageUIHandler,
// Keeps track of whether deleting browsing history and downloads is allowed.
BooleanPrefMember allow_deleting_browser_history_;
+ // Whether the sentence about other forms of history stored in user's account
+ // should be displayed in the footer. This value is retrieved asynchronously,
+ // so we cache it here.
+ bool should_show_history_footer_;
+
+ // A weak pointer factory for asynchronous calls referencing this class.
+ base::WeakPtrFactory<ClearBrowsingDataHandler> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(ClearBrowsingDataHandler);
};

Powered by Google App Engine
This is Rietveld 408576698