- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / webui / options / reset_profile_settings_handler.h
1 // Copyright 2013 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_RESET_PROFILE_SETTINGS_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_RESET_PROFILE_SETTINGS_HANDLER_H_
7
8 #include "base/compiler_specific.h"
9 #include "base/memory/weak_ptr.h"
10 #include "chrome/browser/ui/webui/options/options_ui.h"
11
12 namespace base {
13 class DictionaryValue;
14 class ListValue;
15 }  // namespace base
16
17 class BrandcodeConfigFetcher;
18 class ProfileResetter;
19 class ResettableSettingsSnapshot;
20
21 namespace options {
22
23 // Reset Profile Settings handler page UI handler.
24 class ResetProfileSettingsHandler
25     : public OptionsPageUIHandler,
26       public base::SupportsWeakPtr<ResetProfileSettingsHandler> {
27  public:
28   ResetProfileSettingsHandler();
29   virtual ~ResetProfileSettingsHandler();
30
31   // OptionsPageUIHandler implementation.
32   virtual void GetLocalizedValues(
33       base::DictionaryValue* localized_strings) OVERRIDE;
34   virtual void InitializeHandler() OVERRIDE;
35   virtual void InitializePage() OVERRIDE;
36
37   // WebUIMessageHandler implementation.
38   virtual void RegisterMessages() OVERRIDE;
39
40  private:
41   // Javascript callback to start clearing data.
42   void HandleResetProfileSettings(const base::ListValue* value);
43
44   // Closes the dialog once all requested settings has been reset.
45   void OnResetProfileSettingsDone();
46
47   // Called when the confirmation box appears.
48   void OnShowResetProfileDialog(const base::ListValue* value);
49
50   // Called when BrandcodeConfigFetcher completed fetching settings.
51   void OnSettingsFetched();
52
53   // Resets profile settings to default values. |send_settings| is true if user
54   // gave his consent to upload broken settings to Google for analysis.
55   void ResetProfile(bool send_settings);
56
57   scoped_ptr<ProfileResetter> resetter_;
58
59   scoped_ptr<BrandcodeConfigFetcher> config_fetcher_;
60
61   // Snapshot of settings before profile was reseted.
62   scoped_ptr<ResettableSettingsSnapshot> setting_snapshot_;
63
64   // Contains Chrome brand code; empty for organic Chrome.
65   std::string brandcode_;
66
67   DISALLOW_COPY_AND_ASSIGN(ResetProfileSettingsHandler);
68 };
69
70 }  // namespace options
71
72 #endif  // CHROME_BROWSER_UI_WEBUI_OPTIONS_RESET_PROFILE_SETTINGS_HANDLER_H_