| 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_SETTINGS_RESET_SETTINGS_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_RESET_SETTINGS_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_SETTINGS_RESET_SETTINGS_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_SETTINGS_RESET_SETTINGS_HANDLER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 static ResetSettingsHandler* Create( | 40 static ResetSettingsHandler* Create( |
| 41 content::WebUIDataSource* html_source, Profile* profile); | 41 content::WebUIDataSource* html_source, Profile* profile); |
| 42 | 42 |
| 43 // WebUIMessageHandler implementation. | 43 // WebUIMessageHandler implementation. |
| 44 void RegisterMessages() override; | 44 void RegisterMessages() override; |
| 45 void OnJavascriptAllowed() override {} | 45 void OnJavascriptAllowed() override {} |
| 46 void OnJavascriptDisallowed() override {} | 46 void OnJavascriptDisallowed() override {} |
| 47 | 47 |
| 48 protected: | 48 protected: |
| 49 ResetSettingsHandler(Profile* profile, bool allow_powerwash); | 49 explicit ResetSettingsHandler(Profile* profile); |
| 50 | 50 |
| 51 // Overriden in tests to substitute with a test version of ProfileResetter. | 51 // Overriden in tests to substitute with a test version of ProfileResetter. |
| 52 virtual ProfileResetter* GetResetter(); | 52 virtual ProfileResetter* GetResetter(); |
| 53 | 53 |
| 54 // Javascript callback to start clearing data. | 54 // Javascript callback to start clearing data. |
| 55 void HandleResetProfileSettings(const base::ListValue* args); | 55 void HandleResetProfileSettings(const base::ListValue* args); |
| 56 | 56 |
| 57 private: | 57 private: |
| 58 // Retrieves the settings that will be reported, called from Javascript. | 58 // Retrieves the settings that will be reported, called from Javascript. |
| 59 void HandleGetReportedSettings(const base::ListValue* args); | 59 void HandleGetReportedSettings(const base::ListValue* args); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 77 // gave his consent to upload broken settings to Google for analysis. | 77 // gave his consent to upload broken settings to Google for analysis. |
| 78 void ResetProfile(std::string callback_id, bool send_settings); | 78 void ResetProfile(std::string callback_id, bool send_settings); |
| 79 | 79 |
| 80 // Closes the dialog once all requested settings has been reset. | 80 // Closes the dialog once all requested settings has been reset. |
| 81 void OnResetProfileSettingsDone(std::string callback_id, | 81 void OnResetProfileSettingsDone(std::string callback_id, |
| 82 bool send_feedback); | 82 bool send_feedback); |
| 83 | 83 |
| 84 #if defined(OS_CHROMEOS) | 84 #if defined(OS_CHROMEOS) |
| 85 // Will be called when powerwash dialog is shown. | 85 // Will be called when powerwash dialog is shown. |
| 86 void OnShowPowerwashDialog(const base::ListValue* args); | 86 void OnShowPowerwashDialog(const base::ListValue* args); |
| 87 | |
| 88 // Sets a pref indicating that a factory reset is requested and then requests | |
| 89 // a restart. | |
| 90 void HandleFactoryResetRestart(const base::ListValue* args); | |
| 91 | |
| 92 // Whether factory reset can be performed. | |
| 93 bool allow_powerwash_ = false; | |
| 94 #endif // defined(OS_CHROMEOS) | 87 #endif // defined(OS_CHROMEOS) |
| 95 | 88 |
| 96 Profile* const profile_; | 89 Profile* const profile_; |
| 97 | 90 |
| 98 std::unique_ptr<ProfileResetter> resetter_; | 91 std::unique_ptr<ProfileResetter> resetter_; |
| 99 | 92 |
| 100 std::unique_ptr<BrandcodeConfigFetcher> config_fetcher_; | 93 std::unique_ptr<BrandcodeConfigFetcher> config_fetcher_; |
| 101 | 94 |
| 102 // Snapshot of settings before profile was reseted. | 95 // Snapshot of settings before profile was reseted. |
| 103 std::unique_ptr<ResettableSettingsSnapshot> setting_snapshot_; | 96 std::unique_ptr<ResettableSettingsSnapshot> setting_snapshot_; |
| 104 | 97 |
| 105 // Contains Chrome brand code; empty for organic Chrome. | 98 // Contains Chrome brand code; empty for organic Chrome. |
| 106 std::string brandcode_; | 99 std::string brandcode_; |
| 107 | 100 |
| 108 base::WeakPtrFactory<ResetSettingsHandler> weak_ptr_factory_; | 101 base::WeakPtrFactory<ResetSettingsHandler> weak_ptr_factory_; |
| 109 | 102 |
| 110 DISALLOW_COPY_AND_ASSIGN(ResetSettingsHandler); | 103 DISALLOW_COPY_AND_ASSIGN(ResetSettingsHandler); |
| 111 }; | 104 }; |
| 112 | 105 |
| 113 } // namespace settings | 106 } // namespace settings |
| 114 | 107 |
| 115 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_RESET_SETTINGS_HANDLER_H_ | 108 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_RESET_SETTINGS_HANDLER_H_ |
| OLD | NEW |