Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / chrome / browser / ui / webui / options / reset_profile_settings_handler.h
blobe4e3440acdbe8fb1e334f150321e025116faf61b
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 <string>
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"
15 namespace base {
16 class DictionaryValue;
17 class ListValue;
18 } // namespace base
20 class AutomaticProfileResetter;
21 class BrandcodeConfigFetcher;
22 class ProfileResetter;
23 class ResettableSettingsSnapshot;
25 namespace options {
27 // Handler for both the 'Reset Profile Settings' overlay page and also the
28 // corresponding banner that is shown at the top of the options page.
29 class ResetProfileSettingsHandler
30 : public OptionsPageUIHandler,
31 public base::SupportsWeakPtr<ResetProfileSettingsHandler> {
32 public:
33 ResetProfileSettingsHandler();
34 ~ResetProfileSettingsHandler() override;
36 // OptionsPageUIHandler implementation.
37 void GetLocalizedValues(base::DictionaryValue* localized_strings) override;
38 void InitializeHandler() override;
39 void InitializePage() override;
40 void Uninitialize() override;
42 // WebUIMessageHandler implementation.
43 void RegisterMessages() override;
45 private:
46 // Javascript callback to start clearing data.
47 void HandleResetProfileSettings(const base::ListValue* value);
49 // Closes the dialog once all requested settings has been reset.
50 void OnResetProfileSettingsDone(bool send_feedback);
52 // Called when the confirmation box appears.
53 void OnShowResetProfileDialog(const base::ListValue* value);
55 // Called when the confirmation box disappears.
56 void OnHideResetProfileDialog(const base::ListValue* value);
58 // Called when the reset banner is dismissed from the WebUI.
59 void OnDismissedResetProfileSettingsBanner(const base::ListValue* args);
61 // Called when BrandcodeConfigFetcher completed fetching settings.
62 void OnSettingsFetched();
64 // Resets profile settings to default values. |send_settings| is true if user
65 // gave his consent to upload broken settings to Google for analysis.
66 void ResetProfile(bool send_settings);
68 // Sets new values for the feedback area.
69 void UpdateFeedbackUI();
71 // Destroyed with the Profile, thus it should outlive us. This will be NULL if
72 // the underlying profile is off-the-record (e.g. in Guest mode on Chrome OS).
73 AutomaticProfileResetter* automatic_profile_resetter_;
75 // Records whether or not the Profile Reset confirmation dialog was opened at
76 // least once during the lifetime of the settings page.
77 bool has_shown_confirmation_dialog_;
79 scoped_ptr<ProfileResetter> resetter_;
81 scoped_ptr<BrandcodeConfigFetcher> config_fetcher_;
83 // Snapshot of settings before profile was reseted.
84 scoped_ptr<ResettableSettingsSnapshot> setting_snapshot_;
86 // Contains Chrome brand code; empty for organic Chrome.
87 std::string brandcode_;
89 DISALLOW_COPY_AND_ASSIGN(ResetProfileSettingsHandler);
92 } // namespace options
94 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_RESET_PROFILE_SETTINGS_HANDLER_H_