| 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 <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 class ResettableSettingsSnapshot; | 23 class ResettableSettingsSnapshot; |
| 24 | 24 |
| 25 namespace options { | 25 namespace options { |
| 26 | 26 |
| 27 // Handler for both the 'Reset Profile Settings' overlay page and also the | 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. | 28 // corresponding banner that is shown at the top of the options page. |
| 29 class ResetProfileSettingsHandler | 29 class ResetProfileSettingsHandler |
| 30 : public OptionsPageUIHandler, | 30 : public OptionsPageUIHandler, |
| 31 public base::SupportsWeakPtr<ResetProfileSettingsHandler> { | 31 public base::SupportsWeakPtr<ResetProfileSettingsHandler> { |
| 32 public: | 32 public: |
| 33 // Hash used by the Chrome Cleanup Tool when launching chrome with the reset |
| 34 // profile settings URL. |
| 35 static const char kCctResetSettingsHash[]; |
| 36 |
| 33 ResetProfileSettingsHandler(); | 37 ResetProfileSettingsHandler(); |
| 34 ~ResetProfileSettingsHandler() override; | 38 ~ResetProfileSettingsHandler() override; |
| 35 | 39 |
| 36 // OptionsPageUIHandler implementation. | 40 // OptionsPageUIHandler implementation. |
| 37 void GetLocalizedValues(base::DictionaryValue* localized_strings) override; | 41 void GetLocalizedValues(base::DictionaryValue* localized_strings) override; |
| 38 void InitializeHandler() override; | 42 void InitializeHandler() override; |
| 39 void InitializePage() override; | 43 void InitializePage() override; |
| 40 | 44 |
| 41 // WebUIMessageHandler implementation. | 45 // WebUIMessageHandler implementation. |
| 42 void RegisterMessages() override; | 46 void RegisterMessages() override; |
| 43 | 47 |
| 44 private: | 48 private: |
| 45 // Javascript callback to start clearing data. | 49 // Javascript callback to start clearing data. |
| 46 void HandleResetProfileSettings(const base::ListValue* value); | 50 void HandleResetProfileSettings(const base::ListValue* value); |
| 47 | 51 |
| 48 // Closes the dialog once all requested settings has been reset. | 52 // Closes the dialog once all requested settings has been reset. |
| 49 void OnResetProfileSettingsDone(bool send_feedback); | 53 void OnResetProfileSettingsDone(bool send_feedback, |
| 54 const std::string& reset_request_origin); |
| 50 | 55 |
| 51 // Called when the confirmation box appears. | 56 // Called when the confirmation box appears. |
| 52 void OnShowResetProfileDialog(const base::ListValue* value); | 57 void OnShowResetProfileDialog(const base::ListValue* value); |
| 53 | 58 |
| 54 // Called when the confirmation box disappears. | 59 // Called when the confirmation box disappears. |
| 55 void OnHideResetProfileDialog(const base::ListValue* value); | 60 void OnHideResetProfileDialog(const base::ListValue* value); |
| 56 | 61 |
| 57 // Called when BrandcodeConfigFetcher completed fetching settings. | 62 // Called when BrandcodeConfigFetcher completed fetching settings. |
| 58 void OnSettingsFetched(); | 63 void OnSettingsFetched(); |
| 59 | 64 |
| 60 // Resets profile settings to default values. |send_settings| is true if user | 65 // Resets profile settings to default values. |send_settings| is true if user |
| 61 // gave his consent to upload broken settings to Google for analysis. | 66 // gave his consent to upload broken settings to Google for analysis. |
| 62 void ResetProfile(bool send_settings); | 67 void ResetProfile(bool send_settings, |
| 68 const std::string& reset_request_origin); |
| 63 | 69 |
| 64 // Sets new values for the feedback area. | 70 // Sets new values for the feedback area. |
| 65 void UpdateFeedbackUI(); | 71 void UpdateFeedbackUI(); |
| 66 | 72 |
| 67 std::unique_ptr<ProfileResetter> resetter_; | 73 std::unique_ptr<ProfileResetter> resetter_; |
| 68 | 74 |
| 69 std::unique_ptr<BrandcodeConfigFetcher> config_fetcher_; | 75 std::unique_ptr<BrandcodeConfigFetcher> config_fetcher_; |
| 70 | 76 |
| 71 // Snapshot of settings before profile was reseted. | 77 // Snapshot of settings before profile was reseted. |
| 72 std::unique_ptr<ResettableSettingsSnapshot> setting_snapshot_; | 78 std::unique_ptr<ResettableSettingsSnapshot> setting_snapshot_; |
| 73 | 79 |
| 74 // Contains Chrome brand code; empty for organic Chrome. | 80 // Contains Chrome brand code; empty for organic Chrome. |
| 75 std::string brandcode_; | 81 std::string brandcode_; |
| 76 | 82 |
| 77 DISALLOW_COPY_AND_ASSIGN(ResetProfileSettingsHandler); | 83 DISALLOW_COPY_AND_ASSIGN(ResetProfileSettingsHandler); |
| 78 }; | 84 }; |
| 79 | 85 |
| 80 } // namespace options | 86 } // namespace options |
| 81 | 87 |
| 82 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_RESET_PROFILE_SETTINGS_HANDLER_H_ | 88 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_RESET_PROFILE_SETTINGS_HANDLER_H_ |
| OLD | NEW |