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 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 static void InstallProtocolHandlers( | 90 static void InstallProtocolHandlers( |
91 net::URLRequestJobFactoryImpl* job_factory, | 91 net::URLRequestJobFactoryImpl* job_factory, |
92 content::ProtocolHandlerMap* protocol_handlers); | 92 content::ProtocolHandlerMap* protocol_handlers); |
93 | 93 |
94 // Called by Profile. | 94 // Called by Profile. |
95 content::ResourceContext* GetResourceContext() const; | 95 content::ResourceContext* GetResourceContext() const; |
96 | 96 |
97 // Initializes the ProfileIOData object and primes the RequestContext | 97 // Initializes the ProfileIOData object and primes the RequestContext |
98 // generation. Must be called prior to any of the Get*() methods other than | 98 // generation. Must be called prior to any of the Get*() methods other than |
99 // GetResouceContext or GetMetricsEnabledStateOnIOThread. | 99 // GetResouceContext or GetMetricsEnabledStateOnIOThread. |
100 void Init(content::ProtocolHandlerMap* protocol_handlers, | 100 void Init( |
101 content::ProtocolHandlerScopedVector protocol_interceptors) const; | 101 content::ProtocolHandlerMap* protocol_handlers, |
| 102 content::URLRequestInterceptorScopedVector request_interceptors) const; |
102 | 103 |
103 ChromeURLRequestContext* GetMainRequestContext() const; | 104 ChromeURLRequestContext* GetMainRequestContext() const; |
104 ChromeURLRequestContext* GetMediaRequestContext() const; | 105 ChromeURLRequestContext* GetMediaRequestContext() const; |
105 ChromeURLRequestContext* GetExtensionsRequestContext() const; | 106 ChromeURLRequestContext* GetExtensionsRequestContext() const; |
106 ChromeURLRequestContext* GetIsolatedAppRequestContext( | 107 ChromeURLRequestContext* GetIsolatedAppRequestContext( |
107 ChromeURLRequestContext* main_context, | 108 ChromeURLRequestContext* main_context, |
108 const StoragePartitionDescriptor& partition_descriptor, | 109 const StoragePartitionDescriptor& partition_descriptor, |
109 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 110 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
110 protocol_handler_interceptor, | 111 protocol_handler_interceptor, |
111 content::ProtocolHandlerMap* protocol_handlers, | 112 content::ProtocolHandlerMap* protocol_handlers, |
112 content::ProtocolHandlerScopedVector protocol_interceptors) const; | 113 content::URLRequestInterceptorScopedVector request_interceptors) const; |
113 ChromeURLRequestContext* GetIsolatedMediaRequestContext( | 114 ChromeURLRequestContext* GetIsolatedMediaRequestContext( |
114 ChromeURLRequestContext* app_context, | 115 ChromeURLRequestContext* app_context, |
115 const StoragePartitionDescriptor& partition_descriptor) const; | 116 const StoragePartitionDescriptor& partition_descriptor) const; |
116 | 117 |
117 // These are useful when the Chrome layer is called from the content layer | 118 // These are useful when the Chrome layer is called from the content layer |
118 // with a content::ResourceContext, and they want access to Chrome data for | 119 // with a content::ResourceContext, and they want access to Chrome data for |
119 // that profile. | 120 // that profile. |
120 extensions::InfoMap* GetExtensionInfoMap() const; | 121 extensions::InfoMap* GetExtensionInfoMap() const; |
121 CookieSettings* GetCookieSettings() const; | 122 CookieSettings* GetCookieSettings() const; |
122 HostContentSettingsMap* GetHostContentSettingsMap() const; | 123 HostContentSettingsMap* GetHostContentSettingsMap() const; |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 | 309 |
309 explicit ProfileIOData(Profile::ProfileType profile_type); | 310 explicit ProfileIOData(Profile::ProfileType profile_type); |
310 | 311 |
311 static std::string GetSSLSessionCacheShard(); | 312 static std::string GetSSLSessionCacheShard(); |
312 | 313 |
313 void InitializeOnUIThread(Profile* profile); | 314 void InitializeOnUIThread(Profile* profile); |
314 void ApplyProfileParamsToContext(ChromeURLRequestContext* context) const; | 315 void ApplyProfileParamsToContext(ChromeURLRequestContext* context) const; |
315 | 316 |
316 scoped_ptr<net::URLRequestJobFactory> SetUpJobFactoryDefaults( | 317 scoped_ptr<net::URLRequestJobFactory> SetUpJobFactoryDefaults( |
317 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory, | 318 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory, |
318 content::ProtocolHandlerScopedVector protocol_interceptors, | 319 content::URLRequestInterceptorScopedVector request_interceptors, |
319 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 320 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
320 protocol_handler_interceptor, | 321 protocol_handler_interceptor, |
321 net::NetworkDelegate* network_delegate, | 322 net::NetworkDelegate* network_delegate, |
322 net::FtpTransactionFactory* ftp_transaction_factory) const; | 323 net::FtpTransactionFactory* ftp_transaction_factory) const; |
323 | 324 |
324 // Called when the profile is destroyed. | 325 // Called when the profile is destroyed. |
325 void ShutdownOnUIThread(); | 326 void ShutdownOnUIThread(); |
326 | 327 |
327 // A ServerBoundCertService object is created by a derived class of | 328 // A ServerBoundCertService object is created by a derived class of |
328 // ProfileIOData, and the derived class calls this method to set the | 329 // ProfileIOData, and the derived class calls this method to set the |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 | 412 |
412 // -------------------------------------------- | 413 // -------------------------------------------- |
413 // Virtual interface for subtypes to implement: | 414 // Virtual interface for subtypes to implement: |
414 // -------------------------------------------- | 415 // -------------------------------------------- |
415 | 416 |
416 // Does the actual initialization of the ProfileIOData subtype. Subtypes | 417 // Does the actual initialization of the ProfileIOData subtype. Subtypes |
417 // should use the static helper functions above to implement this. | 418 // should use the static helper functions above to implement this. |
418 virtual void InitializeInternal( | 419 virtual void InitializeInternal( |
419 ProfileParams* profile_params, | 420 ProfileParams* profile_params, |
420 content::ProtocolHandlerMap* protocol_handlers, | 421 content::ProtocolHandlerMap* protocol_handlers, |
421 content::ProtocolHandlerScopedVector protocol_interceptors) const = 0; | 422 content::URLRequestInterceptorScopedVector |
| 423 request_interceptors) const = 0; |
422 | 424 |
423 // Initializes the RequestContext for extensions. | 425 // Initializes the RequestContext for extensions. |
424 virtual void InitializeExtensionsRequestContext( | 426 virtual void InitializeExtensionsRequestContext( |
425 ProfileParams* profile_params) const = 0; | 427 ProfileParams* profile_params) const = 0; |
426 // Does an on-demand initialization of a RequestContext for the given | 428 // Does an on-demand initialization of a RequestContext for the given |
427 // isolated app. | 429 // isolated app. |
428 virtual ChromeURLRequestContext* InitializeAppRequestContext( | 430 virtual ChromeURLRequestContext* InitializeAppRequestContext( |
429 ChromeURLRequestContext* main_context, | 431 ChromeURLRequestContext* main_context, |
430 const StoragePartitionDescriptor& details, | 432 const StoragePartitionDescriptor& details, |
431 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 433 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
432 protocol_handler_interceptor, | 434 protocol_handler_interceptor, |
433 content::ProtocolHandlerMap* protocol_handlers, | 435 content::ProtocolHandlerMap* protocol_handlers, |
434 content::ProtocolHandlerScopedVector protocol_interceptors) const = 0; | 436 content::URLRequestInterceptorScopedVector |
| 437 request_interceptors) const = 0; |
435 | 438 |
436 // Does an on-demand initialization of a media RequestContext for the given | 439 // Does an on-demand initialization of a media RequestContext for the given |
437 // isolated app. | 440 // isolated app. |
438 virtual ChromeURLRequestContext* InitializeMediaRequestContext( | 441 virtual ChromeURLRequestContext* InitializeMediaRequestContext( |
439 ChromeURLRequestContext* original_context, | 442 ChromeURLRequestContext* original_context, |
440 const StoragePartitionDescriptor& details) const = 0; | 443 const StoragePartitionDescriptor& details) const = 0; |
441 | 444 |
442 // These functions are used to transfer ownership of the lazily initialized | 445 // These functions are used to transfer ownership of the lazily initialized |
443 // context from ProfileIOData to the URLRequestContextGetter. | 446 // context from ProfileIOData to the URLRequestContextGetter. |
444 virtual ChromeURLRequestContext* | 447 virtual ChromeURLRequestContext* |
445 AcquireMediaRequestContext() const = 0; | 448 AcquireMediaRequestContext() const = 0; |
446 virtual ChromeURLRequestContext* AcquireIsolatedAppRequestContext( | 449 virtual ChromeURLRequestContext* AcquireIsolatedAppRequestContext( |
447 ChromeURLRequestContext* main_context, | 450 ChromeURLRequestContext* main_context, |
448 const StoragePartitionDescriptor& partition_descriptor, | 451 const StoragePartitionDescriptor& partition_descriptor, |
449 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 452 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
450 protocol_handler_interceptor, | 453 protocol_handler_interceptor, |
451 content::ProtocolHandlerMap* protocol_handlers, | 454 content::ProtocolHandlerMap* protocol_handlers, |
452 content::ProtocolHandlerScopedVector protocol_interceptors) const = 0; | 455 content::URLRequestInterceptorScopedVector |
| 456 request_interceptors) const = 0; |
453 virtual ChromeURLRequestContext* | 457 virtual ChromeURLRequestContext* |
454 AcquireIsolatedMediaRequestContext( | 458 AcquireIsolatedMediaRequestContext( |
455 ChromeURLRequestContext* app_context, | 459 ChromeURLRequestContext* app_context, |
456 const StoragePartitionDescriptor& partition_descriptor) const = 0; | 460 const StoragePartitionDescriptor& partition_descriptor) const = 0; |
457 | 461 |
458 // The order *DOES* matter for the majority of these member variables, so | 462 // The order *DOES* matter for the majority of these member variables, so |
459 // don't move them around unless you know what you're doing! | 463 // don't move them around unless you know what you're doing! |
460 // General rules: | 464 // General rules: |
461 // * ResourceContext references the URLRequestContexts, so | 465 // * ResourceContext references the URLRequestContexts, so |
462 // URLRequestContexts must outlive ResourceContext, hence ResourceContext | 466 // URLRequestContexts must outlive ResourceContext, hence ResourceContext |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 | 569 |
566 // TODO(jhawkins): Remove once crbug.com/102004 is fixed. | 570 // TODO(jhawkins): Remove once crbug.com/102004 is fixed. |
567 bool initialized_on_UI_thread_; | 571 bool initialized_on_UI_thread_; |
568 | 572 |
569 const Profile::ProfileType profile_type_; | 573 const Profile::ProfileType profile_type_; |
570 | 574 |
571 DISALLOW_COPY_AND_ASSIGN(ProfileIOData); | 575 DISALLOW_COPY_AND_ASSIGN(ProfileIOData); |
572 }; | 576 }; |
573 | 577 |
574 #endif // CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ | 578 #endif // CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ |
OLD | NEW |