| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_OPTIONS_CLEAR_BROWSER_DATA_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_CLEAR_BROWSER_DATA_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CLEAR_BROWSER_DATA_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CLEAR_BROWSER_DATA_HANDLER_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
| 9 #include "base/prefs/pref_member.h" | 9 #include "base/prefs/pref_member.h" |
| 10 #include "chrome/browser/browsing_data/browsing_data_counter.h" | 10 #include "chrome/browser/browsing_data/browsing_data_counter.h" |
| 11 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 11 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
| 12 #include "chrome/browser/sync/profile_sync_service.h" |
| 12 #include "chrome/browser/ui/webui/options/options_ui.h" | 13 #include "chrome/browser/ui/webui/options/options_ui.h" |
| 13 | 14 |
| 14 namespace options { | 15 namespace options { |
| 15 | 16 |
| 16 // Clear browser data handler page UI handler. | 17 // Clear browser data handler page UI handler. |
| 17 class ClearBrowserDataHandler : public OptionsPageUIHandler, | 18 class ClearBrowserDataHandler : public OptionsPageUIHandler, |
| 18 public BrowsingDataRemover::Observer { | 19 public BrowsingDataRemover::Observer, |
| 20 public sync_driver::SyncServiceObserver { |
| 19 public: | 21 public: |
| 20 ClearBrowserDataHandler(); | 22 ClearBrowserDataHandler(); |
| 21 ~ClearBrowserDataHandler() override; | 23 ~ClearBrowserDataHandler() override; |
| 22 | 24 |
| 23 // OptionsPageUIHandler implementation. | 25 // OptionsPageUIHandler implementation. |
| 24 void GetLocalizedValues(base::DictionaryValue* localized_strings) override; | 26 void GetLocalizedValues(base::DictionaryValue* localized_strings) override; |
| 25 void InitializeHandler() override; | 27 void InitializeHandler() override; |
| 26 void InitializePage() override; | 28 void InitializePage() override; |
| 27 | 29 |
| 28 // WebUIMessageHandler implementation. | 30 // WebUIMessageHandler implementation. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 47 | 49 |
| 48 // Updates the counter of the pref |pref_name| in the UI according | 50 // Updates the counter of the pref |pref_name| in the UI according |
| 49 // to a callback from a |BrowsingDataCounter| that specifies whether | 51 // to a callback from a |BrowsingDataCounter| that specifies whether |
| 50 // the counting has |finished| and what the |count| is. The |count| will | 52 // the counting has |finished| and what the |count| is. The |count| will |
| 51 // be substituted into the string with the ID |text_grd_id|. | 53 // be substituted into the string with the ID |text_grd_id|. |
| 52 void UpdateCounterText(const std::string& pref_name, | 54 void UpdateCounterText(const std::string& pref_name, |
| 53 int text_grd_id, | 55 int text_grd_id, |
| 54 bool finished, | 56 bool finished, |
| 55 uint32 count); | 57 uint32 count); |
| 56 | 58 |
| 59 // Implementation of SyncServiceObserver. Updates the support string at the |
| 60 // bottom of the dialog. |
| 61 void OnStateChanged() override; |
| 62 |
| 57 // If non-null it means removal is in progress. BrowsingDataRemover takes care | 63 // If non-null it means removal is in progress. BrowsingDataRemover takes care |
| 58 // of deleting itself when done. | 64 // of deleting itself when done. |
| 59 BrowsingDataRemover* remover_; | 65 BrowsingDataRemover* remover_; |
| 60 | 66 |
| 61 // Keeps track of whether clearing LSO data is supported. | 67 // Keeps track of whether clearing LSO data is supported. |
| 62 BooleanPrefMember clear_plugin_lso_data_enabled_; | 68 BooleanPrefMember clear_plugin_lso_data_enabled_; |
| 63 | 69 |
| 64 // Keeps track of whether Pepper Flash is enabled and thus Flapper-specific | 70 // Keeps track of whether Pepper Flash is enabled and thus Flapper-specific |
| 65 // settings and removal options (e.g. Content Licenses) are available. | 71 // settings and removal options (e.g. Content Licenses) are available. |
| 66 BooleanPrefMember pepper_flash_settings_enabled_; | 72 BooleanPrefMember pepper_flash_settings_enabled_; |
| 67 | 73 |
| 68 // Keeps track of whether deleting browsing history and downloads is allowed. | 74 // Keeps track of whether deleting browsing history and downloads is allowed. |
| 69 BooleanPrefMember allow_deleting_browser_history_; | 75 BooleanPrefMember allow_deleting_browser_history_; |
| 70 | 76 |
| 71 // Counters that calculate the data volume for some of the data types. | 77 // Counters that calculate the data volume for some of the data types. |
| 72 ScopedVector<BrowsingDataCounter> counters_; | 78 ScopedVector<BrowsingDataCounter> counters_; |
| 73 | 79 |
| 80 // Informs us whether the user is syncing their data. |
| 81 ProfileSyncService* sync_service_; |
| 82 |
| 74 DISALLOW_COPY_AND_ASSIGN(ClearBrowserDataHandler); | 83 DISALLOW_COPY_AND_ASSIGN(ClearBrowserDataHandler); |
| 75 }; | 84 }; |
| 76 | 85 |
| 77 } // namespace options | 86 } // namespace options |
| 78 | 87 |
| 79 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CLEAR_BROWSER_DATA_HANDLER_H_ | 88 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CLEAR_BROWSER_DATA_HANDLER_H_ |
| OLD | NEW |