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

Unified Diff: chrome/browser/ui/webui/settings/reset_settings_handler.h

Issue 1490503002: MD Settings: Adding unit test for ResetSettingsHandler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing comments. Created 5 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/settings/reset_settings_handler.h
diff --git a/chrome/browser/ui/webui/settings/reset_settings_handler.h b/chrome/browser/ui/webui/settings/reset_settings_handler.h
index 04079471a24444503c1efc49a24841d2d9cb3d4c..cefeb82f3f4a2ddb42b18de23a9d58580399e106 100644
--- a/chrome/browser/ui/webui/settings/reset_settings_handler.h
+++ b/chrome/browser/ui/webui/settings/reset_settings_handler.h
@@ -23,6 +23,7 @@ class WebUIDataSource;
}
class BrandcodeConfigFetcher;
+class Profile;
class ProfileResetter;
class ResettableSettingsSnapshot;
@@ -35,26 +36,33 @@ class ResetSettingsHandler
: public SettingsPageUIHandler,
public base::SupportsWeakPtr<ResetSettingsHandler> {
public:
- explicit ResetSettingsHandler(
- content::WebUIDataSource* html_source, content::WebUI* web_ui);
~ResetSettingsHandler() override;
+ static ResetSettingsHandler* Create(
+ content::WebUIDataSource* html_source, Profile* profile);
+
// WebUIMessageHandler implementation.
void RegisterMessages() override;
- private:
+ protected:
+ ResetSettingsHandler(Profile* profile, bool allow_powerwash);
+
+ // Overriden in tests to substitute with a test version of ProfileResetter.
+ virtual ProfileResetter* GetResetter();
+
// Javascript callback to start clearing data.
void HandleResetProfileSettings(const base::ListValue* value);
- // Closes the dialog once all requested settings has been reset.
- void OnResetProfileSettingsDone(bool send_feedback);
-
+ private:
// Called when the confirmation box appears.
void OnShowResetProfileDialog(const base::ListValue* value);
// Called when the confirmation box disappears.
void OnHideResetProfileDialog(const base::ListValue* value);
+ // Closes the dialog once all requested settings has been reset.
+ void OnResetProfileSettingsDone(bool send_feedback);
Dan Beam 2015/12/02 04:40:07 nit: revert moving of this method to maintain the
dpapad 2015/12/02 19:55:22 Done.
+
// Called when BrandcodeConfigFetcher completed fetching settings.
void OnSettingsFetched();
@@ -77,6 +85,8 @@ class ResetSettingsHandler
bool allow_powerwash_ = false;
#endif // defined(OS_CHROMEOS)
+ Profile* profile_;
Dan Beam 2015/12/02 04:40:08 nit: Profile* const profile_;
dpapad 2015/12/02 19:55:22 Done.
+
scoped_ptr<ProfileResetter> resetter_;
scoped_ptr<BrandcodeConfigFetcher> config_fetcher_;

Powered by Google App Engine
This is Rietveld 408576698