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_IO_DATA_H_ | 5 #ifndef CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ |
6 #define CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ | 6 #define CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
13 #include "base/file_path.h" | 13 #include "base/file_path.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "base/synchronization/lock.h" | 17 #include "base/synchronization/lock.h" |
18 #include "chrome/browser/net/chrome_url_request_context.h" | 18 #include "chrome/browser/net/chrome_url_request_context.h" |
19 #include "chrome/browser/prefs/pref_member.h" | 19 #include "chrome/browser/prefs/pref_member.h" |
20 #include "content/public/browser/resource_context.h" | 20 #include "content/public/browser/resource_context.h" |
21 #include "net/base/cookie_monster.h" | 21 #include "net/base/cookie_monster.h" |
22 | 22 |
23 class AudioManager; | 23 class AudioManager; |
24 class ChromeAppCacheService; | |
25 class ChromeBlobStorageContext; | |
26 class CookieSettings; | 24 class CookieSettings; |
27 class DesktopNotificationService; | 25 class DesktopNotificationService; |
28 class ExtensionInfoMap; | 26 class ExtensionInfoMap; |
29 class HostContentSettingsMap; | 27 class HostContentSettingsMap; |
30 class IOThread; | 28 class IOThread; |
31 class Profile; | 29 class Profile; |
32 class ProtocolHandlerRegistry; | 30 class ProtocolHandlerRegistry; |
33 class TransportSecurityPersister; | 31 class TransportSecurityPersister; |
34 class WebKitContext; | 32 class WebKitContext; |
35 | 33 |
36 namespace fileapi { | |
37 class FileSystemContext; | |
38 } // namespace fileapi | |
39 | |
40 namespace media_stream { | 34 namespace media_stream { |
41 class MediaStreamManager; | 35 class MediaStreamManager; |
42 } // namespace media_stream | 36 } // namespace media_stream |
43 | 37 |
44 namespace net { | 38 namespace net { |
45 class CookieStore; | 39 class CookieStore; |
46 class FraudulentCertificateReporter; | 40 class FraudulentCertificateReporter; |
47 class HttpTransactionFactory; | 41 class HttpTransactionFactory; |
48 class OriginBoundCertService; | 42 class OriginBoundCertService; |
49 class ProxyConfigService; | 43 class ProxyConfigService; |
50 class ProxyService; | 44 class ProxyService; |
51 class SSLConfigService; | 45 class SSLConfigService; |
52 class TransportSecurityState; | 46 class TransportSecurityState; |
53 } // namespace net | 47 } // namespace net |
54 | 48 |
55 namespace policy { | 49 namespace policy { |
56 class URLBlacklistManager; | 50 class URLBlacklistManager; |
57 } // namespace policy | 51 } // namespace policy |
58 | 52 |
59 namespace quota { | |
60 class QuotaManager; | |
61 }; // namespace quota | |
62 | |
63 namespace webkit_database { | |
64 class DatabaseTracker; | |
65 } // webkit_database | |
66 | |
67 // Conceptually speaking, the ProfileIOData represents data that lives on the IO | 53 // Conceptually speaking, the ProfileIOData represents data that lives on the IO |
68 // thread that is owned by a Profile, such as, but not limited to, network | 54 // thread that is owned by a Profile, such as, but not limited to, network |
69 // objects like CookieMonster, HttpTransactionFactory, etc. Profile owns | 55 // objects like CookieMonster, HttpTransactionFactory, etc. Profile owns |
70 // ProfileIOData, but will make sure to delete it on the IO thread (except | 56 // ProfileIOData, but will make sure to delete it on the IO thread (except |
71 // possibly in unit tests where there is no IO thread). | 57 // possibly in unit tests where there is no IO thread). |
72 class ProfileIOData { | 58 class ProfileIOData { |
73 public: | 59 public: |
74 virtual ~ProfileIOData(); | 60 virtual ~ProfileIOData(); |
75 | 61 |
76 static ProfileIOData* FromResourceContext(content::ResourceContext* rc); | 62 static ProfileIOData* FromResourceContext(content::ResourceContext* rc); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 std::string accept_language; | 137 std::string accept_language; |
152 std::string accept_charset; | 138 std::string accept_charset; |
153 std::string referrer_charset; | 139 std::string referrer_charset; |
154 IOThread* io_thread; | 140 IOThread* io_thread; |
155 AudioManager* audio_manager; | 141 AudioManager* audio_manager; |
156 scoped_refptr<HostContentSettingsMap> host_content_settings_map; | 142 scoped_refptr<HostContentSettingsMap> host_content_settings_map; |
157 scoped_refptr<CookieSettings> cookie_settings; | 143 scoped_refptr<CookieSettings> cookie_settings; |
158 scoped_refptr<content::HostZoomMap> host_zoom_map; | 144 scoped_refptr<content::HostZoomMap> host_zoom_map; |
159 scoped_refptr<net::SSLConfigService> ssl_config_service; | 145 scoped_refptr<net::SSLConfigService> ssl_config_service; |
160 scoped_refptr<net::CookieMonster::Delegate> cookie_monster_delegate; | 146 scoped_refptr<net::CookieMonster::Delegate> cookie_monster_delegate; |
161 scoped_refptr<webkit_database::DatabaseTracker> database_tracker; | |
162 scoped_refptr<ChromeAppCacheService> appcache_service; | |
163 scoped_refptr<ChromeBlobStorageContext> blob_storage_context; | |
164 scoped_refptr<fileapi::FileSystemContext> file_system_context; | |
165 scoped_refptr<WebKitContext> webkit_context; | 147 scoped_refptr<WebKitContext> webkit_context; |
166 scoped_refptr<quota::QuotaManager> quota_manager; | |
167 scoped_refptr<ExtensionInfoMap> extension_info_map; | 148 scoped_refptr<ExtensionInfoMap> extension_info_map; |
168 DesktopNotificationService* notification_service; | 149 DesktopNotificationService* notification_service; |
169 scoped_refptr<ProtocolHandlerRegistry> protocol_handler_registry; | 150 scoped_refptr<ProtocolHandlerRegistry> protocol_handler_registry; |
170 // We need to initialize the ProxyConfigService from the UI thread | 151 // We need to initialize the ProxyConfigService from the UI thread |
171 // because on linux it relies on initializing things through gconf, | 152 // because on linux it relies on initializing things through gconf, |
172 // and needs to be on the main thread. | 153 // and needs to be on the main thread. |
173 scoped_ptr<net::ProxyConfigService> proxy_config_service; | 154 scoped_ptr<net::ProxyConfigService> proxy_config_service; |
174 // The profile this struct was populated from. It's passed as a void* to | 155 // The profile this struct was populated from. It's passed as a void* to |
175 // ensure it's not accidently used on the IO thread. Before using it on the | 156 // ensure it's not accidently used on the IO thread. Before using it on the |
176 // UI thread, call ProfileManager::IsValidProfile to ensure it's alive. | 157 // UI thread, call ProfileManager::IsValidProfile to ensure it's alive. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 public: | 212 public: |
232 explicit ResourceContext(ProfileIOData* io_data); | 213 explicit ResourceContext(ProfileIOData* io_data); |
233 virtual ~ResourceContext(); | 214 virtual ~ResourceContext(); |
234 | 215 |
235 private: | 216 private: |
236 friend class ProfileIOData; | 217 friend class ProfileIOData; |
237 | 218 |
238 // ResourceContext implementation: | 219 // ResourceContext implementation: |
239 virtual net::HostResolver* GetHostResolver() OVERRIDE; | 220 virtual net::HostResolver* GetHostResolver() OVERRIDE; |
240 virtual net::URLRequestContext* GetRequestContext() OVERRIDE; | 221 virtual net::URLRequestContext* GetRequestContext() OVERRIDE; |
241 virtual ChromeAppCacheService* GetAppCacheService() OVERRIDE; | |
242 virtual webkit_database::DatabaseTracker* GetDatabaseTracker() OVERRIDE; | |
243 virtual fileapi::FileSystemContext* GetFileSystemContext() OVERRIDE; | |
244 virtual WebKitContext* GetWebKitContext() OVERRIDE; | |
245 virtual ChromeBlobStorageContext* GetBlobStorageContext() OVERRIDE; | |
246 virtual quota::QuotaManager* GetQuotaManager() OVERRIDE; | |
247 virtual content::HostZoomMap* GetHostZoomMap() OVERRIDE; | 222 virtual content::HostZoomMap* GetHostZoomMap() OVERRIDE; |
248 virtual MediaObserver* GetMediaObserver() OVERRIDE; | 223 virtual MediaObserver* GetMediaObserver() OVERRIDE; |
249 virtual media_stream::MediaStreamManager* GetMediaStreamManager() OVERRIDE; | 224 virtual media_stream::MediaStreamManager* GetMediaStreamManager() OVERRIDE; |
250 virtual AudioManager* GetAudioManager() OVERRIDE; | 225 virtual AudioManager* GetAudioManager() OVERRIDE; |
251 | 226 |
252 void EnsureInitialized(); | 227 void EnsureInitialized(); |
253 | 228 |
254 ProfileIOData* const io_data_; | 229 ProfileIOData* const io_data_; |
255 | 230 |
256 net::HostResolver* host_resolver_; | 231 net::HostResolver* host_resolver_; |
257 net::URLRequestContext* request_context_; | 232 net::URLRequestContext* request_context_; |
258 ChromeAppCacheService* appcache_service_; | |
259 webkit_database::DatabaseTracker* database_tracker_; | |
260 fileapi::FileSystemContext* file_system_context_; | |
261 WebKitContext* webkit_context_; | |
262 ChromeBlobStorageContext* blob_storage_context_; | |
263 quota::QuotaManager* quota_manager_; | |
264 content::HostZoomMap* host_zoom_map_; | 233 content::HostZoomMap* host_zoom_map_; |
265 MediaObserver* media_observer_; | 234 MediaObserver* media_observer_; |
266 media_stream::MediaStreamManager* media_stream_manager_; | 235 media_stream::MediaStreamManager* media_stream_manager_; |
267 AudioManager* audio_manager_; | 236 AudioManager* audio_manager_; |
268 }; | 237 }; |
269 | 238 |
270 typedef base::hash_map<std::string, scoped_refptr<ChromeURLRequestContext> > | 239 typedef base::hash_map<std::string, scoped_refptr<ChromeURLRequestContext> > |
271 AppRequestContextMap; | 240 AppRequestContextMap; |
272 | 241 |
273 // -------------------------------------------- | 242 // -------------------------------------------- |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 chrome_url_data_manager_backend_; | 283 chrome_url_data_manager_backend_; |
315 mutable scoped_ptr<net::OriginBoundCertService> origin_bound_cert_service_; | 284 mutable scoped_ptr<net::OriginBoundCertService> origin_bound_cert_service_; |
316 mutable scoped_ptr<net::NetworkDelegate> network_delegate_; | 285 mutable scoped_ptr<net::NetworkDelegate> network_delegate_; |
317 mutable scoped_ptr<net::FraudulentCertificateReporter> | 286 mutable scoped_ptr<net::FraudulentCertificateReporter> |
318 fraudulent_certificate_reporter_; | 287 fraudulent_certificate_reporter_; |
319 mutable scoped_ptr<net::ProxyService> proxy_service_; | 288 mutable scoped_ptr<net::ProxyService> proxy_service_; |
320 mutable scoped_ptr<net::TransportSecurityState> transport_security_state_; | 289 mutable scoped_ptr<net::TransportSecurityState> transport_security_state_; |
321 mutable scoped_ptr<net::URLRequestJobFactory> job_factory_; | 290 mutable scoped_ptr<net::URLRequestJobFactory> job_factory_; |
322 | 291 |
323 // Pointed to by ResourceContext. | 292 // Pointed to by ResourceContext. |
324 mutable scoped_refptr<webkit_database::DatabaseTracker> database_tracker_; | |
325 mutable scoped_refptr<ChromeAppCacheService> appcache_service_; | |
326 mutable scoped_refptr<ChromeBlobStorageContext> blob_storage_context_; | |
327 mutable scoped_refptr<fileapi::FileSystemContext> file_system_context_; | |
328 mutable scoped_refptr<WebKitContext> webkit_context_; | |
329 mutable scoped_refptr<quota::QuotaManager> quota_manager_; | |
330 mutable scoped_refptr<content::HostZoomMap> host_zoom_map_; | 293 mutable scoped_refptr<content::HostZoomMap> host_zoom_map_; |
331 mutable scoped_ptr<media_stream::MediaStreamManager> media_stream_manager_; | 294 mutable scoped_ptr<media_stream::MediaStreamManager> media_stream_manager_; |
332 | 295 |
333 // TODO(willchan): Remove from ResourceContext. | 296 // TODO(willchan): Remove from ResourceContext. |
334 mutable scoped_refptr<ExtensionInfoMap> extension_info_map_; | 297 mutable scoped_refptr<ExtensionInfoMap> extension_info_map_; |
335 mutable scoped_refptr<HostContentSettingsMap> host_content_settings_map_; | 298 mutable scoped_refptr<HostContentSettingsMap> host_content_settings_map_; |
336 mutable scoped_refptr<CookieSettings> cookie_settings_; | 299 mutable scoped_refptr<CookieSettings> cookie_settings_; |
337 mutable DesktopNotificationService* notification_service_; | 300 mutable DesktopNotificationService* notification_service_; |
338 | 301 |
339 mutable ResourceContext resource_context_; | 302 mutable ResourceContext resource_context_; |
340 | 303 |
341 mutable scoped_ptr<TransportSecurityPersister> | 304 mutable scoped_ptr<TransportSecurityPersister> |
342 transport_security_persister_; | 305 transport_security_persister_; |
343 | 306 |
344 // These are only valid in between LazyInitialize() and their accessor being | 307 // These are only valid in between LazyInitialize() and their accessor being |
345 // called. | 308 // called. |
346 mutable scoped_refptr<ChromeURLRequestContext> main_request_context_; | 309 mutable scoped_refptr<ChromeURLRequestContext> main_request_context_; |
347 mutable scoped_refptr<ChromeURLRequestContext> extensions_request_context_; | 310 mutable scoped_refptr<ChromeURLRequestContext> extensions_request_context_; |
348 // One AppRequestContext per isolated app. | 311 // One AppRequestContext per isolated app. |
349 mutable AppRequestContextMap app_request_context_map_; | 312 mutable AppRequestContextMap app_request_context_map_; |
350 | 313 |
351 // TODO(jhawkins): Remove once crbug.com/102004 is fixed. | 314 // TODO(jhawkins): Remove once crbug.com/102004 is fixed. |
352 bool initialized_on_UI_thread_; | 315 bool initialized_on_UI_thread_; |
353 | 316 |
354 DISALLOW_COPY_AND_ASSIGN(ProfileIOData); | 317 DISALLOW_COPY_AND_ASSIGN(ProfileIOData); |
355 }; | 318 }; |
356 | 319 |
357 #endif // CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ | 320 #endif // CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ |
OLD | NEW |