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_
10 #include "base/compiler_specific.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h"
13 #include "chrome/browser/ui/webui/options/options_ui.h"
16 class DictionaryValue;
20 class BrandcodeConfigFetcher;
21 class ProfileResetter;
22 class ResettableSettingsSnapshot;
26 // Handler for both the 'Reset Profile Settings' overlay page and also the
27 // corresponding banner that is shown at the top of the options page.
28 class ResetProfileSettingsHandler
29 : public OptionsPageUIHandler,
30 public base::SupportsWeakPtr<ResetProfileSettingsHandler> {
32 ResetProfileSettingsHandler();
33 virtual ~ResetProfileSettingsHandler();
35 // OptionsPageUIHandler implementation.
36 virtual void GetLocalizedValues(
37 base::DictionaryValue* localized_strings) OVERRIDE;
38 virtual void InitializeHandler() OVERRIDE;
39 virtual void InitializePage() OVERRIDE;
41 // WebUIMessageHandler implementation.
42 virtual void RegisterMessages() OVERRIDE;
45 // Javascript callback to start clearing data.
46 void HandleResetProfileSettings(const base::ListValue* value);
48 // Closes the dialog once all requested settings has been reset.
49 void OnResetProfileSettingsDone(bool send_feedback);
51 // Called when the confirmation box appears.
52 void OnShowResetProfileDialog(const base::ListValue* value);
54 // Called when the confirmation box disappears.
55 void OnHideResetProfileDialog(const base::ListValue* value);
57 // Called when BrandcodeConfigFetcher completed fetching settings.
58 void OnSettingsFetched();
60 // Resets profile settings to default values. |send_settings| is true if user
61 // gave his consent to upload broken settings to Google for analysis.
62 void ResetProfile(bool send_settings);
64 // Sets new values for the feedback area.
65 void UpdateFeedbackUI();
67 scoped_ptr<ProfileResetter> resetter_;
69 scoped_ptr<BrandcodeConfigFetcher> config_fetcher_;
71 // Snapshot of settings before profile was reseted.
72 scoped_ptr<ResettableSettingsSnapshot> setting_snapshot_;
74 // Contains Chrome brand code; empty for organic Chrome.
75 std::string brandcode_;
77 DISALLOW_COPY_AND_ASSIGN(ResetProfileSettingsHandler);
80 } // namespace options
82 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_RESET_PROFILE_SETTINGS_HANDLER_H_