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

Unified Diff: chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_model.h

Issue 2918053003: Settings reset prompt: Fetch default settings only when needed. (Closed)
Patch Set: Nit: Move function definition to match declaration order in header Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_model.h
diff --git a/chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_model.h b/chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_model.h
index 7ac123f0cdac364039debe61afa79e8fcccacc09..e866a6993cf34818e0702ff12accbe160fdce906 100644
--- a/chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_model.h
+++ b/chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_model.h
@@ -53,21 +53,11 @@ class SettingsResetPromptModel {
using ExtensionMap =
std::unordered_map<extensions::ExtensionId, ExtensionInfo>;
- using CreateCallback =
- base::Callback<void(std::unique_ptr<SettingsResetPromptModel>)>;
-
- // Creates a new |SettingsResetPromptModel| and passes it to |callback|. This
- // function should be called on the UI thread.
- static void Create(Profile* profile,
- std::unique_ptr<SettingsResetPromptConfig> prompt_config,
- CreateCallback callback);
- static std::unique_ptr<SettingsResetPromptModel> CreateForTesting(
+
+ SettingsResetPromptModel(
Profile* profile,
std::unique_ptr<SettingsResetPromptConfig> prompt_config,
- std::unique_ptr<ResettableSettingsSnapshot> settings_snapshot,
- std::unique_ptr<BrandcodedDefaultSettings> default_settings,
std::unique_ptr<ProfileResetter> profile_resetter);
-
virtual ~SettingsResetPromptModel();
Profile* profile() const;
@@ -81,7 +71,9 @@ class SettingsResetPromptModel {
// operation has been completed.
//
// NOTE: Can only be called once during the lifetime of this object.
- virtual void PerformReset(const base::Closure& done_callback);
+ virtual void PerformReset(
+ std::unique_ptr<BrandcodedDefaultSettings> default_settings,
+ const base::Closure& done_callback);
// To be called when the reset prompt dialog has been shown so that
// preferences can be updated.
virtual void DialogShown();
@@ -106,22 +98,7 @@ class SettingsResetPromptModel {
void ReportUmaMetrics() const;
- protected:
- // Exposed for mocking in tests.
- SettingsResetPromptModel(
- Profile* profile,
- std::unique_ptr<SettingsResetPromptConfig> prompt_config,
- std::unique_ptr<ResettableSettingsSnapshot> settings_snapshot,
- std::unique_ptr<BrandcodedDefaultSettings> default_settings,
- std::unique_ptr<ProfileResetter> profile_resetter);
-
private:
- static void OnSettingsFetched(
- Profile* profile,
- std::unique_ptr<SettingsResetPromptConfig> prompt_config,
- SettingsResetPromptModel::CreateCallback callback,
- std::unique_ptr<BrandcodedDefaultSettings> default_settings);
-
// Functions to be called by the constructor to initialize the model
// object. These functions should be called in the order in which they are
// declared here so that the correct setting is chosen for the prompt when
@@ -147,9 +124,6 @@ class SettingsResetPromptModel {
SettingsResetPromptPrefsManager prefs_manager_;
std::unique_ptr<SettingsResetPromptConfig> prompt_config_;
std::unique_ptr<ResettableSettingsSnapshot> settings_snapshot_;
- // |default_settings_| should only be accessed on the UI thread after
- // construction.
- std::unique_ptr<BrandcodedDefaultSettings> default_settings_;
std::unique_ptr<ProfileResetter> profile_resetter_;
// A single timestamp to be used by all initialization functions to determine

Powered by Google App Engine
This is Rietveld 408576698