| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_SAFE_BROWSING_SETTINGS_RESET_PROMPT_SETTINGS_RESET_PROMPT
_MODEL_H_ | 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_SETTINGS_RESET_PROMPT_SETTINGS_RESET_PROMPT
_MODEL_H_ |
| 6 #define CHROME_BROWSER_SAFE_BROWSING_SETTINGS_RESET_PROMPT_SETTINGS_RESET_PROMPT
_MODEL_H_ | 6 #define CHROME_BROWSER_SAFE_BROWSING_SETTINGS_RESET_PROMPT_SETTINGS_RESET_PROMPT
_MODEL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 // 2. Startup URLs | 40 // 2. Startup URLs |
| 41 // 3. Homepage | 41 // 3. Homepage |
| 42 class SettingsResetPromptModel { | 42 class SettingsResetPromptModel { |
| 43 public: | 43 public: |
| 44 enum ResetState { | 44 enum ResetState { |
| 45 RESET_REQUIRED = 1, | 45 RESET_REQUIRED = 1, |
| 46 NO_RESET_REQUIRED_DUE_TO_DOMAIN_NOT_MATCHED = 2, | 46 NO_RESET_REQUIRED_DUE_TO_DOMAIN_NOT_MATCHED = 2, |
| 47 NO_RESET_REQUIRED_DUE_TO_ALREADY_PROMPTED_FOR_SETTING = 3, | 47 NO_RESET_REQUIRED_DUE_TO_ALREADY_PROMPTED_FOR_SETTING = 3, |
| 48 NO_RESET_REQUIRED_DUE_TO_RECENTLY_PROMPTED = 4, | 48 NO_RESET_REQUIRED_DUE_TO_RECENTLY_PROMPTED = 4, |
| 49 NO_RESET_REQUIRED_DUE_TO_OTHER_SETTING_REQUIRING_RESET = 5, | 49 NO_RESET_REQUIRED_DUE_TO_OTHER_SETTING_REQUIRING_RESET = 5, |
| 50 NO_RESET_REQUIRED_DUE_TO_POLICY = 6, |
| 50 }; | 51 }; |
| 51 | 52 |
| 52 using ExtensionMap = | 53 using ExtensionMap = |
| 53 std::unordered_map<extensions::ExtensionId, ExtensionInfo>; | 54 std::unordered_map<extensions::ExtensionId, ExtensionInfo>; |
| 54 using CreateCallback = | 55 using CreateCallback = |
| 55 base::Callback<void(std::unique_ptr<SettingsResetPromptModel>)>; | 56 base::Callback<void(std::unique_ptr<SettingsResetPromptModel>)>; |
| 56 | 57 |
| 57 // Creates a new |SettingsResetPromptModel| and passes it to |callback|. This | 58 // Creates a new |SettingsResetPromptModel| and passes it to |callback|. This |
| 58 // function should be called on the UI thread. | 59 // function should be called on the UI thread. |
| 59 static void Create(Profile* profile, | 60 static void Create(Profile* profile, |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 void InitExtensionData(); | 129 void InitExtensionData(); |
| 129 | 130 |
| 130 // Helper function for the Init* functions above to determine the reset state | 131 // Helper function for the Init* functions above to determine the reset state |
| 131 // of settings that have a match in the config. | 132 // of settings that have a match in the config. |
| 132 ResetState GetResetStateForSetting( | 133 ResetState GetResetStateForSetting( |
| 133 const base::Time& last_triggered_for_setting) const; | 134 const base::Time& last_triggered_for_setting) const; |
| 134 | 135 |
| 135 // Return true if any setting's reset state is set to |RESET_REQUIRED|. | 136 // Return true if any setting's reset state is set to |RESET_REQUIRED|. |
| 136 bool SomeSettingRequiresReset() const; | 137 bool SomeSettingRequiresReset() const; |
| 137 | 138 |
| 139 bool SomeSettingIsManaged() const; |
| 140 bool SomeExtensionMustRemainEnabled() const; |
| 141 |
| 138 Profile* const profile_; | 142 Profile* const profile_; |
| 139 | 143 |
| 140 SettingsResetPromptPrefsManager prefs_manager_; | 144 SettingsResetPromptPrefsManager prefs_manager_; |
| 141 std::unique_ptr<SettingsResetPromptConfig> prompt_config_; | 145 std::unique_ptr<SettingsResetPromptConfig> prompt_config_; |
| 142 std::unique_ptr<ResettableSettingsSnapshot> settings_snapshot_; | 146 std::unique_ptr<ResettableSettingsSnapshot> settings_snapshot_; |
| 143 // |default_settings_| should only be accessed on the UI thread after | 147 // |default_settings_| should only be accessed on the UI thread after |
| 144 // construction. | 148 // construction. |
| 145 std::unique_ptr<BrandcodedDefaultSettings> default_settings_; | 149 std::unique_ptr<BrandcodedDefaultSettings> default_settings_; |
| 146 std::unique_ptr<ProfileResetter> profile_resetter_; | 150 std::unique_ptr<ProfileResetter> profile_resetter_; |
| 147 | 151 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 170 ResetState startup_urls_reset_state_; | 174 ResetState startup_urls_reset_state_; |
| 171 | 175 |
| 172 ExtensionMap extensions_to_disable_; | 176 ExtensionMap extensions_to_disable_; |
| 173 | 177 |
| 174 DISALLOW_COPY_AND_ASSIGN(SettingsResetPromptModel); | 178 DISALLOW_COPY_AND_ASSIGN(SettingsResetPromptModel); |
| 175 }; | 179 }; |
| 176 | 180 |
| 177 } // namespace safe_browsing | 181 } // namespace safe_browsing |
| 178 | 182 |
| 179 #endif // CHROME_BROWSER_SAFE_BROWSING_SETTINGS_RESET_PROMPT_SETTINGS_RESET_PRO
MPT_MODEL_H_ | 183 #endif // CHROME_BROWSER_SAFE_BROWSING_SETTINGS_RESET_PROMPT_SETTINGS_RESET_PRO
MPT_MODEL_H_ |
| OLD | NEW |