OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This class gathers state related to a single user profile. | 5 // This class gathers state related to a single user profile. |
6 | 6 |
7 #ifndef CHROME_BROWSER_PROFILES_PROFILE_IMPL_H_ | 7 #ifndef CHROME_BROWSER_PROFILES_PROFILE_IMPL_H_ |
8 #define CHROME_BROWSER_PROFILES_PROFILE_IMPL_H_ | 8 #define CHROME_BROWSER_PROFILES_PROFILE_IMPL_H_ |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
17 #include "base/timer/timer.h" | 17 #include "base/timer/timer.h" |
18 #include "build/build_config.h" | 18 #include "build/build_config.h" |
| 19 #include "chrome/browser/net/net_pref_observer.h" |
19 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
20 #include "chrome/browser/profiles/profile_impl_io_data.h" | 21 #include "chrome/browser/profiles/profile_impl_io_data.h" |
21 #include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h" | 22 #include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h" |
22 #include "chrome/common/features.h" | 23 #include "chrome/common/features.h" |
23 #include "components/prefs/pref_change_registrar.h" | 24 #include "components/prefs/pref_change_registrar.h" |
24 #include "content/public/browser/content_browser_client.h" | 25 #include "content/public/browser/content_browser_client.h" |
25 #include "content/public/browser/host_zoom_map.h" | 26 #include "content/public/browser/host_zoom_map.h" |
26 #include "extensions/features/features.h" | 27 #include "extensions/features/features.h" |
27 | 28 |
28 class PrefService; | 29 class PrefService; |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 void UpdateNameInStorage(); | 182 void UpdateNameInStorage(); |
182 void UpdateAvatarInStorage(); | 183 void UpdateAvatarInStorage(); |
183 void UpdateIsEphemeralInStorage(); | 184 void UpdateIsEphemeralInStorage(); |
184 | 185 |
185 void GetCacheParameters(bool is_media_context, | 186 void GetCacheParameters(bool is_media_context, |
186 base::FilePath* cache_path, | 187 base::FilePath* cache_path, |
187 int* max_size); | 188 int* max_size); |
188 | 189 |
189 PrefProxyConfigTracker* CreateProxyConfigTracker(); | 190 PrefProxyConfigTracker* CreateProxyConfigTracker(); |
190 | 191 |
| 192 // Called on UI thread thread when net parameters change (e.g. due to policy). |
| 193 void UpdateNetParams(NetPrefObserver::NetParamsChange net_params_change); |
| 194 |
191 std::unique_ptr<domain_reliability::DomainReliabilityMonitor> | 195 std::unique_ptr<domain_reliability::DomainReliabilityMonitor> |
192 CreateDomainReliabilityMonitor(PrefService* local_state); | 196 CreateDomainReliabilityMonitor(PrefService* local_state); |
193 | 197 |
194 PrefChangeRegistrar pref_change_registrar_; | 198 PrefChangeRegistrar pref_change_registrar_; |
195 | 199 |
196 base::FilePath path_; | 200 base::FilePath path_; |
197 base::FilePath base_cache_path_; | 201 base::FilePath base_cache_path_; |
198 | 202 |
199 // !!! BIG HONKING WARNING !!! | 203 // !!! BIG HONKING WARNING !!! |
200 // The order of the members below is important. Do not change it unless | 204 // The order of the members below is important. Do not change it unless |
201 // you know what you're doing. Also, if adding a new member here make sure | 205 // you know what you're doing. Also, if adding a new member here make sure |
202 // that the declaration occurs AFTER things it depends on as destruction | 206 // that the declaration occurs AFTER things it depends on as destruction |
203 // happens in reverse order of declaration. | 207 // happens in reverse order of declaration. |
204 | 208 |
205 // TODO(mnissler, joaodasilva): The |profile_policy_connector_| provides the | 209 // TODO(mnissler, joaodasilva): The |profile_policy_connector_| provides the |
206 // PolicyService that the |prefs_| depend on, and must outlive |prefs_|. | 210 // PolicyService that the |prefs_| depend on, and must outlive |prefs_|. |
207 // This can be removed once |prefs_| becomes a KeyedService too. | 211 // This can be removed once |prefs_| becomes a KeyedService too. |
208 // |profile_policy_connector_| in turn depends on |cloud_policy_manager_|, | 212 // |profile_policy_connector_| in turn depends on |cloud_policy_manager_|, |
209 // which depends on |schema_registry_service_|. | 213 // which depends on |schema_registry_service_|. |
210 std::unique_ptr<policy::SchemaRegistryService> schema_registry_service_; | 214 std::unique_ptr<policy::SchemaRegistryService> schema_registry_service_; |
211 std::unique_ptr<policy::CloudPolicyManager> cloud_policy_manager_; | 215 std::unique_ptr<policy::CloudPolicyManager> cloud_policy_manager_; |
212 std::unique_ptr<policy::ProfilePolicyConnector> profile_policy_connector_; | 216 std::unique_ptr<policy::ProfilePolicyConnector> profile_policy_connector_; |
213 | 217 |
214 // Keep |pref_validation_delegate_| above |prefs_| so that the former outlives | 218 // Keep |pref_validation_delegate_| above |prefs_| so that the former outlives |
215 // the latter. | 219 // the latter. |
216 std::unique_ptr<TrackedPreferenceValidationDelegate> | 220 std::unique_ptr<TrackedPreferenceValidationDelegate> |
217 pref_validation_delegate_; | 221 pref_validation_delegate_; |
218 | 222 |
219 // Keep |prefs_| on top for destruction order because |extension_prefs_|, | 223 // Keep |prefs_| on top for destruction order because |extension_prefs_|, |
220 // |io_data_| and others store pointers to |prefs_| and shall be destructed | 224 // |net_pref_observer_|, |io_data_| and others store pointers to |prefs_| and |
221 // first. | 225 // shall be destructed first. |
222 scoped_refptr<user_prefs::PrefRegistrySyncable> pref_registry_; | 226 scoped_refptr<user_prefs::PrefRegistrySyncable> pref_registry_; |
223 std::unique_ptr<sync_preferences::PrefServiceSyncable> prefs_; | 227 std::unique_ptr<sync_preferences::PrefServiceSyncable> prefs_; |
224 std::unique_ptr<sync_preferences::PrefServiceSyncable> otr_prefs_; | 228 std::unique_ptr<sync_preferences::PrefServiceSyncable> otr_prefs_; |
225 ProfileImplIOData::Handle io_data_; | 229 ProfileImplIOData::Handle io_data_; |
226 #if BUILDFLAG(ENABLE_EXTENSIONS) | 230 #if BUILDFLAG(ENABLE_EXTENSIONS) |
227 scoped_refptr<ExtensionSpecialStoragePolicy> | 231 scoped_refptr<ExtensionSpecialStoragePolicy> |
228 extension_special_storage_policy_; | 232 extension_special_storage_policy_; |
229 #endif | 233 #endif |
| 234 std::unique_ptr<NetPrefObserver> net_pref_observer_; |
230 std::unique_ptr<ssl_config::SSLConfigServiceManager> | 235 std::unique_ptr<ssl_config::SSLConfigServiceManager> |
231 ssl_config_service_manager_; | 236 ssl_config_service_manager_; |
232 | 237 |
233 // Exit type the last time the profile was opened. This is set only once from | 238 // Exit type the last time the profile was opened. This is set only once from |
234 // prefs. | 239 // prefs. |
235 ExitType last_session_exit_type_; | 240 ExitType last_session_exit_type_; |
236 | 241 |
237 #if BUILDFLAG(ENABLE_SESSION_SERVICE) | 242 #if BUILDFLAG(ENABLE_SESSION_SERVICE) |
238 base::OneShotTimer create_session_service_timer_; | 243 base::OneShotTimer create_session_service_timer_; |
239 #endif | 244 #endif |
(...skipping 26 matching lines...) Expand all Loading... |
266 // components/keyed_service/content/browser_context_keyed_service_factory.* | 271 // components/keyed_service/content/browser_context_keyed_service_factory.* |
267 | 272 |
268 Profile::Delegate* delegate_; | 273 Profile::Delegate* delegate_; |
269 | 274 |
270 chrome_browser_net::Predictor* predictor_; | 275 chrome_browser_net::Predictor* predictor_; |
271 | 276 |
272 DISALLOW_COPY_AND_ASSIGN(ProfileImpl); | 277 DISALLOW_COPY_AND_ASSIGN(ProfileImpl); |
273 }; | 278 }; |
274 | 279 |
275 #endif // CHROME_BROWSER_PROFILES_PROFILE_IMPL_H_ | 280 #endif // CHROME_BROWSER_PROFILES_PROFILE_IMPL_H_ |
OLD | NEW |