| OLD | NEW |
| 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 <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/scoped_observer.h" | 13 #include "base/scoped_observer.h" |
| 14 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 14 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h" | 16 #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h" |
| 17 #include "components/browser_sync/profile_sync_service.h" | 17 #include "components/browser_sync/profile_sync_service.h" |
| 18 #include "components/browsing_data/core/counters/browsing_data_counter.h" | 18 #include "components/browsing_data/core/counters/browsing_data_counter.h" |
| 19 #include "components/prefs/pref_change_registrar.h" | |
| 20 | 19 |
| 21 namespace base { | 20 namespace base { |
| 22 class ListValue; | 21 class ListValue; |
| 23 } | 22 } |
| 24 | 23 |
| 25 namespace content { | 24 namespace content { |
| 26 class WebUI; | 25 class WebUI; |
| 27 } | 26 } |
| 28 | 27 |
| 29 namespace settings { | 28 namespace settings { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 45 // Calls |callback| when the task is finished. | 44 // Calls |callback| when the task is finished. |
| 46 class TaskObserver; | 45 class TaskObserver; |
| 47 | 46 |
| 48 // Clears browsing data, called by Javascript. | 47 // Clears browsing data, called by Javascript. |
| 49 void HandleClearBrowsingData(const base::ListValue* value); | 48 void HandleClearBrowsingData(const base::ListValue* value); |
| 50 | 49 |
| 51 // Called when a clearing task finished. |webui_callback_id| is provided | 50 // Called when a clearing task finished. |webui_callback_id| is provided |
| 52 // by the WebUI action that initiated it. | 51 // by the WebUI action that initiated it. |
| 53 void OnClearingTaskFinished(const std::string& webui_callback_id); | 52 void OnClearingTaskFinished(const std::string& webui_callback_id); |
| 54 | 53 |
| 55 // Updates UI when the pref to allow clearing history changes. | |
| 56 virtual void OnBrowsingHistoryPrefChanged(); | |
| 57 | |
| 58 // 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. |
| 59 void HandleInitialize(const base::ListValue* args); | 55 void HandleInitialize(const base::ListValue* args); |
| 60 | 56 |
| 61 // Implementation of SyncServiceObserver. Updates the footer of the dialog | 57 // Implementation of SyncServiceObserver. Updates the footer of the dialog |
| 62 // when the sync state changes. | 58 // when the sync state changes. |
| 63 void OnStateChanged() override; | 59 void OnStateChanged() override; |
| 64 | 60 |
| 65 // Finds out whether we should show notice about other forms of history stored | 61 // Finds out whether we should show notice about other forms of history stored |
| 66 // in user's account. | 62 // in user's account. |
| 67 void RefreshHistoryNotice(); | 63 void RefreshHistoryNotice(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 89 std::vector<std::unique_ptr<browsing_data::BrowsingDataCounter>> counters_; | 85 std::vector<std::unique_ptr<browsing_data::BrowsingDataCounter>> counters_; |
| 90 | 86 |
| 91 // Observes the currently active data clearing task. | 87 // Observes the currently active data clearing task. |
| 92 std::unique_ptr<TaskObserver> task_observer_; | 88 std::unique_ptr<TaskObserver> task_observer_; |
| 93 | 89 |
| 94 // ProfileSyncService to observe sync state changes. | 90 // ProfileSyncService to observe sync state changes. |
| 95 browser_sync::ProfileSyncService* sync_service_; | 91 browser_sync::ProfileSyncService* sync_service_; |
| 96 ScopedObserver<browser_sync::ProfileSyncService, syncer::SyncServiceObserver> | 92 ScopedObserver<browser_sync::ProfileSyncService, syncer::SyncServiceObserver> |
| 97 sync_service_observer_; | 93 sync_service_observer_; |
| 98 | 94 |
| 99 // Used to listen for pref changes to allow / disallow deleting browsing data. | |
| 100 PrefChangeRegistrar profile_pref_registrar_; | |
| 101 | |
| 102 // Whether the sentence about other forms of history stored in user's account | 95 // 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, | 96 // should be displayed in the footer. This value is retrieved asynchronously, |
| 104 // so we cache it here. | 97 // so we cache it here. |
| 105 bool show_history_footer_; | 98 bool show_history_footer_; |
| 106 | 99 |
| 107 // Whether we should show a dialog informing the user about other forms of | 100 // 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. | 101 // history stored in their account after the history deletion is finished. |
| 109 bool show_history_deletion_dialog_; | 102 bool show_history_deletion_dialog_; |
| 110 | 103 |
| 111 // A weak pointer factory for asynchronous calls referencing this class. | 104 // A weak pointer factory for asynchronous calls referencing this class. |
| 112 base::WeakPtrFactory<ClearBrowsingDataHandler> weak_ptr_factory_; | 105 base::WeakPtrFactory<ClearBrowsingDataHandler> weak_ptr_factory_; |
| 113 | 106 |
| 114 DISALLOW_COPY_AND_ASSIGN(ClearBrowsingDataHandler); | 107 DISALLOW_COPY_AND_ASSIGN(ClearBrowsingDataHandler); |
| 115 }; | 108 }; |
| 116 | 109 |
| 117 } // namespace settings | 110 } // namespace settings |
| 118 | 111 |
| 119 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_CLEAR_BROWSING_DATA_HANDLER
_H_ | 112 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_CLEAR_BROWSING_DATA_HANDLER
_H_ |
| OLD | NEW |