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

Side by Side Diff: chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_model.h

Issue 2728773006: Settings reset prompt: do not show the prompt due to policy. (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_model.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698