| 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/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h" | 15 #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h" |
| 16 #include "components/browser_sync/profile_sync_service.h" | 16 #include "components/browser_sync/profile_sync_service.h" |
| 17 #include "components/browsing_data/core/counters/browsing_data_counter.h" | 17 #include "components/browsing_data/core/counters/browsing_data_counter.h" |
| 18 | 18 |
| 19 namespace base { | 19 namespace base { |
| 20 class ListValue; | 20 class ListValue; |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace content { | 23 namespace content { |
| 24 class WebUI; | 24 class WebUI; |
| 25 class BrowsingDataFilterBuilder; |
| 25 } | 26 } |
| 26 | 27 |
| 27 namespace settings { | 28 namespace settings { |
| 28 | 29 |
| 29 // Chrome browser startup settings handler. | 30 // Chrome browser startup settings handler. |
| 30 class ClearBrowsingDataHandler : public SettingsPageUIHandler, | 31 class ClearBrowsingDataHandler : public SettingsPageUIHandler, |
| 31 public syncer::SyncServiceObserver { | 32 public syncer::SyncServiceObserver { |
| 32 public: | 33 public: |
| 33 explicit ClearBrowsingDataHandler(content::WebUI* webui); | 34 explicit ClearBrowsingDataHandler(content::WebUI* webui); |
| 34 ~ClearBrowsingDataHandler() override; | 35 ~ClearBrowsingDataHandler() override; |
| 35 | 36 |
| 36 // WebUIMessageHandler implementation. | 37 // WebUIMessageHandler implementation. |
| 37 void RegisterMessages() override; | 38 void RegisterMessages() override; |
| 38 void OnJavascriptAllowed() override; | 39 void OnJavascriptAllowed() override; |
| 39 void OnJavascriptDisallowed() override; | 40 void OnJavascriptDisallowed() override; |
| 40 | 41 |
| 41 private: | 42 private: |
| 42 // Observes one |remover| task initiated from ClearBrowsingDataHandler. | 43 // Observes one |remover| task initiated from ClearBrowsingDataHandler. |
| 43 // Calls |callback| when the task is finished. | 44 // Calls |callback| when the task is finished. |
| 44 class TaskObserver; | 45 class TaskObserver; |
| 45 | 46 |
| 46 // Clears browsing data, called by Javascript. | 47 // Clears browsing data, called by Javascript. |
| 47 void HandleClearBrowsingData(const base::ListValue* value); | 48 void HandleClearBrowsingData(const base::ListValue* value); |
| 48 | 49 |
| 50 // Parses a ListValue with important site information and creates a |
| 51 // BrowsingDataFilterBuilder. |
| 52 std::unique_ptr<content::BrowsingDataFilterBuilder> ProcessImportantSites( |
| 53 const base::ListValue* important_sites); |
| 54 |
| 49 // Called when a clearing task finished. |webui_callback_id| is provided | 55 // Called when a clearing task finished. |webui_callback_id| is provided |
| 50 // by the WebUI action that initiated it. | 56 // by the WebUI action that initiated it. |
| 51 void OnClearingTaskFinished(const std::string& webui_callback_id); | 57 void OnClearingTaskFinished(const std::string& webui_callback_id); |
| 52 | 58 |
| 59 // Fetches important sites, called by Javascript. |
| 60 void HandleFetchImportantSites(const base::ListValue* value); |
| 61 |
| 53 // Initializes the dialog UI. Called by JavaScript when the DOM is ready. | 62 // Initializes the dialog UI. Called by JavaScript when the DOM is ready. |
| 54 void HandleInitialize(const base::ListValue* args); | 63 void HandleInitialize(const base::ListValue* args); |
| 55 | 64 |
| 56 // Implementation of SyncServiceObserver. | 65 // Implementation of SyncServiceObserver. |
| 57 void OnStateChanged(syncer::SyncService* sync) override; | 66 void OnStateChanged(syncer::SyncService* sync) override; |
| 58 | 67 |
| 59 // Updates the footer of the dialog when the sync state changes. | 68 // Updates the footer of the dialog when the sync state changes. |
| 60 void UpdateSyncState(); | 69 void UpdateSyncState(); |
| 61 | 70 |
| 62 // Finds out whether we should show notice about other forms of history stored | 71 // Finds out whether we should show notice about other forms of history stored |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 113 |
| 105 // A weak pointer factory for asynchronous calls referencing this class. | 114 // A weak pointer factory for asynchronous calls referencing this class. |
| 106 base::WeakPtrFactory<ClearBrowsingDataHandler> weak_ptr_factory_; | 115 base::WeakPtrFactory<ClearBrowsingDataHandler> weak_ptr_factory_; |
| 107 | 116 |
| 108 DISALLOW_COPY_AND_ASSIGN(ClearBrowsingDataHandler); | 117 DISALLOW_COPY_AND_ASSIGN(ClearBrowsingDataHandler); |
| 109 }; | 118 }; |
| 110 | 119 |
| 111 } // namespace settings | 120 } // namespace settings |
| 112 | 121 |
| 113 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_CLEAR_BROWSING_DATA_HANDLER
_H_ | 122 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_CLEAR_BROWSING_DATA_HANDLER
_H_ |
| OLD | NEW |