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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_CLEAR_BROWSER_DATA_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CLEAR_BROWSER_DATA_HANDLER_H_
8 #include "base/memory/scoped_vector.h"
9 #include "base/prefs/pref_member.h"
10 #include "chrome/browser/browsing_data/browsing_data_counter.h"
11 #include "chrome/browser/browsing_data/browsing_data_remover.h"
12 #include "chrome/browser/ui/webui/options/options_ui.h"
16 // Clear browser data handler page UI handler.
17 class ClearBrowserDataHandler
: public OptionsPageUIHandler
,
18 public BrowsingDataRemover::Observer
{
20 ClearBrowserDataHandler();
21 ~ClearBrowserDataHandler() override
;
23 // OptionsPageUIHandler implementation.
24 void GetLocalizedValues(base::DictionaryValue
* localized_strings
) override
;
25 void InitializeHandler() override
;
26 void InitializePage() override
;
28 // WebUIMessageHandler implementation.
29 void RegisterMessages() override
;
31 void UpdateInfoBannerVisibility();
34 // Javascript callback to start clearing data.
35 void HandleClearBrowserData(const base::ListValue
* value
);
37 // BrowsingDataRemover::Observer implementation.
38 // Closes the dialog once all requested data has been removed.
39 void OnBrowsingDataRemoverDone() override
;
41 // Updates UI when the pref to allow clearing history changes.
42 virtual void OnBrowsingHistoryPrefChanged();
44 // Adds a |counter| for browsing data. Its output will be displayed
45 // in the dialog with the string |text_grd_id|.
46 void AddCounter(scoped_ptr
<BrowsingDataCounter
> counter
, int text_grd_id
);
48 // Updates the counter of the pref |pref_name| in the UI according
49 // to a callback from a |BrowsingDataCounter| that specifies whether
50 // the counting has |finished| and what the |count| is. The |count| will
51 // be substituted into the string with the ID |text_grd_id|.
52 void UpdateCounterText(const std::string
& pref_name
,
57 // If non-null it means removal is in progress. BrowsingDataRemover takes care
58 // of deleting itself when done.
59 BrowsingDataRemover
* remover_
;
61 // Keeps track of whether clearing LSO data is supported.
62 BooleanPrefMember clear_plugin_lso_data_enabled_
;
64 // Keeps track of whether Pepper Flash is enabled and thus Flapper-specific
65 // settings and removal options (e.g. Content Licenses) are available.
66 BooleanPrefMember pepper_flash_settings_enabled_
;
68 // Keeps track of whether deleting browsing history and downloads is allowed.
69 BooleanPrefMember allow_deleting_browser_history_
;
71 // Counters that calculate the data volume for some of the data types.
72 ScopedVector
<BrowsingDataCounter
> counters_
;
74 DISALLOW_COPY_AND_ASSIGN(ClearBrowserDataHandler
);
77 } // namespace options
79 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CLEAR_BROWSER_DATA_HANDLER_H_