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/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_counter.h" | |
11 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 10 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
12 #include "chrome/browser/ui/webui/options/options_ui.h" | 11 #include "chrome/browser/ui/webui/options/options_ui.h" |
13 #include "components/browser_sync/browser/profile_sync_service.h" | 12 #include "components/browser_sync/browser/profile_sync_service.h" |
| 13 #include "components/browsing_data/counters/browsing_data_counter.h" |
14 #include "components/prefs/pref_member.h" | 14 #include "components/prefs/pref_member.h" |
15 | 15 |
16 namespace options { | 16 namespace options { |
17 | 17 |
18 // Clear browser data handler page UI handler. | 18 // Clear browser data handler page UI handler. |
19 class ClearBrowserDataHandler : public OptionsPageUIHandler, | 19 class ClearBrowserDataHandler : public OptionsPageUIHandler, |
20 public BrowsingDataRemover::Observer, | 20 public BrowsingDataRemover::Observer, |
21 public sync_driver::SyncServiceObserver { | 21 public sync_driver::SyncServiceObserver { |
22 public: | 22 public: |
23 ClearBrowserDataHandler(); | 23 ClearBrowserDataHandler(); |
(...skipping 18 matching lines...) Expand all Loading... |
42 void HandleClearBrowserData(const base::ListValue* value); | 42 void HandleClearBrowserData(const base::ListValue* value); |
43 | 43 |
44 // BrowsingDataRemover::Observer implementation. | 44 // BrowsingDataRemover::Observer implementation. |
45 // Closes the dialog once all requested data has been removed. | 45 // Closes the dialog once all requested data has been removed. |
46 void OnBrowsingDataRemoverDone() override; | 46 void OnBrowsingDataRemoverDone() override; |
47 | 47 |
48 // Updates UI when the pref to allow clearing history changes. | 48 // Updates UI when the pref to allow clearing history changes. |
49 virtual void OnBrowsingHistoryPrefChanged(); | 49 virtual void OnBrowsingHistoryPrefChanged(); |
50 | 50 |
51 // Adds a |counter| for browsing data. | 51 // Adds a |counter| for browsing data. |
52 void AddCounter(std::unique_ptr<BrowsingDataCounter> counter); | 52 void AddCounter(std::unique_ptr<browsing_data::BrowsingDataCounter> counter); |
53 | 53 |
54 // Updates a counter in the UI according to the |result|. | 54 // Updates a counter in the UI according to the |result|. |
55 void UpdateCounterText(std::unique_ptr<BrowsingDataCounter::Result> result); | 55 void UpdateCounterText( |
| 56 std::unique_ptr<browsing_data::BrowsingDataCounter::Result> result); |
56 | 57 |
57 // Implementation of SyncServiceObserver. Updates the support string at the | 58 // Implementation of SyncServiceObserver. Updates the support string at the |
58 // bottom of the dialog. | 59 // bottom of the dialog. |
59 void OnStateChanged() override; | 60 void OnStateChanged() override; |
60 | 61 |
61 // Finds out whether we should show a notice informing the user about other | 62 // Finds out whether we should show a notice informing the user about other |
62 // forms of browsing history. Responds with an asynchronous callback to | 63 // forms of browsing history. Responds with an asynchronous callback to |
63 // |UpdateHistoryNotice|. | 64 // |UpdateHistoryNotice|. |
64 void RefreshHistoryNotice(); | 65 void RefreshHistoryNotice(); |
65 | 66 |
(...skipping 11 matching lines...) Expand all Loading... |
77 BooleanPrefMember clear_plugin_lso_data_enabled_; | 78 BooleanPrefMember clear_plugin_lso_data_enabled_; |
78 | 79 |
79 // Keeps track of whether Pepper Flash is enabled and thus Flapper-specific | 80 // Keeps track of whether Pepper Flash is enabled and thus Flapper-specific |
80 // settings and removal options (e.g. Content Licenses) are available. | 81 // settings and removal options (e.g. Content Licenses) are available. |
81 BooleanPrefMember pepper_flash_settings_enabled_; | 82 BooleanPrefMember pepper_flash_settings_enabled_; |
82 | 83 |
83 // Keeps track of whether deleting browsing history and downloads is allowed. | 84 // Keeps track of whether deleting browsing history and downloads is allowed. |
84 BooleanPrefMember allow_deleting_browser_history_; | 85 BooleanPrefMember allow_deleting_browser_history_; |
85 | 86 |
86 // Counters that calculate the data volume for some of the data types. | 87 // Counters that calculate the data volume for some of the data types. |
87 ScopedVector<BrowsingDataCounter> counters_; | 88 ScopedVector<browsing_data::BrowsingDataCounter> counters_; |
88 | 89 |
89 // Informs us whether the user is syncing their data. | 90 // Informs us whether the user is syncing their data. |
90 ProfileSyncService* sync_service_; | 91 ProfileSyncService* sync_service_; |
91 | 92 |
92 // Whether we should show a notice about other forms of browsing history. | 93 // Whether we should show a notice about other forms of browsing history. |
93 bool should_show_history_notice_; | 94 bool should_show_history_notice_; |
94 | 95 |
95 // Whether we should popup a dialog about other forms of browsing history | 96 // Whether we should popup a dialog about other forms of browsing history |
96 // when the user deletes their browsing history for the first time. | 97 // when the user deletes their browsing history for the first time. |
97 bool should_show_history_deletion_dialog_; | 98 bool should_show_history_deletion_dialog_; |
98 | 99 |
99 // A weak pointer factory for asynchronous calls referencing this class. | 100 // A weak pointer factory for asynchronous calls referencing this class. |
100 base::WeakPtrFactory<ClearBrowserDataHandler> weak_ptr_factory_; | 101 base::WeakPtrFactory<ClearBrowserDataHandler> weak_ptr_factory_; |
101 | 102 |
102 DISALLOW_COPY_AND_ASSIGN(ClearBrowserDataHandler); | 103 DISALLOW_COPY_AND_ASSIGN(ClearBrowserDataHandler); |
103 }; | 104 }; |
104 | 105 |
105 } // namespace options | 106 } // namespace options |
106 | 107 |
107 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CLEAR_BROWSER_DATA_HANDLER_H_ | 108 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CLEAR_BROWSER_DATA_HANDLER_H_ |
OLD | NEW |