| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 static void InstallProtocolHandlers( | 86 static void InstallProtocolHandlers( |
| 87 net::URLRequestJobFactoryImpl* job_factory, | 87 net::URLRequestJobFactoryImpl* job_factory, |
| 88 content::ProtocolHandlerMap* protocol_handlers); | 88 content::ProtocolHandlerMap* protocol_handlers); |
| 89 | 89 |
| 90 // Called by Profile. | 90 // Called by Profile. |
| 91 content::ResourceContext* GetResourceContext() const; | 91 content::ResourceContext* GetResourceContext() const; |
| 92 | 92 |
| 93 // Initializes the ProfileIOData object and primes the RequestContext | 93 // Initializes the ProfileIOData object and primes the RequestContext |
| 94 // generation. Must be called prior to any of the Get*() methods other than | 94 // generation. Must be called prior to any of the Get*() methods other than |
| 95 // GetResouceContext or GetMetricsEnabledStateOnIOThread. | 95 // GetResouceContext or GetMetricsEnabledStateOnIOThread. |
| 96 void Init(content::ProtocolHandlerMap* protocol_handlers) const; | 96 void Init(content::ProtocolHandlerMap* protocol_handlers, |
| 97 content::ProtocolHandlerScopedVector protocol_interceptors) const; |
| 97 | 98 |
| 98 ChromeURLRequestContext* GetMainRequestContext() const; | 99 ChromeURLRequestContext* GetMainRequestContext() const; |
| 99 ChromeURLRequestContext* GetMediaRequestContext() const; | 100 ChromeURLRequestContext* GetMediaRequestContext() const; |
| 100 ChromeURLRequestContext* GetExtensionsRequestContext() const; | 101 ChromeURLRequestContext* GetExtensionsRequestContext() const; |
| 101 ChromeURLRequestContext* GetIsolatedAppRequestContext( | 102 ChromeURLRequestContext* GetIsolatedAppRequestContext( |
| 102 ChromeURLRequestContext* main_context, | 103 ChromeURLRequestContext* main_context, |
| 103 const StoragePartitionDescriptor& partition_descriptor, | 104 const StoragePartitionDescriptor& partition_descriptor, |
| 104 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 105 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
| 105 protocol_handler_interceptor, | 106 protocol_handler_interceptor, |
| 106 content::ProtocolHandlerMap* protocol_handlers) const; | 107 content::ProtocolHandlerMap* protocol_handlers, |
| 108 content::ProtocolHandlerScopedVector protocol_interceptors) const; |
| 107 ChromeURLRequestContext* GetIsolatedMediaRequestContext( | 109 ChromeURLRequestContext* GetIsolatedMediaRequestContext( |
| 108 ChromeURLRequestContext* app_context, | 110 ChromeURLRequestContext* app_context, |
| 109 const StoragePartitionDescriptor& partition_descriptor) const; | 111 const StoragePartitionDescriptor& partition_descriptor) const; |
| 110 | 112 |
| 111 // These are useful when the Chrome layer is called from the content layer | 113 // These are useful when the Chrome layer is called from the content layer |
| 112 // with a content::ResourceContext, and they want access to Chrome data for | 114 // with a content::ResourceContext, and they want access to Chrome data for |
| 113 // that profile. | 115 // that profile. |
| 114 extensions::InfoMap* GetExtensionInfoMap() const; | 116 extensions::InfoMap* GetExtensionInfoMap() const; |
| 115 CookieSettings* GetCookieSettings() const; | 117 CookieSettings* GetCookieSettings() const; |
| 116 HostContentSettingsMap* GetHostContentSettingsMap() const; | 118 HostContentSettingsMap* GetHostContentSettingsMap() const; |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 | 296 |
| 295 explicit ProfileIOData(bool is_incognito); | 297 explicit ProfileIOData(bool is_incognito); |
| 296 | 298 |
| 297 static std::string GetSSLSessionCacheShard(); | 299 static std::string GetSSLSessionCacheShard(); |
| 298 | 300 |
| 299 void InitializeOnUIThread(Profile* profile); | 301 void InitializeOnUIThread(Profile* profile); |
| 300 void ApplyProfileParamsToContext(ChromeURLRequestContext* context) const; | 302 void ApplyProfileParamsToContext(ChromeURLRequestContext* context) const; |
| 301 | 303 |
| 302 scoped_ptr<net::URLRequestJobFactory> SetUpJobFactoryDefaults( | 304 scoped_ptr<net::URLRequestJobFactory> SetUpJobFactoryDefaults( |
| 303 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory, | 305 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory, |
| 306 content::ProtocolHandlerScopedVector protocol_interceptors, |
| 304 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 307 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
| 305 protocol_handler_interceptor, | 308 protocol_handler_interceptor, |
| 306 net::NetworkDelegate* network_delegate, | 309 net::NetworkDelegate* network_delegate, |
| 307 net::FtpTransactionFactory* ftp_transaction_factory) const; | 310 net::FtpTransactionFactory* ftp_transaction_factory) const; |
| 308 | 311 |
| 309 // Called when the profile is destroyed. | 312 // Called when the profile is destroyed. |
| 310 void ShutdownOnUIThread(); | 313 void ShutdownOnUIThread(); |
| 311 | 314 |
| 312 // A ServerBoundCertService object is created by a derived class of | 315 // A ServerBoundCertService object is created by a derived class of |
| 313 // ProfileIOData, and the derived class calls this method to set the | 316 // ProfileIOData, and the derived class calls this method to set the |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 URLRequestContextMap; | 398 URLRequestContextMap; |
| 396 | 399 |
| 397 // -------------------------------------------- | 400 // -------------------------------------------- |
| 398 // Virtual interface for subtypes to implement: | 401 // Virtual interface for subtypes to implement: |
| 399 // -------------------------------------------- | 402 // -------------------------------------------- |
| 400 | 403 |
| 401 // Does the actual initialization of the ProfileIOData subtype. Subtypes | 404 // Does the actual initialization of the ProfileIOData subtype. Subtypes |
| 402 // should use the static helper functions above to implement this. | 405 // should use the static helper functions above to implement this. |
| 403 virtual void InitializeInternal( | 406 virtual void InitializeInternal( |
| 404 ProfileParams* profile_params, | 407 ProfileParams* profile_params, |
| 405 content::ProtocolHandlerMap* protocol_handlers) const = 0; | 408 content::ProtocolHandlerMap* protocol_handlers, |
| 409 content::ProtocolHandlerScopedVector protocol_interceptors) const = 0; |
| 406 | 410 |
| 407 // Initializes the RequestContext for extensions. | 411 // Initializes the RequestContext for extensions. |
| 408 virtual void InitializeExtensionsRequestContext( | 412 virtual void InitializeExtensionsRequestContext( |
| 409 ProfileParams* profile_params) const = 0; | 413 ProfileParams* profile_params) const = 0; |
| 410 // Does an on-demand initialization of a RequestContext for the given | 414 // Does an on-demand initialization of a RequestContext for the given |
| 411 // isolated app. | 415 // isolated app. |
| 412 virtual ChromeURLRequestContext* InitializeAppRequestContext( | 416 virtual ChromeURLRequestContext* InitializeAppRequestContext( |
| 413 ChromeURLRequestContext* main_context, | 417 ChromeURLRequestContext* main_context, |
| 414 const StoragePartitionDescriptor& details, | 418 const StoragePartitionDescriptor& details, |
| 415 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 419 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
| 416 protocol_handler_interceptor, | 420 protocol_handler_interceptor, |
| 417 content::ProtocolHandlerMap* protocol_handlers) const = 0; | 421 content::ProtocolHandlerMap* protocol_handlers, |
| 422 content::ProtocolHandlerScopedVector protocol_interceptors) const = 0; |
| 418 | 423 |
| 419 // Does an on-demand initialization of a media RequestContext for the given | 424 // Does an on-demand initialization of a media RequestContext for the given |
| 420 // isolated app. | 425 // isolated app. |
| 421 virtual ChromeURLRequestContext* InitializeMediaRequestContext( | 426 virtual ChromeURLRequestContext* InitializeMediaRequestContext( |
| 422 ChromeURLRequestContext* original_context, | 427 ChromeURLRequestContext* original_context, |
| 423 const StoragePartitionDescriptor& details) const = 0; | 428 const StoragePartitionDescriptor& details) const = 0; |
| 424 | 429 |
| 425 // These functions are used to transfer ownership of the lazily initialized | 430 // These functions are used to transfer ownership of the lazily initialized |
| 426 // context from ProfileIOData to the URLRequestContextGetter. | 431 // context from ProfileIOData to the URLRequestContextGetter. |
| 427 virtual ChromeURLRequestContext* | 432 virtual ChromeURLRequestContext* |
| 428 AcquireMediaRequestContext() const = 0; | 433 AcquireMediaRequestContext() const = 0; |
| 429 virtual ChromeURLRequestContext* | 434 virtual ChromeURLRequestContext* AcquireIsolatedAppRequestContext( |
| 430 AcquireIsolatedAppRequestContext( | 435 ChromeURLRequestContext* main_context, |
| 431 ChromeURLRequestContext* main_context, | 436 const StoragePartitionDescriptor& partition_descriptor, |
| 432 const StoragePartitionDescriptor& partition_descriptor, | 437 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
| 433 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 438 protocol_handler_interceptor, |
| 434 protocol_handler_interceptor, | 439 content::ProtocolHandlerMap* protocol_handlers, |
| 435 content::ProtocolHandlerMap* protocol_handlers) const = 0; | 440 content::ProtocolHandlerScopedVector protocol_interceptors) const = 0; |
| 436 virtual ChromeURLRequestContext* | 441 virtual ChromeURLRequestContext* |
| 437 AcquireIsolatedMediaRequestContext( | 442 AcquireIsolatedMediaRequestContext( |
| 438 ChromeURLRequestContext* app_context, | 443 ChromeURLRequestContext* app_context, |
| 439 const StoragePartitionDescriptor& partition_descriptor) const = 0; | 444 const StoragePartitionDescriptor& partition_descriptor) const = 0; |
| 440 | 445 |
| 441 // The order *DOES* matter for the majority of these member variables, so | 446 // The order *DOES* matter for the majority of these member variables, so |
| 442 // don't move them around unless you know what you're doing! | 447 // don't move them around unless you know what you're doing! |
| 443 // General rules: | 448 // General rules: |
| 444 // * ResourceContext references the URLRequestContexts, so | 449 // * ResourceContext references the URLRequestContexts, so |
| 445 // URLRequestContexts must outlive ResourceContext, hence ResourceContext | 450 // URLRequestContexts must outlive ResourceContext, hence ResourceContext |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 | 552 |
| 548 // TODO(jhawkins): Remove once crbug.com/102004 is fixed. | 553 // TODO(jhawkins): Remove once crbug.com/102004 is fixed. |
| 549 bool initialized_on_UI_thread_; | 554 bool initialized_on_UI_thread_; |
| 550 | 555 |
| 551 bool is_incognito_; | 556 bool is_incognito_; |
| 552 | 557 |
| 553 DISALLOW_COPY_AND_ASSIGN(ProfileIOData); | 558 DISALLOW_COPY_AND_ASSIGN(ProfileIOData); |
| 554 }; | 559 }; |
| 555 | 560 |
| 556 #endif // CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ | 561 #endif // CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ |
| OLD | NEW |