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

Side by Side 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: Rebase. Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_CLEAR_BROWSING_DATA_HANDLER_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_CLEAR_BROWSING_DATA_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_CLEAR_BROWSING_DATA_HANDLER_H_ 6 #define CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_CLEAR_BROWSING_DATA_HANDLER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
10 #include "chrome/browser/browsing_data/browsing_data_remover.h" 10 #include "chrome/browser/browsing_data/browsing_data_remover.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h" 12 #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
13 #include "components/browser_sync/browser/profile_sync_service.h"
13 #include "components/prefs/pref_member.h" 14 #include "components/prefs/pref_member.h"
14 15
15 namespace base { 16 namespace base {
16 class ListValue; 17 class ListValue;
17 } 18 }
18 19
19 namespace content { 20 namespace content {
20 class WebUI; 21 class WebUI;
21 } 22 }
22 23
23 namespace settings { 24 namespace settings {
24 25
25 // Chrome browser startup settings handler. 26 // Chrome browser startup settings handler.
26 class ClearBrowsingDataHandler : public SettingsPageUIHandler, 27 class ClearBrowsingDataHandler : public SettingsPageUIHandler,
27 public BrowsingDataRemover::Observer { 28 public BrowsingDataRemover::Observer,
29 public sync_driver::SyncServiceObserver {
28 public: 30 public:
29 explicit ClearBrowsingDataHandler(content::WebUI* webui); 31 explicit ClearBrowsingDataHandler(content::WebUI* webui);
30 ~ClearBrowsingDataHandler() override; 32 ~ClearBrowsingDataHandler() override;
31 33
32 // OptionsPageUIHandler: 34 // WebUIMessageHandler implementation.
33 void RegisterMessages() override; 35 void RegisterMessages() override;
36 void OnJavascriptAllowed() override;
37 void OnJavascriptDisallowed() override;
34 38
35 private: 39 private:
36 // Clears browsing data, called by Javascript. 40 // Clears browsing data, called by Javascript.
37 void HandleClearBrowsingData(const base::ListValue* value); 41 void HandleClearBrowsingData(const base::ListValue* value);
38 42
39 // BrowsingDataRemover::Observer implementation. 43 // BrowsingDataRemover::Observer implementation.
40 // Re-enables clear button once all requested data has been removed. 44 // Re-enables clear button once all requested data has been removed.
41 void OnBrowsingDataRemoverDone() override; 45 void OnBrowsingDataRemoverDone() override;
42 46
43 // Updates UI when the pref to allow clearing history changes. 47 // Updates UI when the pref to allow clearing history changes.
44 virtual void OnBrowsingHistoryPrefChanged(); 48 virtual void OnBrowsingHistoryPrefChanged();
45 49
50 // Initializes the dialog UI. Called by JavaScript when the DOM is ready.
51 void HandleInitialize(const base::ListValue* args);
52
53 // Implementation of SyncServiceObserver. Updates the footer of the dialog
54 // when the sync state changes.
55 void OnStateChanged() override;
56
57 // Finds out whether we should show notice about other forms of history stored
58 // in user's account.
59 void RefreshHistoryNotice();
60
61 // Called as an asynchronous response to |RefreshHistoryNotice()|. Shows or
62 // hides the footer about other forms of history stored in user's account.
63 void UpdateHistoryNotice(bool show);
64
65 // ProfileSyncService to observe sync state changes.
66 ProfileSyncService* sync_service_;
67
46 // If non-null it means removal is in progress. 68 // If non-null it means removal is in progress.
47 BrowsingDataRemover* remover_; 69 BrowsingDataRemover* remover_;
48 70
49 // The WebUI callback ID of the last performClearBrowserData request. There 71 // The WebUI callback ID of the last performClearBrowserData request. There
50 // can only be one such request in-flight. 72 // can only be one such request in-flight.
51 std::string webui_callback_id_; 73 std::string webui_callback_id_;
52 74
53 // Keeps track of whether clearing LSO data is supported. 75 // Keeps track of whether clearing LSO data is supported.
54 BooleanPrefMember clear_plugin_lso_data_enabled_; 76 BooleanPrefMember clear_plugin_lso_data_enabled_;
55 77
56 // Keeps track of whether Pepper Flash is enabled and thus Flapper-specific 78 // Keeps track of whether Pepper Flash is enabled and thus Flapper-specific
57 // settings and removal options (e.g. Content Licenses) are available. 79 // settings and removal options (e.g. Content Licenses) are available.
58 BooleanPrefMember pepper_flash_settings_enabled_; 80 BooleanPrefMember pepper_flash_settings_enabled_;
59 81
60 // Keeps track of whether deleting browsing history and downloads is allowed. 82 // Keeps track of whether deleting browsing history and downloads is allowed.
61 BooleanPrefMember allow_deleting_browser_history_; 83 BooleanPrefMember allow_deleting_browser_history_;
62 84
85 // Whether the sentence about other forms of history stored in user's account
86 // should be displayed in the footer. This value is retrieved asynchronously,
87 // so we cache it here.
88 bool should_show_history_footer_;
89
90 // A weak pointer factory for asynchronous calls referencing this class.
91 base::WeakPtrFactory<ClearBrowsingDataHandler> weak_ptr_factory_;
92
63 DISALLOW_COPY_AND_ASSIGN(ClearBrowsingDataHandler); 93 DISALLOW_COPY_AND_ASSIGN(ClearBrowsingDataHandler);
64 }; 94 };
65 95
66 } // namespace settings 96 } // namespace settings
67 97
68 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_CLEAR_BROWSING_DATA_HANDLER _H_ 98 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_CLEAR_BROWSING_DATA_HANDLER _H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698