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 #ifndef CHROME_BROWSER_PROFILES_PROFILE_IMPL_IO_DATA_H_ | 5 #ifndef CHROME_BROWSER_PROFILES_PROFILE_IMPL_IO_DATA_H_ |
6 #define CHROME_BROWSER_PROFILES_PROFILE_IMPL_IO_DATA_H_ | 6 #define CHROME_BROWSER_PROFILES_PROFILE_IMPL_IO_DATA_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/prefs/pref_store.h" |
| 13 #include "base/timer/timer.h" |
12 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 14 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
13 #include "chrome/browser/net/chrome_url_request_context_getter.h" | 15 #include "chrome/browser/net/chrome_url_request_context_getter.h" |
14 #include "chrome/browser/profiles/profile_io_data.h" | 16 #include "chrome/browser/profiles/profile_io_data.h" |
15 #include "content/public/browser/cookie_store_factory.h" | 17 #include "content/public/browser/cookie_store_factory.h" |
16 | 18 |
| 19 class JsonPrefStore; |
| 20 |
17 namespace chrome_browser_net { | 21 namespace chrome_browser_net { |
18 class Predictor; | 22 class Predictor; |
19 } // namespace chrome_browser_net | 23 } // namespace chrome_browser_net |
20 | 24 |
21 namespace content { | 25 namespace content { |
22 class CookieCryptoDelegate; | 26 class CookieCryptoDelegate; |
23 } // namespace content | 27 } // namespace content |
24 | 28 |
25 namespace data_reduction_proxy { | 29 namespace data_reduction_proxy { |
26 class DataReductionProxyNetworkDelegate; | 30 class DataReductionProxyNetworkDelegate; |
(...skipping 10 matching lines...) Expand all Loading... |
37 class HttpTransactionFactory; | 41 class HttpTransactionFactory; |
38 class ProxyConfig; | 42 class ProxyConfig; |
39 class SdchManager; | 43 class SdchManager; |
40 class SdchOwner; | 44 class SdchOwner; |
41 } // namespace net | 45 } // namespace net |
42 | 46 |
43 namespace storage { | 47 namespace storage { |
44 class SpecialStoragePolicy; | 48 class SpecialStoragePolicy; |
45 } // namespace storage | 49 } // namespace storage |
46 | 50 |
47 class ProfileImplIOData : public ProfileIOData { | 51 class ProfileImplIOData : public ProfileIOData, public PrefStore::Observer { |
48 public: | 52 public: |
49 class Handle { | 53 class Handle { |
50 public: | 54 public: |
51 explicit Handle(Profile* profile); | 55 explicit Handle(Profile* profile); |
52 ~Handle(); | 56 ~Handle(); |
53 | 57 |
54 // Init() must be called before ~Handle(). It records most of the | 58 // Init() must be called before ~Handle(). It records most of the |
55 // parameters needed to construct a ChromeURLRequestContextGetter. | 59 // parameters needed to construct a ChromeURLRequestContextGetter. |
56 void Init( | 60 void Init( |
57 const base::FilePath& cookie_path, | 61 const base::FilePath& cookie_path, |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 net::URLRequestContext* app_context, | 206 net::URLRequestContext* app_context, |
203 const StoragePartitionDescriptor& partition_descriptor) const override; | 207 const StoragePartitionDescriptor& partition_descriptor) const override; |
204 | 208 |
205 // Deletes all network related data since |time|. It deletes transport | 209 // Deletes all network related data since |time|. It deletes transport |
206 // security state since |time| and also deletes HttpServerProperties data. | 210 // security state since |time| and also deletes HttpServerProperties data. |
207 // Works asynchronously, however if the |completion| callback is non-null, | 211 // Works asynchronously, however if the |completion| callback is non-null, |
208 // it will be posted on the UI thread once the removal process completes. | 212 // it will be posted on the UI thread once the removal process completes. |
209 void ClearNetworkingHistorySinceOnIOThread(base::Time time, | 213 void ClearNetworkingHistorySinceOnIOThread(base::Time time, |
210 const base::Closure& completion); | 214 const base::Closure& completion); |
211 | 215 |
| 216 void FlushPrefsToDisk(); |
| 217 |
| 218 // PrefStore::Observer |
| 219 void OnPrefValueChanged(const std::string& key) override; |
| 220 void OnInitializationCompleted(bool succeeded) override; |
| 221 |
212 mutable scoped_ptr<data_reduction_proxy::DataReductionProxyNetworkDelegate> | 222 mutable scoped_ptr<data_reduction_proxy::DataReductionProxyNetworkDelegate> |
213 network_delegate_; | 223 network_delegate_; |
214 | 224 |
215 // Lazy initialization params. | 225 // Lazy initialization params. |
216 mutable scoped_ptr<LazyParams> lazy_params_; | 226 mutable scoped_ptr<LazyParams> lazy_params_; |
217 | 227 |
| 228 mutable scoped_refptr<JsonPrefStore> network_json_store_; |
| 229 base::Timer network_store_commit_timer_; |
| 230 |
218 mutable scoped_ptr<net::HttpTransactionFactory> main_http_factory_; | 231 mutable scoped_ptr<net::HttpTransactionFactory> main_http_factory_; |
219 mutable scoped_ptr<net::FtpTransactionFactory> ftp_factory_; | 232 mutable scoped_ptr<net::FtpTransactionFactory> ftp_factory_; |
220 | 233 |
221 // Same as |ProfileIOData::http_server_properties_|, owned there to maintain | 234 // Same as |ProfileIOData::http_server_properties_|, owned there to maintain |
222 // destruction ordering. | 235 // destruction ordering. |
223 mutable net::HttpServerPropertiesManager* http_server_properties_manager_; | 236 mutable net::HttpServerPropertiesManager* http_server_properties_manager_; |
224 | 237 |
225 mutable scoped_ptr<chrome_browser_net::Predictor> predictor_; | 238 mutable scoped_ptr<chrome_browser_net::Predictor> predictor_; |
226 | 239 |
227 mutable scoped_ptr<net::URLRequestContext> media_request_context_; | 240 mutable scoped_ptr<net::URLRequestContext> media_request_context_; |
228 | 241 |
229 mutable scoped_ptr<net::URLRequestJobFactory> main_job_factory_; | 242 mutable scoped_ptr<net::URLRequestJobFactory> main_job_factory_; |
230 mutable scoped_ptr<net::URLRequestJobFactory> extensions_job_factory_; | 243 mutable scoped_ptr<net::URLRequestJobFactory> extensions_job_factory_; |
231 | 244 |
232 mutable scoped_ptr<domain_reliability::DomainReliabilityMonitor> | 245 mutable scoped_ptr<domain_reliability::DomainReliabilityMonitor> |
233 domain_reliability_monitor_; | 246 domain_reliability_monitor_; |
234 | 247 |
235 mutable scoped_ptr<net::SdchManager> sdch_manager_; | 248 mutable scoped_ptr<net::SdchManager> sdch_manager_; |
236 mutable scoped_ptr<net::SdchOwner> sdch_policy_; | 249 mutable scoped_ptr<net::SdchOwner> sdch_policy_; |
237 | 250 |
238 // Parameters needed for isolated apps. | 251 // Parameters needed for isolated apps. |
239 base::FilePath profile_path_; | 252 base::FilePath profile_path_; |
240 int app_cache_max_size_; | 253 int app_cache_max_size_; |
241 int app_media_cache_max_size_; | 254 int app_media_cache_max_size_; |
242 | 255 |
| 256 base::WeakPtrFactory<ProfileImplIOData> factory_; |
| 257 |
243 DISALLOW_COPY_AND_ASSIGN(ProfileImplIOData); | 258 DISALLOW_COPY_AND_ASSIGN(ProfileImplIOData); |
244 }; | 259 }; |
245 | 260 |
246 #endif // CHROME_BROWSER_PROFILES_PROFILE_IMPL_IO_DATA_H_ | 261 #endif // CHROME_BROWSER_PROFILES_PROFILE_IMPL_IO_DATA_H_ |
OLD | NEW |