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

Side by Side Diff: chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.h

Issue 2133893002: [MD settings] disable clear browsing data while it is running (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 4 years, 5 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 <memory> 8 #include <memory>
9 #include <string>
9 #include <vector> 10 #include <vector>
10 11
11 #include "base/macros.h" 12 #include "base/macros.h"
12 #include "base/scoped_observer.h" 13 #include "base/scoped_observer.h"
13 #include "chrome/browser/browsing_data/browsing_data_remover.h" 14 #include "chrome/browser/browsing_data/browsing_data_remover.h"
14 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h" 16 #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
16 #include "components/browser_sync/browser/profile_sync_service.h" 17 #include "components/browser_sync/browser/profile_sync_service.h"
17 #include "components/browsing_data/counters/browsing_data_counter.h" 18 #include "components/browsing_data/counters/browsing_data_counter.h"
18 #include "components/prefs/pref_change_registrar.h" 19 #include "components/prefs/pref_change_registrar.h"
(...skipping 19 matching lines...) Expand all
38 // WebUIMessageHandler implementation. 39 // WebUIMessageHandler implementation.
39 void RegisterMessages() override; 40 void RegisterMessages() override;
40 void OnJavascriptAllowed() override; 41 void OnJavascriptAllowed() override;
41 void OnJavascriptDisallowed() override; 42 void OnJavascriptDisallowed() override;
42 43
43 private: 44 private:
44 // Clears browsing data, called by Javascript. 45 // Clears browsing data, called by Javascript.
45 void HandleClearBrowsingData(const base::ListValue* value); 46 void HandleClearBrowsingData(const base::ListValue* value);
46 47
47 // BrowsingDataRemover::Observer implementation. 48 // BrowsingDataRemover::Observer implementation.
48 // Re-enables clear button once all requested data has been removed. 49 void OnBrowsingDataRemoving(bool is_removing) override;
49 void OnBrowsingDataRemoverDone() override;
50 50
51 // Updates UI when the pref to allow clearing history changes. 51 // Updates UI when the pref to allow clearing history changes.
52 virtual void OnBrowsingHistoryPrefChanged(); 52 virtual void OnBrowsingHistoryPrefChanged();
53 53
54 // Initializes the dialog UI. Called by JavaScript when the DOM is ready. 54 // Initializes the dialog UI. Called by JavaScript when the DOM is ready.
55 void HandleInitialize(const base::ListValue* args); 55 void HandleInitialize(const base::ListValue* args);
56 56
57 // Implementation of SyncServiceObserver. Updates the footer of the dialog 57 // Implementation of SyncServiceObserver. Updates the footer of the dialog
58 // when the sync state changes. 58 // when the sync state changes.
59 void OnStateChanged() override; 59 void OnStateChanged() override;
(...skipping 22 matching lines...) Expand all
82 Profile* profile_; 82 Profile* profile_;
83 83
84 // Counters that calculate the data volume for individual data types. 84 // Counters that calculate the data volume for individual data types.
85 std::vector<std::unique_ptr<browsing_data::BrowsingDataCounter>> counters_; 85 std::vector<std::unique_ptr<browsing_data::BrowsingDataCounter>> counters_;
86 86
87 // ProfileSyncService to observe sync state changes. 87 // ProfileSyncService to observe sync state changes.
88 ProfileSyncService* sync_service_; 88 ProfileSyncService* sync_service_;
89 ScopedObserver<ProfileSyncService, sync_driver::SyncServiceObserver> 89 ScopedObserver<ProfileSyncService, sync_driver::SyncServiceObserver>
90 sync_service_observer_; 90 sync_service_observer_;
91 91
92 // If non-null it means removal is in progress. 92 // Observe the remover progress.
93 BrowsingDataRemover* remover_; 93 BrowsingDataRemover* remover_;
94 ScopedObserver<BrowsingDataRemover, BrowsingDataRemover::Observer>
95 remover_observer_;
94 96
95 // The WebUI callback ID of the last performClearBrowserData request. There 97 // The WebUI callback ID of the last performClearBrowserData request. There
96 // can only be one such request in-flight. 98 // can only be one such request in-flight.
97 std::string webui_callback_id_; 99 std::string webui_callback_id_;
98 100
99 // Used to listen for pref changes to allow / disallow deleting browsing data. 101 // Used to listen for pref changes to allow / disallow deleting browsing data.
100 PrefChangeRegistrar profile_pref_registrar_; 102 PrefChangeRegistrar profile_pref_registrar_;
101 103
102 // Whether the sentence about other forms of history stored in user's account 104 // Whether the sentence about other forms of history stored in user's account
103 // should be displayed in the footer. This value is retrieved asynchronously, 105 // should be displayed in the footer. This value is retrieved asynchronously,
104 // so we cache it here. 106 // so we cache it here.
105 bool show_history_footer_; 107 bool show_history_footer_;
106 108
107 // Whether we should show a dialog informing the user about other forms of 109 // Whether we should show a dialog informing the user about other forms of
108 // history stored in their account after the history deletion is finished. 110 // history stored in their account after the history deletion is finished.
109 bool show_history_deletion_dialog_; 111 bool show_history_deletion_dialog_;
110 112
111 // A weak pointer factory for asynchronous calls referencing this class. 113 // A weak pointer factory for asynchronous calls referencing this class.
112 base::WeakPtrFactory<ClearBrowsingDataHandler> weak_ptr_factory_; 114 base::WeakPtrFactory<ClearBrowsingDataHandler> weak_ptr_factory_;
113 115
114 DISALLOW_COPY_AND_ASSIGN(ClearBrowsingDataHandler); 116 DISALLOW_COPY_AND_ASSIGN(ClearBrowsingDataHandler);
115 }; 117 };
116 118
117 } // namespace settings 119 } // namespace settings
118 120
119 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_CLEAR_BROWSING_DATA_HANDLER _H_ 121 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_CLEAR_BROWSING_DATA_HANDLER _H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698