| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 // net::URLRequest. | 74 // net::URLRequest. |
| 75 static bool IsHandledURL(const GURL& url); | 75 static bool IsHandledURL(const GURL& url); |
| 76 | 76 |
| 77 // Called by Profile. | 77 // Called by Profile. |
| 78 content::ResourceContext* GetResourceContext() const; | 78 content::ResourceContext* GetResourceContext() const; |
| 79 ChromeURLDataManagerBackend* GetChromeURLDataManagerBackend() const; | 79 ChromeURLDataManagerBackend* GetChromeURLDataManagerBackend() const; |
| 80 | 80 |
| 81 // These should only be called at most once each. Ownership is reversed when | 81 // These should only be called at most once each. Ownership is reversed when |
| 82 // they get called, from ProfileIOData owning ChromeURLRequestContext to vice | 82 // they get called, from ProfileIOData owning ChromeURLRequestContext to vice |
| 83 // versa. | 83 // versa. |
| 84 ChromeURLRequestContext* GetMainRequestContext() const; | 84 |
| 85 // Lazy initializes the ProfileIOData object the first time a request context |
| 86 // is requested. The lazy logic is implemented here. The actual initialization |
| 87 // is done in LazyInitializeInternal(), implemented by subtypes. Static helper |
| 88 // functions have been provided to assist in common operations. |
| 89 ChromeURLRequestContext* GetMainRequestContext( |
| 90 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 91 blob_protocol_handler, |
| 92 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 93 file_system_protocol_handler, |
| 94 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
| 95 developer_protocol_handler) const; |
| 85 ChromeURLRequestContext* GetMediaRequestContext() const; | 96 ChromeURLRequestContext* GetMediaRequestContext() const; |
| 86 ChromeURLRequestContext* GetExtensionsRequestContext() const; | 97 ChromeURLRequestContext* GetExtensionsRequestContext() const; |
| 87 ChromeURLRequestContext* GetIsolatedAppRequestContext( | 98 ChromeURLRequestContext* GetIsolatedAppRequestContext( |
| 88 ChromeURLRequestContext* main_context, | 99 ChromeURLRequestContext* main_context, |
| 89 const StoragePartitionDescriptor& partition_descriptor, | 100 const StoragePartitionDescriptor& partition_descriptor, |
| 90 scoped_ptr<net::URLRequestJobFactory::Interceptor> | 101 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
| 91 protocol_handler_interceptor) const; | 102 protocol_handler_interceptor, |
| 103 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 104 blob_protocol_handler, |
| 105 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 106 file_system_protocol_handler, |
| 107 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
| 108 developer_protocol_handler) const; |
| 92 ChromeURLRequestContext* GetIsolatedMediaRequestContext( | 109 ChromeURLRequestContext* GetIsolatedMediaRequestContext( |
| 93 ChromeURLRequestContext* app_context, | 110 ChromeURLRequestContext* app_context, |
| 94 const StoragePartitionDescriptor& partition_descriptor) const; | 111 const StoragePartitionDescriptor& partition_descriptor) const; |
| 95 | 112 |
| 96 // 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 |
| 97 // 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 |
| 98 // that profile. | 115 // that profile. |
| 99 ExtensionInfoMap* GetExtensionInfoMap() const; | 116 ExtensionInfoMap* GetExtensionInfoMap() const; |
| 100 CookieSettings* GetCookieSettings() const; | 117 CookieSettings* GetCookieSettings() const; |
| 101 | 118 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 void ApplyProfileParamsToContext(ChromeURLRequestContext* context) const; | 259 void ApplyProfileParamsToContext(ChromeURLRequestContext* context) const; |
| 243 | 260 |
| 244 void SetUpJobFactoryDefaults( | 261 void SetUpJobFactoryDefaults( |
| 245 net::URLRequestJobFactoryImpl* job_factory, | 262 net::URLRequestJobFactoryImpl* job_factory, |
| 246 scoped_ptr<net::URLRequestJobFactory::Interceptor> | 263 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
| 247 protocol_handler_interceptor, | 264 protocol_handler_interceptor, |
| 248 net::NetworkDelegate* network_delegate, | 265 net::NetworkDelegate* network_delegate, |
| 249 net::FtpTransactionFactory* ftp_transaction_factory, | 266 net::FtpTransactionFactory* ftp_transaction_factory, |
| 250 net::FtpAuthCache* ftp_auth_cache) const; | 267 net::FtpAuthCache* ftp_auth_cache) const; |
| 251 | 268 |
| 252 // Lazy initializes the ProfileIOData object the first time a request context | |
| 253 // is requested. The lazy logic is implemented here. The actual initialization | |
| 254 // is done in LazyInitializeInternal(), implemented by subtypes. Static helper | |
| 255 // functions have been provided to assist in common operations. | |
| 256 void LazyInitialize() const; | |
| 257 | |
| 258 // Called when the profile is destroyed. | 269 // Called when the profile is destroyed. |
| 259 void ShutdownOnUIThread(); | 270 void ShutdownOnUIThread(); |
| 260 | 271 |
| 261 ChromeURLDataManagerBackend* chrome_url_data_manager_backend() const { | 272 ChromeURLDataManagerBackend* chrome_url_data_manager_backend() const { |
| 262 return chrome_url_data_manager_backend_.get(); | 273 return chrome_url_data_manager_backend_.get(); |
| 263 } | 274 } |
| 264 | 275 |
| 265 // A ServerBoundCertService object is created by a derived class of | 276 // A ServerBoundCertService object is created by a derived class of |
| 266 // ProfileIOData, and the derived class calls this method to set the | 277 // ProfileIOData, and the derived class calls this method to set the |
| 267 // server_bound_cert_service_ member and transfers ownership to the base | 278 // server_bound_cert_service_ member and transfers ownership to the base |
| (...skipping 19 matching lines...) Expand all Loading... |
| 287 net::HttpServerProperties* http_server_properties) const; | 298 net::HttpServerProperties* http_server_properties) const; |
| 288 | 299 |
| 289 ChromeURLRequestContext* main_request_context() const { | 300 ChromeURLRequestContext* main_request_context() const { |
| 290 return main_request_context_.get(); | 301 return main_request_context_.get(); |
| 291 } | 302 } |
| 292 | 303 |
| 293 chrome_browser_net::LoadTimeStats* load_time_stats() const { | 304 chrome_browser_net::LoadTimeStats* load_time_stats() const { |
| 294 return load_time_stats_; | 305 return load_time_stats_; |
| 295 } | 306 } |
| 296 | 307 |
| 308 bool initialized() const { |
| 309 return initialized_; |
| 310 } |
| 311 |
| 297 // Destroys the ResourceContext first, to cancel any URLRequests that are | 312 // Destroys the ResourceContext first, to cancel any URLRequests that are |
| 298 // using it still, before we destroy the member variables that those | 313 // using it still, before we destroy the member variables that those |
| 299 // URLRequests may be accessing. | 314 // URLRequests may be accessing. |
| 300 void DestroyResourceContext(); | 315 void DestroyResourceContext(); |
| 301 | 316 |
| 302 // Fills in fields of params using values from main_request_context_ and the | 317 // Fills in fields of params using values from main_request_context_ and the |
| 303 // IOThread associated with profile_params. | 318 // IOThread associated with profile_params. |
| 304 void PopulateNetworkSessionParams( | 319 void PopulateNetworkSessionParams( |
| 305 const ProfileParams* profile_params, | 320 const ProfileParams* profile_params, |
| 306 net::HttpNetworkSession::Params* params) const; | 321 net::HttpNetworkSession::Params* params) const; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 334 ChromeURLRequestContext*, | 349 ChromeURLRequestContext*, |
| 335 StoragePartitionDescriptorLess> | 350 StoragePartitionDescriptorLess> |
| 336 URLRequestContextMap; | 351 URLRequestContextMap; |
| 337 | 352 |
| 338 // -------------------------------------------- | 353 // -------------------------------------------- |
| 339 // Virtual interface for subtypes to implement: | 354 // Virtual interface for subtypes to implement: |
| 340 // -------------------------------------------- | 355 // -------------------------------------------- |
| 341 | 356 |
| 342 // Does the actual initialization of the ProfileIOData subtype. Subtypes | 357 // Does the actual initialization of the ProfileIOData subtype. Subtypes |
| 343 // should use the static helper functions above to implement this. | 358 // should use the static helper functions above to implement this. |
| 344 virtual void LazyInitializeInternal(ProfileParams* profile_params) const = 0; | 359 virtual void LazyInitializeInternal( |
| 360 ProfileParams* profile_params, |
| 361 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 362 blob_protocol_handler, |
| 363 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 364 file_system_protocol_handler, |
| 365 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
| 366 developer_protocol_handler) const = 0; |
| 345 | 367 |
| 346 // Initializes the RequestContext for extensions. | 368 // Initializes the RequestContext for extensions. |
| 347 virtual void InitializeExtensionsRequestContext( | 369 virtual void InitializeExtensionsRequestContext( |
| 348 ProfileParams* profile_params) const = 0; | 370 ProfileParams* profile_params) const = 0; |
| 349 // Does an on-demand initialization of a RequestContext for the given | 371 // Does an on-demand initialization of a RequestContext for the given |
| 350 // isolated app. | 372 // isolated app. |
| 351 virtual ChromeURLRequestContext* InitializeAppRequestContext( | 373 virtual ChromeURLRequestContext* InitializeAppRequestContext( |
| 352 ChromeURLRequestContext* main_context, | 374 ChromeURLRequestContext* main_context, |
| 353 const StoragePartitionDescriptor& details, | 375 const StoragePartitionDescriptor& details, |
| 354 scoped_ptr<net::URLRequestJobFactory::Interceptor> | 376 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
| 355 protocol_handler_interceptor) const = 0; | 377 protocol_handler_interceptor, |
| 378 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 379 blob_protocol_handler, |
| 380 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 381 file_system_protocol_handler, |
| 382 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
| 383 developer_protocol_handler) const = 0; |
| 356 | 384 |
| 357 // Does an on-demand initialization of a media RequestContext for the given | 385 // Does an on-demand initialization of a media RequestContext for the given |
| 358 // isolated app. | 386 // isolated app. |
| 359 virtual ChromeURLRequestContext* InitializeMediaRequestContext( | 387 virtual ChromeURLRequestContext* InitializeMediaRequestContext( |
| 360 ChromeURLRequestContext* original_context, | 388 ChromeURLRequestContext* original_context, |
| 361 const StoragePartitionDescriptor& details) const = 0; | 389 const StoragePartitionDescriptor& details) const = 0; |
| 362 | 390 |
| 363 // These functions are used to transfer ownership of the lazily initialized | 391 // These functions are used to transfer ownership of the lazily initialized |
| 364 // context from ProfileIOData to the URLRequestContextGetter. | 392 // context from ProfileIOData to the URLRequestContextGetter. |
| 365 virtual ChromeURLRequestContext* | 393 virtual ChromeURLRequestContext* |
| 366 AcquireMediaRequestContext() const = 0; | 394 AcquireMediaRequestContext() const = 0; |
| 367 virtual ChromeURLRequestContext* | 395 virtual ChromeURLRequestContext* |
| 368 AcquireIsolatedAppRequestContext( | 396 AcquireIsolatedAppRequestContext( |
| 369 ChromeURLRequestContext* main_context, | 397 ChromeURLRequestContext* main_context, |
| 370 const StoragePartitionDescriptor& partition_descriptor, | 398 const StoragePartitionDescriptor& partition_descriptor, |
| 371 scoped_ptr<net::URLRequestJobFactory::Interceptor> | 399 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
| 372 protocol_handler_interceptor) const = 0; | 400 protocol_handler_interceptor, |
| 401 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 402 blob_protocol_handler, |
| 403 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 404 file_system_protocol_handler, |
| 405 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
| 406 developer_protocol_handler) const = 0; |
| 373 virtual ChromeURLRequestContext* | 407 virtual ChromeURLRequestContext* |
| 374 AcquireIsolatedMediaRequestContext( | 408 AcquireIsolatedMediaRequestContext( |
| 375 ChromeURLRequestContext* app_context, | 409 ChromeURLRequestContext* app_context, |
| 376 const StoragePartitionDescriptor& partition_descriptor) const = 0; | 410 const StoragePartitionDescriptor& partition_descriptor) const = 0; |
| 377 | 411 |
| 378 // Returns the LoadTimeStats object to be used for this profile. | 412 // Returns the LoadTimeStats object to be used for this profile. |
| 379 virtual chrome_browser_net::LoadTimeStats* GetLoadTimeStats( | 413 virtual chrome_browser_net::LoadTimeStats* GetLoadTimeStats( |
| 380 IOThread::Globals* io_thread_globals) const = 0; | 414 IOThread::Globals* io_thread_globals) const = 0; |
| 381 | 415 |
| 382 // The order *DOES* matter for the majority of these member variables, so | 416 // The order *DOES* matter for the majority of these member variables, so |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 | 504 |
| 471 // TODO(jhawkins): Remove once crbug.com/102004 is fixed. | 505 // TODO(jhawkins): Remove once crbug.com/102004 is fixed. |
| 472 bool initialized_on_UI_thread_; | 506 bool initialized_on_UI_thread_; |
| 473 | 507 |
| 474 bool is_incognito_; | 508 bool is_incognito_; |
| 475 | 509 |
| 476 DISALLOW_COPY_AND_ASSIGN(ProfileIOData); | 510 DISALLOW_COPY_AND_ASSIGN(ProfileIOData); |
| 477 }; | 511 }; |
| 478 | 512 |
| 479 #endif // CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ | 513 #endif // CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ |
| OLD | NEW |