| 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 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "chrome/browser/profile_resetter/profile_reset_report.pb.h" |
| 14 #include "chrome/browser/ui/webui/options/options_ui.h" | 15 #include "chrome/browser/ui/webui/options/options_ui.h" |
| 15 | 16 |
| 16 namespace base { | 17 namespace base { |
| 17 class DictionaryValue; | 18 class DictionaryValue; |
| 18 class ListValue; | 19 class ListValue; |
| 19 } // namespace base | 20 } // namespace base |
| 20 | 21 |
| 21 class BrandcodeConfigFetcher; | 22 class BrandcodeConfigFetcher; |
| 22 class ProfileResetter; | 23 class ProfileResetter; |
| 23 class ResettableSettingsSnapshot; | 24 class ResettableSettingsSnapshot; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 43 void InitializePage() override; | 44 void InitializePage() override; |
| 44 | 45 |
| 45 // WebUIMessageHandler implementation. | 46 // WebUIMessageHandler implementation. |
| 46 void RegisterMessages() override; | 47 void RegisterMessages() override; |
| 47 | 48 |
| 48 private: | 49 private: |
| 49 // Javascript callback to start clearing data. | 50 // Javascript callback to start clearing data. |
| 50 void HandleResetProfileSettings(const base::ListValue* value); | 51 void HandleResetProfileSettings(const base::ListValue* value); |
| 51 | 52 |
| 52 // Closes the dialog once all requested settings has been reset. | 53 // Closes the dialog once all requested settings has been reset. |
| 53 void OnResetProfileSettingsDone(bool send_feedback, | 54 void OnResetProfileSettingsDone( |
| 54 const std::string& reset_request_origin); | 55 bool send_feedback, |
| 56 reset_report::ChromeResetReport::ResetRequestOrigin request_origin); |
| 55 | 57 |
| 56 // Called when the confirmation box appears. | 58 // Called when the confirmation box appears. |
| 57 void OnShowResetProfileDialog(const base::ListValue* value); | 59 void OnShowResetProfileDialog(const base::ListValue* value); |
| 58 | 60 |
| 59 // Called when the confirmation box disappears. | 61 // Called when the confirmation box disappears. |
| 60 void OnHideResetProfileDialog(const base::ListValue* value); | 62 void OnHideResetProfileDialog(const base::ListValue* value); |
| 61 | 63 |
| 62 // Called when BrandcodeConfigFetcher completed fetching settings. | 64 // Called when BrandcodeConfigFetcher completed fetching settings. |
| 63 void OnSettingsFetched(); | 65 void OnSettingsFetched(); |
| 64 | 66 |
| 65 // Resets profile settings to default values. |send_settings| is true if user | 67 // Resets profile settings to default values. |send_settings| is true if user |
| 66 // gave his consent to upload broken settings to Google for analysis. | 68 // gave his consent to upload broken settings to Google for analysis. |
| 67 void ResetProfile(bool send_settings, | 69 void ResetProfile( |
| 68 const std::string& reset_request_origin); | 70 bool send_settings, |
| 71 reset_report::ChromeResetReport::ResetRequestOrigin request_origin); |
| 69 | 72 |
| 70 // Sets new values for the feedback area. | 73 // Sets new values for the feedback area. |
| 71 void UpdateFeedbackUI(); | 74 void UpdateFeedbackUI(); |
| 72 | 75 |
| 73 std::unique_ptr<ProfileResetter> resetter_; | 76 std::unique_ptr<ProfileResetter> resetter_; |
| 74 | 77 |
| 75 std::unique_ptr<BrandcodeConfigFetcher> config_fetcher_; | 78 std::unique_ptr<BrandcodeConfigFetcher> config_fetcher_; |
| 76 | 79 |
| 77 // Snapshot of settings before profile was reseted. | 80 // Snapshot of settings before profile was reseted. |
| 78 std::unique_ptr<ResettableSettingsSnapshot> setting_snapshot_; | 81 std::unique_ptr<ResettableSettingsSnapshot> setting_snapshot_; |
| 79 | 82 |
| 80 // Contains Chrome brand code; empty for organic Chrome. | 83 // Contains Chrome brand code; empty for organic Chrome. |
| 81 std::string brandcode_; | 84 std::string brandcode_; |
| 82 | 85 |
| 83 DISALLOW_COPY_AND_ASSIGN(ResetProfileSettingsHandler); | 86 DISALLOW_COPY_AND_ASSIGN(ResetProfileSettingsHandler); |
| 84 }; | 87 }; |
| 85 | 88 |
| 86 } // namespace options | 89 } // namespace options |
| 87 | 90 |
| 88 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_RESET_PROFILE_SETTINGS_HANDLER_H_ | 91 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_RESET_PROFILE_SETTINGS_HANDLER_H_ |
| OLD | NEW |