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.
4
5#ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_CLEAR_BROWSER_DATA_HANDLER_H_
6#define CHROME_BROWSER_UI_WEBUI_OPTIONS_CLEAR_BROWSER_DATA_HANDLER_H_
7
8#include "base/prefs/pref_member.h"
9#include "chrome/browser/browsing_data/browsing_data_remover.h"
10#include "chrome/browser/ui/webui/options/options_ui.h"
11
12namespace options {
13
14// Clear browser data handler page UI handler.
15class ClearBrowserDataHandler : public OptionsPageUIHandler,
16                                public BrowsingDataRemover::Observer {
17 public:
18  ClearBrowserDataHandler();
19  virtual ~ClearBrowserDataHandler();
20
21  // OptionsPageUIHandler implementation.
22  virtual void GetLocalizedValues(
23      base::DictionaryValue* localized_strings) OVERRIDE;
24  virtual void InitializeHandler() OVERRIDE;
25  virtual void InitializePage() OVERRIDE;
26
27  // WebUIMessageHandler implementation.
28  virtual void RegisterMessages() OVERRIDE;
29
30  void UpdateInfoBannerVisibility();
31
32 private:
33  // Javascript callback to start clearing data.
34  void HandleClearBrowserData(const base::ListValue* value);
35
36  // BrowsingDataRemover::Observer implementation.
37  // Closes the dialog once all requested data has been removed.
38  virtual void OnBrowsingDataRemoverDone() OVERRIDE;
39
40  // Updates UI when the pref to allow clearing history changes.
41  virtual void OnBrowsingHistoryPrefChanged();
42
43  // If non-null it means removal is in progress. BrowsingDataRemover takes care
44  // of deleting itself when done.
45  BrowsingDataRemover* remover_;
46
47  // Keeps track of whether clearing LSO data is supported.
48  BooleanPrefMember clear_plugin_lso_data_enabled_;
49
50  // Keeps track of whether Pepper Flash is enabled and thus Flapper-specific
51  // settings and removal options (e.g. Content Licenses) are available.
52  BooleanPrefMember pepper_flash_settings_enabled_;
53
54  // Keeps track of whether deleting browsing history and downloads is allowed.
55  BooleanPrefMember allow_deleting_browser_history_;
56
57  DISALLOW_COPY_AND_ASSIGN(ClearBrowserDataHandler);
58};
59
60}  // namespace options
61
62#endif  // CHROME_BROWSER_UI_WEBUI_OPTIONS_CLEAR_BROWSER_DATA_HANDLER_H_
63