Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: chrome/browser/ui/webui/settings/reset_settings_handler.h

Issue 2411383003: md-settings: add reset request origin to reset feedback proto. (Closed)
Patch Set: Addressed dbeam@'s comments Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 "build/build_config.h" 14 #include "build/build_config.h"
15 #include "chrome/browser/profile_resetter/profile_reset_report.pb.h"
15 #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h" 16 #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
16 17
17 namespace base { 18 namespace base {
18 class DictionaryValue; 19 class DictionaryValue;
19 class ListValue; 20 class ListValue;
20 } // namespace base 21 } // namespace base
21 22
22 namespace content { 23 namespace content {
23 class WebUIDataSource; 24 class WebUIDataSource;
24 } 25 }
25 26
26 class BrandcodeConfigFetcher; 27 class BrandcodeConfigFetcher;
27 class Profile; 28 class Profile;
28 class ProfileResetter; 29 class ProfileResetter;
29 class ResettableSettingsSnapshot; 30 class ResettableSettingsSnapshot;
30 31
31 namespace settings { 32 namespace settings {
32 33
33 // Handler for 34 // Handler for
34 // 1) 'Reset Profile Settings' dialog 35 // 1) 'Reset Profile Settings' dialog
35 // 2) 'Powerwash' dialog (ChromeOS only) 36 // 2) 'Powerwash' dialog (ChromeOS only)
36 class ResetSettingsHandler : public SettingsPageUIHandler { 37 class ResetSettingsHandler : public SettingsPageUIHandler {
37 public: 38 public:
39 // Hash used by the Chrome Cleanup Tool when launching chrome with the reset
40 // profile settings URL.
41 static const char kCctResetSettingsHash[];
42
38 ~ResetSettingsHandler() override; 43 ~ResetSettingsHandler() override;
39 44
40 static ResetSettingsHandler* Create( 45 static ResetSettingsHandler* Create(
41 content::WebUIDataSource* html_source, Profile* profile); 46 content::WebUIDataSource* html_source, Profile* profile);
42 47
43 // WebUIMessageHandler implementation. 48 // WebUIMessageHandler implementation.
44 void RegisterMessages() override; 49 void RegisterMessages() override;
45 void OnJavascriptAllowed() override {} 50 void OnJavascriptAllowed() override {}
46 void OnJavascriptDisallowed() override {} 51 void OnJavascriptDisallowed() override {}
47 52
(...skipping 23 matching lines...) Expand all
71 void OnHideResetProfileBanner(const base::ListValue* args); 76 void OnHideResetProfileBanner(const base::ListValue* args);
72 77
73 // Retrieve the triggered reset tool name, called from Javascript. 78 // Retrieve the triggered reset tool name, called from Javascript.
74 void HandleGetTriggeredResetToolName(const base::ListValue* args); 79 void HandleGetTriggeredResetToolName(const base::ListValue* args);
75 80
76 // Called when BrandcodeConfigFetcher completed fetching settings. 81 // Called when BrandcodeConfigFetcher completed fetching settings.
77 void OnSettingsFetched(); 82 void OnSettingsFetched();
78 83
79 // Resets profile settings to default values. |send_settings| is true if user 84 // Resets profile settings to default values. |send_settings| is true if user
80 // gave their consent to upload broken settings to Google for analysis. 85 // gave their consent to upload broken settings to Google for analysis.
81 void ResetProfile(std::string callback_id, bool send_settings); 86 void ResetProfile(
87 const std::string& callback_id,
88 bool send_settings,
89 reset_report::ChromeResetReport::ResetRequestOrigin request_origin);
82 90
83 // Closes the dialog once all requested settings has been reset. 91 // Closes the dialog once all requested settings has been reset.
84 void OnResetProfileSettingsDone(std::string callback_id, 92 void OnResetProfileSettingsDone(
85 bool send_feedback); 93 std::string callback_id,
94 bool send_feedback,
95 reset_report::ChromeResetReport::ResetRequestOrigin request_origin);
86 96
87 #if defined(OS_CHROMEOS) 97 #if defined(OS_CHROMEOS)
88 // Will be called when powerwash dialog is shown. 98 // Will be called when powerwash dialog is shown.
89 void OnShowPowerwashDialog(const base::ListValue* args); 99 void OnShowPowerwashDialog(const base::ListValue* args);
90 #endif // defined(OS_CHROMEOS) 100 #endif // defined(OS_CHROMEOS)
91 101
92 Profile* const profile_; 102 Profile* const profile_;
93 103
94 std::unique_ptr<ProfileResetter> resetter_; 104 std::unique_ptr<ProfileResetter> resetter_;
95 105
96 std::unique_ptr<BrandcodeConfigFetcher> config_fetcher_; 106 std::unique_ptr<BrandcodeConfigFetcher> config_fetcher_;
97 107
98 // Snapshot of settings before profile was reseted. 108 // Snapshot of settings before profile was reseted.
99 std::unique_ptr<ResettableSettingsSnapshot> setting_snapshot_; 109 std::unique_ptr<ResettableSettingsSnapshot> setting_snapshot_;
100 110
101 // Contains Chrome brand code; empty for organic Chrome. 111 // Contains Chrome brand code; empty for organic Chrome.
102 std::string brandcode_; 112 std::string brandcode_;
103 113
104 base::WeakPtrFactory<ResetSettingsHandler> weak_ptr_factory_; 114 base::WeakPtrFactory<ResetSettingsHandler> weak_ptr_factory_;
105 115
106 DISALLOW_COPY_AND_ASSIGN(ResetSettingsHandler); 116 DISALLOW_COPY_AND_ASSIGN(ResetSettingsHandler);
107 }; 117 };
108 118
109 } // namespace settings 119 } // namespace settings
110 120
111 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_RESET_SETTINGS_HANDLER_H_ 121 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_RESET_SETTINGS_HANDLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/startup/startup_browser_creator.cc ('k') | chrome/browser/ui/webui/settings/reset_settings_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698