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 |
66 // Shows or hides the notice about other forms of browsing history. | 67 // Shows or hides the notice about other forms of browsing history. |
67 void UpdateHistoryNotice(bool show); | 68 void UpdateHistoryNotice(bool show); |
68 | 69 |
69 // Remembers whether we should popup a dialog about other forms of browsing | 70 // Remembers whether we should popup a dialog about other forms of browsing |
70 // history when the user deletes the history for the first time. | 71 // history when the user deletes the history for the first time. |
71 void UpdateHistoryDeletionDialog(bool show); | 72 void UpdateHistoryDeletionDialog(bool show); |
72 | 73 |
73 // If non-null it means removal is in progress. | 74 // If non-null it means removal is in progress. |
74 BrowsingDataRemover* remover_; | 75 BrowsingDataRemover* remover_; |
75 | 76 |
76 // Keeps track of whether clearing LSO data is supported. | 77 // Keeps track of whether clearing LSO data is supported. |
77 BooleanPrefMember clear_plugin_lso_data_enabled_; | 78 BooleanPrefMember clear_plugin_lso_data_enabled_; |
78 | 79 |
79 // Keeps track of whether deleting browsing history and downloads is allowed. | 80 // Keeps track of whether deleting browsing history and downloads is allowed. |
80 BooleanPrefMember allow_deleting_browser_history_; | 81 BooleanPrefMember allow_deleting_browser_history_; |
81 | 82 |
82 // Counters that calculate the data volume for some of the data types. | 83 // Counters that calculate the data volume for some of the data types. |
83 ScopedVector<BrowsingDataCounter> counters_; | 84 ScopedVector<browsing_data::BrowsingDataCounter> counters_; |
84 | 85 |
85 // Informs us whether the user is syncing their data. | 86 // Informs us whether the user is syncing their data. |
86 ProfileSyncService* sync_service_; | 87 ProfileSyncService* sync_service_; |
87 | 88 |
88 // Whether we should show a notice about other forms of browsing history. | 89 // Whether we should show a notice about other forms of browsing history. |
89 bool should_show_history_notice_; | 90 bool should_show_history_notice_; |
90 | 91 |
91 // Whether we should popup a dialog about other forms of browsing history | 92 // Whether we should popup a dialog about other forms of browsing history |
92 // when the user deletes their browsing history for the first time. | 93 // when the user deletes their browsing history for the first time. |
93 bool should_show_history_deletion_dialog_; | 94 bool should_show_history_deletion_dialog_; |
94 | 95 |
95 // A weak pointer factory for asynchronous calls referencing this class. | 96 // A weak pointer factory for asynchronous calls referencing this class. |
96 base::WeakPtrFactory<ClearBrowserDataHandler> weak_ptr_factory_; | 97 base::WeakPtrFactory<ClearBrowserDataHandler> weak_ptr_factory_; |
97 | 98 |
98 DISALLOW_COPY_AND_ASSIGN(ClearBrowserDataHandler); | 99 DISALLOW_COPY_AND_ASSIGN(ClearBrowserDataHandler); |
99 }; | 100 }; |
100 | 101 |
101 } // namespace options | 102 } // namespace options |
102 | 103 |
103 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CLEAR_BROWSER_DATA_HANDLER_H_ | 104 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CLEAR_BROWSER_DATA_HANDLER_H_ |
OLD | NEW |