| OLD | NEW | 
|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_RESET_PROFILE_SETTINGS_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_RESET_PROFILE_SETTINGS_HANDLER_H_ | 
| 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_RESET_PROFILE_SETTINGS_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_RESET_PROFILE_SETTINGS_HANDLER_H_ | 
| 7 | 7 | 
| 8 #include <string> | 8 #include <string> | 
| 9 | 9 | 
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" | 
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" | 
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" | 
| 13 #include "chrome/browser/ui/webui/options/options_ui.h" | 13 #include "chrome/browser/ui/webui/options/options_ui.h" | 
| 14 | 14 | 
| 15 namespace base { | 15 namespace base { | 
| 16 class DictionaryValue; | 16 class DictionaryValue; | 
| 17 class ListValue; | 17 class ListValue; | 
| 18 }  // namespace base | 18 }  // namespace base | 
| 19 | 19 | 
| 20 class AutomaticProfileResetter; |  | 
| 21 class BrandcodeConfigFetcher; | 20 class BrandcodeConfigFetcher; | 
| 22 class ProfileResetter; | 21 class ProfileResetter; | 
| 23 class ResettableSettingsSnapshot; | 22 class ResettableSettingsSnapshot; | 
| 24 | 23 | 
| 25 namespace options { | 24 namespace options { | 
| 26 | 25 | 
| 27 // Handler for both the 'Reset Profile Settings' overlay page and also the | 26 // 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. | 27 // corresponding banner that is shown at the top of the options page. | 
| 29 class ResetProfileSettingsHandler | 28 class ResetProfileSettingsHandler | 
| 30     : public OptionsPageUIHandler, | 29     : public OptionsPageUIHandler, | 
| 31       public base::SupportsWeakPtr<ResetProfileSettingsHandler> { | 30       public base::SupportsWeakPtr<ResetProfileSettingsHandler> { | 
| 32  public: | 31  public: | 
| 33   ResetProfileSettingsHandler(); | 32   ResetProfileSettingsHandler(); | 
| 34   virtual ~ResetProfileSettingsHandler(); | 33   virtual ~ResetProfileSettingsHandler(); | 
| 35 | 34 | 
| 36   // OptionsPageUIHandler implementation. | 35   // OptionsPageUIHandler implementation. | 
| 37   virtual void GetLocalizedValues( | 36   virtual void GetLocalizedValues( | 
| 38       base::DictionaryValue* localized_strings) OVERRIDE; | 37       base::DictionaryValue* localized_strings) OVERRIDE; | 
| 39   virtual void InitializeHandler() OVERRIDE; | 38   virtual void InitializeHandler() OVERRIDE; | 
| 40   virtual void InitializePage() OVERRIDE; | 39   virtual void InitializePage() OVERRIDE; | 
| 41   virtual void Uninitialize() OVERRIDE; |  | 
| 42 | 40 | 
| 43   // WebUIMessageHandler implementation. | 41   // WebUIMessageHandler implementation. | 
| 44   virtual void RegisterMessages() OVERRIDE; | 42   virtual void RegisterMessages() OVERRIDE; | 
| 45 | 43 | 
| 46  private: | 44  private: | 
| 47   // Javascript callback to start clearing data. | 45   // Javascript callback to start clearing data. | 
| 48   void HandleResetProfileSettings(const base::ListValue* value); | 46   void HandleResetProfileSettings(const base::ListValue* value); | 
| 49 | 47 | 
| 50   // Closes the dialog once all requested settings has been reset. | 48   // Closes the dialog once all requested settings has been reset. | 
| 51   void OnResetProfileSettingsDone(bool send_feedback); | 49   void OnResetProfileSettingsDone(bool send_feedback); | 
| 52 | 50 | 
| 53   // Called when the confirmation box appears. | 51   // Called when the confirmation box appears. | 
| 54   void OnShowResetProfileDialog(const base::ListValue* value); | 52   void OnShowResetProfileDialog(const base::ListValue* value); | 
| 55 | 53 | 
| 56   // Called when the confirmation box disappears. | 54   // Called when the confirmation box disappears. | 
| 57   void OnHideResetProfileDialog(const base::ListValue* value); | 55   void OnHideResetProfileDialog(const base::ListValue* value); | 
| 58 | 56 | 
| 59   // Called when the reset banner is dismissed from the WebUI. |  | 
| 60   void OnDismissedResetProfileSettingsBanner(const base::ListValue* args); |  | 
| 61 |  | 
| 62   // Called when BrandcodeConfigFetcher completed fetching settings. | 57   // Called when BrandcodeConfigFetcher completed fetching settings. | 
| 63   void OnSettingsFetched(); | 58   void OnSettingsFetched(); | 
| 64 | 59 | 
| 65   // Resets profile settings to default values. |send_settings| is true if user | 60   // Resets profile settings to default values. |send_settings| is true if user | 
| 66   // gave his consent to upload broken settings to Google for analysis. | 61   // gave his consent to upload broken settings to Google for analysis. | 
| 67   void ResetProfile(bool send_settings); | 62   void ResetProfile(bool send_settings); | 
| 68 | 63 | 
| 69   // Sets new values for the feedback area. | 64   // Sets new values for the feedback area. | 
| 70   void UpdateFeedbackUI(); | 65   void UpdateFeedbackUI(); | 
| 71 | 66 | 
| 72   // Destroyed with the Profile, thus it should outlive us. This will be NULL if |  | 
| 73   // the underlying profile is off-the-record (e.g. in Guest mode on Chrome OS). |  | 
| 74   AutomaticProfileResetter* automatic_profile_resetter_; |  | 
| 75 |  | 
| 76   // Records whether or not the Profile Reset confirmation dialog was opened at |  | 
| 77   // least once during the lifetime of the settings page. |  | 
| 78   bool has_shown_confirmation_dialog_; |  | 
| 79 |  | 
| 80   scoped_ptr<ProfileResetter> resetter_; | 67   scoped_ptr<ProfileResetter> resetter_; | 
| 81 | 68 | 
| 82   scoped_ptr<BrandcodeConfigFetcher> config_fetcher_; | 69   scoped_ptr<BrandcodeConfigFetcher> config_fetcher_; | 
| 83 | 70 | 
| 84   // Snapshot of settings before profile was reseted. | 71   // Snapshot of settings before profile was reseted. | 
| 85   scoped_ptr<ResettableSettingsSnapshot> setting_snapshot_; | 72   scoped_ptr<ResettableSettingsSnapshot> setting_snapshot_; | 
| 86 | 73 | 
| 87   // Contains Chrome brand code; empty for organic Chrome. | 74   // Contains Chrome brand code; empty for organic Chrome. | 
| 88   std::string brandcode_; | 75   std::string brandcode_; | 
| 89 | 76 | 
| 90   DISALLOW_COPY_AND_ASSIGN(ResetProfileSettingsHandler); | 77   DISALLOW_COPY_AND_ASSIGN(ResetProfileSettingsHandler); | 
| 91 }; | 78 }; | 
| 92 | 79 | 
| 93 }  // namespace options | 80 }  // namespace options | 
| 94 | 81 | 
| 95 #endif  // CHROME_BROWSER_UI_WEBUI_OPTIONS_RESET_PROFILE_SETTINGS_HANDLER_H_ | 82 #endif  // CHROME_BROWSER_UI_WEBUI_OPTIONS_RESET_PROFILE_SETTINGS_HANDLER_H_ | 
| OLD | NEW | 
|---|