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.
5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_RESET_PROFILE_SETTINGS_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_RESET_PROFILE_SETTINGS_HANDLER_H_
8 #include "base/compiler_specific.h"
9 #include "base/memory/weak_ptr.h"
10 #include "chrome/browser/ui/webui/options/options_ui.h"
13 class DictionaryValue;
17 class BrandcodeConfigFetcher;
18 class ProfileResetter;
19 class ResettableSettingsSnapshot;
23 // Reset Profile Settings handler page UI handler.
24 class ResetProfileSettingsHandler
25 : public OptionsPageUIHandler,
26 public base::SupportsWeakPtr<ResetProfileSettingsHandler> {
28 ResetProfileSettingsHandler();
29 virtual ~ResetProfileSettingsHandler();
31 // OptionsPageUIHandler implementation.
32 virtual void GetLocalizedValues(
33 base::DictionaryValue* localized_strings) OVERRIDE;
34 virtual void InitializeHandler() OVERRIDE;
35 virtual void InitializePage() OVERRIDE;
37 // WebUIMessageHandler implementation.
38 virtual void RegisterMessages() OVERRIDE;
41 // Javascript callback to start clearing data.
42 void HandleResetProfileSettings(const base::ListValue* value);
44 // Closes the dialog once all requested settings has been reset.
45 void OnResetProfileSettingsDone();
47 // Called when the confirmation box appears.
48 void OnShowResetProfileDialog(const base::ListValue* value);
50 // Called when BrandcodeConfigFetcher completed fetching settings.
51 void OnSettingsFetched();
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);
57 scoped_ptr<ProfileResetter> resetter_;
59 scoped_ptr<BrandcodeConfigFetcher> config_fetcher_;
61 // Snapshot of settings before profile was reseted.
62 scoped_ptr<ResettableSettingsSnapshot> setting_snapshot_;
64 // Contains Chrome brand code; empty for organic Chrome.
65 std::string brandcode_;
67 DISALLOW_COPY_AND_ASSIGN(ResetProfileSettingsHandler);
70 } // namespace options
72 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_RESET_PROFILE_SETTINGS_HANDLER_H_