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/hash_tables.h" | 10 #include "base/hash_tables.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 class SpecialStoragePolicy; | 26 class SpecialStoragePolicy; |
27 } // namespace quota | 27 } // namespace quota |
28 | 28 |
29 class ProfileImplIOData : public ProfileIOData { | 29 class ProfileImplIOData : public ProfileIOData { |
30 public: | 30 public: |
31 class Handle { | 31 class Handle { |
32 public: | 32 public: |
33 explicit Handle(Profile* profile); | 33 explicit Handle(Profile* profile); |
34 ~Handle(); | 34 ~Handle(); |
35 | 35 |
36 bool HasMainRequestContext() const { | 36 // Init() must be called before ~Handle(). It records most of the |
37 return main_request_context_getter_ != NULL; | |
38 } | |
39 | |
40 // Init() must be called before ~Handle(). It records all the necessary | |
41 // parameters needed to construct a ChromeURLRequestContextGetter. | 37 // parameters needed to construct a ChromeURLRequestContextGetter. |
42 void Init(const FilePath& cookie_path, | 38 void Init(const FilePath& cookie_path, |
43 const FilePath& server_bound_cert_path, | 39 const FilePath& server_bound_cert_path, |
44 const FilePath& cache_path, | 40 const FilePath& cache_path, |
45 int cache_max_size, | 41 int cache_max_size, |
46 const FilePath& media_cache_path, | 42 const FilePath& media_cache_path, |
47 int media_cache_max_size, | 43 int media_cache_max_size, |
48 const FilePath& extensions_cookie_path, | 44 const FilePath& extensions_cookie_path, |
49 const FilePath& profile_path, | 45 const FilePath& profile_path, |
50 const FilePath& infinite_cache_path, | 46 const FilePath& infinite_cache_path, |
51 chrome_browser_net::Predictor* predictor, | 47 chrome_browser_net::Predictor* predictor, |
52 PrefService* local_state, | |
53 IOThread* io_thread, | |
54 bool restore_old_session_cookies, | 48 bool restore_old_session_cookies, |
55 quota::SpecialStoragePolicy* special_storage_policy); | 49 quota::SpecialStoragePolicy* special_storage_policy); |
56 | 50 |
| 51 // These Create*ContextGetter() functions are only exposed because the |
| 52 // circular relationship between Profile, ProfileIOData::Handle, and the |
| 53 // ChromeURLRequestContextGetter factories requires Profile be able to call |
| 54 // these functions. |
| 55 scoped_refptr<ChromeURLRequestContextGetter> |
| 56 CreateMainRequestContextGetter( |
| 57 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 58 blob_protocol_handler, |
| 59 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 60 file_system_protocol_handler, |
| 61 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
| 62 developer_protocol_handler, |
| 63 PrefService* local_state, |
| 64 IOThread* io_thread) const; |
| 65 scoped_refptr<ChromeURLRequestContextGetter> |
| 66 CreateIsolatedAppRequestContextGetter( |
| 67 const FilePath& partition_path, |
| 68 bool in_memory, |
| 69 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 70 blob_protocol_handler, |
| 71 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 72 file_system_protocol_handler, |
| 73 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
| 74 developer_protocol_handler) const; |
| 75 |
57 base::Callback<ChromeURLDataManagerBackend*(void)> | 76 base::Callback<ChromeURLDataManagerBackend*(void)> |
58 GetChromeURLDataManagerBackendGetter() const; | 77 GetChromeURLDataManagerBackendGetter() const; |
59 content::ResourceContext* GetResourceContext() const; | 78 content::ResourceContext* GetResourceContext() const; |
60 // GetResourceContextNoInit() does not call LazyInitialize() so it can be | 79 // GetResourceContextNoInit() does not call LazyInitialize() so it can be |
61 // safely be used during initialization. | 80 // safely be used during initialization. |
62 content::ResourceContext* GetResourceContextNoInit() const; | 81 content::ResourceContext* GetResourceContextNoInit() const; |
63 scoped_refptr<ChromeURLRequestContextGetter> | 82 scoped_refptr<ChromeURLRequestContextGetter> |
64 GetMainRequestContextGetter() const; | |
65 scoped_refptr<ChromeURLRequestContextGetter> | |
66 GetMediaRequestContextGetter() const; | 83 GetMediaRequestContextGetter() const; |
67 scoped_refptr<ChromeURLRequestContextGetter> | 84 scoped_refptr<ChromeURLRequestContextGetter> |
68 GetExtensionsRequestContextGetter() const; | 85 GetExtensionsRequestContextGetter() const; |
69 scoped_refptr<ChromeURLRequestContextGetter> | 86 scoped_refptr<ChromeURLRequestContextGetter> |
70 GetIsolatedAppRequestContextGetter( | |
71 const FilePath& partition_path, | |
72 bool in_memory) const; | |
73 scoped_refptr<ChromeURLRequestContextGetter> | |
74 GetIsolatedMediaRequestContextGetter( | 87 GetIsolatedMediaRequestContextGetter( |
75 const FilePath& partition_path, | 88 const FilePath& partition_path, |
76 bool in_memory) const; | 89 bool in_memory) const; |
77 | 90 |
78 // Deletes all network related data since |time|. It deletes transport | 91 // Deletes all network related data since |time|. It deletes transport |
79 // security state since |time| and also deletes HttpServerProperties data. | 92 // security state since |time| and also deletes HttpServerProperties data. |
80 // Works asynchronously, however if the |completion| callback is non-null, | 93 // Works asynchronously, however if the |completion| callback is non-null, |
81 // it will be posted on the UI thread once the removal process completes. | 94 // it will be posted on the UI thread once the removal process completes. |
82 void ClearNetworkingHistorySince(base::Time time, | 95 void ClearNetworkingHistorySince(base::Time time, |
83 const base::Closure& completion); | 96 const base::Closure& completion); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 bool restore_old_session_cookies; | 151 bool restore_old_session_cookies; |
139 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy; | 152 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy; |
140 }; | 153 }; |
141 | 154 |
142 typedef base::hash_map<std::string, net::HttpTransactionFactory* > | 155 typedef base::hash_map<std::string, net::HttpTransactionFactory* > |
143 HttpTransactionFactoryMap; | 156 HttpTransactionFactoryMap; |
144 | 157 |
145 ProfileImplIOData(); | 158 ProfileImplIOData(); |
146 virtual ~ProfileImplIOData(); | 159 virtual ~ProfileImplIOData(); |
147 | 160 |
148 virtual void LazyInitializeInternal( | 161 virtual void InitializeInternal( |
149 ProfileParams* profile_params) const OVERRIDE; | 162 ProfileParams* profile_params, |
| 163 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 164 blob_protocol_handler, |
| 165 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 166 file_system_protocol_handler, |
| 167 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
| 168 developer_protocol_handler) const OVERRIDE; |
150 virtual void InitializeExtensionsRequestContext( | 169 virtual void InitializeExtensionsRequestContext( |
151 ProfileParams* profile_params) const OVERRIDE; | 170 ProfileParams* profile_params) const OVERRIDE; |
152 virtual ChromeURLRequestContext* InitializeAppRequestContext( | 171 virtual ChromeURLRequestContext* InitializeAppRequestContext( |
153 ChromeURLRequestContext* main_context, | 172 ChromeURLRequestContext* main_context, |
154 const StoragePartitionDescriptor& partition_descriptor, | 173 const StoragePartitionDescriptor& partition_descriptor, |
155 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 174 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
156 protocol_handler_interceptor) const OVERRIDE; | 175 protocol_handler_interceptor, |
| 176 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 177 blob_protocol_handler, |
| 178 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 179 file_system_protocol_handler, |
| 180 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
| 181 developer_protocol_handler) const OVERRIDE; |
157 virtual ChromeURLRequestContext* InitializeMediaRequestContext( | 182 virtual ChromeURLRequestContext* InitializeMediaRequestContext( |
158 ChromeURLRequestContext* original_context, | 183 ChromeURLRequestContext* original_context, |
159 const StoragePartitionDescriptor& partition_descriptor) const OVERRIDE; | 184 const StoragePartitionDescriptor& partition_descriptor) const OVERRIDE; |
160 virtual ChromeURLRequestContext* | 185 virtual ChromeURLRequestContext* |
161 AcquireMediaRequestContext() const OVERRIDE; | 186 AcquireMediaRequestContext() const OVERRIDE; |
162 virtual ChromeURLRequestContext* | 187 virtual ChromeURLRequestContext* |
163 AcquireIsolatedAppRequestContext( | 188 AcquireIsolatedAppRequestContext( |
164 ChromeURLRequestContext* main_context, | 189 ChromeURLRequestContext* main_context, |
165 const StoragePartitionDescriptor& partition_descriptor, | 190 const StoragePartitionDescriptor& partition_descriptor, |
166 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 191 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
167 protocol_handler_interceptor) const OVERRIDE; | 192 protocol_handler_interceptor, |
| 193 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 194 blob_protocol_handler, |
| 195 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 196 file_system_protocol_handler, |
| 197 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
| 198 developer_protocol_handler) const OVERRIDE; |
168 virtual ChromeURLRequestContext* | 199 virtual ChromeURLRequestContext* |
169 AcquireIsolatedMediaRequestContext( | 200 AcquireIsolatedMediaRequestContext( |
170 ChromeURLRequestContext* app_context, | 201 ChromeURLRequestContext* app_context, |
171 const StoragePartitionDescriptor& partition_descriptor) | 202 const StoragePartitionDescriptor& partition_descriptor) |
172 const OVERRIDE; | 203 const OVERRIDE; |
173 virtual chrome_browser_net::LoadTimeStats* GetLoadTimeStats( | 204 virtual chrome_browser_net::LoadTimeStats* GetLoadTimeStats( |
174 IOThread::Globals* io_thread_globals) const OVERRIDE; | 205 IOThread::Globals* io_thread_globals) const OVERRIDE; |
175 | 206 |
176 // Deletes all network related data since |time|. It deletes transport | 207 // Deletes all network related data since |time|. It deletes transport |
177 // security state since |time| and also deletes HttpServerProperties data. | 208 // security state since |time| and also deletes HttpServerProperties data. |
(...skipping 22 matching lines...) Expand all Loading... |
200 | 231 |
201 // Parameters needed for isolated apps. | 232 // Parameters needed for isolated apps. |
202 FilePath profile_path_; | 233 FilePath profile_path_; |
203 int app_cache_max_size_; | 234 int app_cache_max_size_; |
204 int app_media_cache_max_size_; | 235 int app_media_cache_max_size_; |
205 | 236 |
206 DISALLOW_COPY_AND_ASSIGN(ProfileImplIOData); | 237 DISALLOW_COPY_AND_ASSIGN(ProfileImplIOData); |
207 }; | 238 }; |
208 | 239 |
209 #endif // CHROME_BROWSER_PROFILES_PROFILE_IMPL_IO_DATA_H_ | 240 #endif // CHROME_BROWSER_PROFILES_PROFILE_IMPL_IO_DATA_H_ |
OLD | NEW |