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::ProtocolHandler> |
| 62 developer_protocol_handler, |
| 63 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 64 chrome_protocol_handler, |
| 65 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 66 chrome_devtools_protocol_handler, |
| 67 PrefService* local_state, |
| 68 IOThread* io_thread) const; |
| 69 scoped_refptr<ChromeURLRequestContextGetter> |
| 70 CreateIsolatedAppRequestContextGetter( |
| 71 const FilePath& partition_path, |
| 72 bool in_memory, |
| 73 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 74 blob_protocol_handler, |
| 75 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 76 file_system_protocol_handler, |
| 77 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 78 developer_protocol_handler, |
| 79 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 80 chrome_protocol_handler, |
| 81 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 82 chrome_devtools_protocol_handler) const; |
| 83 |
57 content::ResourceContext* GetResourceContext() const; | 84 content::ResourceContext* GetResourceContext() const; |
58 // GetResourceContextNoInit() does not call LazyInitialize() so it can be | 85 // GetResourceContextNoInit() does not call LazyInitialize() so it can be |
59 // safely be used during initialization. | 86 // safely be used during initialization. |
60 content::ResourceContext* GetResourceContextNoInit() const; | 87 content::ResourceContext* GetResourceContextNoInit() const; |
61 scoped_refptr<ChromeURLRequestContextGetter> | 88 scoped_refptr<ChromeURLRequestContextGetter> |
62 GetMainRequestContextGetter() const; | |
63 scoped_refptr<ChromeURLRequestContextGetter> | |
64 GetMediaRequestContextGetter() const; | 89 GetMediaRequestContextGetter() const; |
65 scoped_refptr<ChromeURLRequestContextGetter> | 90 scoped_refptr<ChromeURLRequestContextGetter> |
66 GetExtensionsRequestContextGetter() const; | 91 GetExtensionsRequestContextGetter() const; |
67 scoped_refptr<ChromeURLRequestContextGetter> | 92 scoped_refptr<ChromeURLRequestContextGetter> |
68 GetIsolatedAppRequestContextGetter( | |
69 const FilePath& partition_path, | |
70 bool in_memory) const; | |
71 scoped_refptr<ChromeURLRequestContextGetter> | |
72 GetIsolatedMediaRequestContextGetter( | 93 GetIsolatedMediaRequestContextGetter( |
73 const FilePath& partition_path, | 94 const FilePath& partition_path, |
74 bool in_memory) const; | 95 bool in_memory) const; |
75 | 96 |
76 // Deletes all network related data since |time|. It deletes transport | 97 // Deletes all network related data since |time|. It deletes transport |
77 // security state since |time| and also deletes HttpServerProperties data. | 98 // security state since |time| and also deletes HttpServerProperties data. |
78 // Works asynchronously, however if the |completion| callback is non-null, | 99 // Works asynchronously, however if the |completion| callback is non-null, |
79 // it will be posted on the UI thread once the removal process completes. | 100 // it will be posted on the UI thread once the removal process completes. |
80 void ClearNetworkingHistorySince(base::Time time, | 101 void ClearNetworkingHistorySince(base::Time time, |
81 const base::Closure& completion); | 102 const base::Closure& completion); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 bool restore_old_session_cookies; | 157 bool restore_old_session_cookies; |
137 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy; | 158 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy; |
138 }; | 159 }; |
139 | 160 |
140 typedef base::hash_map<std::string, net::HttpTransactionFactory* > | 161 typedef base::hash_map<std::string, net::HttpTransactionFactory* > |
141 HttpTransactionFactoryMap; | 162 HttpTransactionFactoryMap; |
142 | 163 |
143 ProfileImplIOData(); | 164 ProfileImplIOData(); |
144 virtual ~ProfileImplIOData(); | 165 virtual ~ProfileImplIOData(); |
145 | 166 |
146 virtual void LazyInitializeInternal( | 167 virtual void InitializeInternal( |
147 ProfileParams* profile_params) const OVERRIDE; | 168 ProfileParams* profile_params, |
| 169 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 170 blob_protocol_handler, |
| 171 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 172 file_system_protocol_handler, |
| 173 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 174 developer_protocol_handler, |
| 175 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 176 chrome_protocol_handler, |
| 177 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 178 chrome_devtools_protocol_handler) const OVERRIDE; |
148 virtual void InitializeExtensionsRequestContext( | 179 virtual void InitializeExtensionsRequestContext( |
149 ProfileParams* profile_params) const OVERRIDE; | 180 ProfileParams* profile_params) const OVERRIDE; |
150 virtual ChromeURLRequestContext* InitializeAppRequestContext( | 181 virtual ChromeURLRequestContext* InitializeAppRequestContext( |
151 ChromeURLRequestContext* main_context, | 182 ChromeURLRequestContext* main_context, |
152 const StoragePartitionDescriptor& partition_descriptor, | 183 const StoragePartitionDescriptor& partition_descriptor, |
153 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 184 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
154 protocol_handler_interceptor) const OVERRIDE; | 185 protocol_handler_interceptor, |
| 186 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 187 blob_protocol_handler, |
| 188 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 189 file_system_protocol_handler, |
| 190 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 191 developer_protocol_handler, |
| 192 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 193 chrome_protocol_handler, |
| 194 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 195 chrome_devtools_protocol_handler) const OVERRIDE; |
155 virtual ChromeURLRequestContext* InitializeMediaRequestContext( | 196 virtual ChromeURLRequestContext* InitializeMediaRequestContext( |
156 ChromeURLRequestContext* original_context, | 197 ChromeURLRequestContext* original_context, |
157 const StoragePartitionDescriptor& partition_descriptor) const OVERRIDE; | 198 const StoragePartitionDescriptor& partition_descriptor) const OVERRIDE; |
158 virtual ChromeURLRequestContext* | 199 virtual ChromeURLRequestContext* |
159 AcquireMediaRequestContext() const OVERRIDE; | 200 AcquireMediaRequestContext() const OVERRIDE; |
160 virtual ChromeURLRequestContext* | 201 virtual ChromeURLRequestContext* |
161 AcquireIsolatedAppRequestContext( | 202 AcquireIsolatedAppRequestContext( |
162 ChromeURLRequestContext* main_context, | 203 ChromeURLRequestContext* main_context, |
163 const StoragePartitionDescriptor& partition_descriptor, | 204 const StoragePartitionDescriptor& partition_descriptor, |
164 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 205 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
165 protocol_handler_interceptor) const OVERRIDE; | 206 protocol_handler_interceptor, |
| 207 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 208 blob_protocol_handler, |
| 209 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 210 file_system_protocol_handler, |
| 211 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 212 developer_protocol_handler, |
| 213 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 214 chrome_protocol_handler, |
| 215 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 216 chrome_devtools_protocol_handler) const OVERRIDE; |
166 virtual ChromeURLRequestContext* | 217 virtual ChromeURLRequestContext* |
167 AcquireIsolatedMediaRequestContext( | 218 AcquireIsolatedMediaRequestContext( |
168 ChromeURLRequestContext* app_context, | 219 ChromeURLRequestContext* app_context, |
169 const StoragePartitionDescriptor& partition_descriptor) | 220 const StoragePartitionDescriptor& partition_descriptor) |
170 const OVERRIDE; | 221 const OVERRIDE; |
171 virtual chrome_browser_net::LoadTimeStats* GetLoadTimeStats( | 222 virtual chrome_browser_net::LoadTimeStats* GetLoadTimeStats( |
172 IOThread::Globals* io_thread_globals) const OVERRIDE; | 223 IOThread::Globals* io_thread_globals) const OVERRIDE; |
173 | 224 |
174 // Deletes all network related data since |time|. It deletes transport | 225 // Deletes all network related data since |time|. It deletes transport |
175 // security state since |time| and also deletes HttpServerProperties data. | 226 // security state since |time| and also deletes HttpServerProperties data. |
(...skipping 22 matching lines...) Expand all Loading... |
198 | 249 |
199 // Parameters needed for isolated apps. | 250 // Parameters needed for isolated apps. |
200 FilePath profile_path_; | 251 FilePath profile_path_; |
201 int app_cache_max_size_; | 252 int app_cache_max_size_; |
202 int app_media_cache_max_size_; | 253 int app_media_cache_max_size_; |
203 | 254 |
204 DISALLOW_COPY_AND_ASSIGN(ProfileImplIOData); | 255 DISALLOW_COPY_AND_ASSIGN(ProfileImplIOData); |
205 }; | 256 }; |
206 | 257 |
207 #endif // CHROME_BROWSER_PROFILES_PROFILE_IMPL_IO_DATA_H_ | 258 #endif // CHROME_BROWSER_PROFILES_PROFILE_IMPL_IO_DATA_H_ |
OLD | NEW |