| 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 <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/callback_forward.h" | 13 #include "base/callback_forward.h" |
| 14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| 18 #include "base/prefs/pref_member.h" | 18 #include "base/prefs/pref_member.h" |
| 19 #include "base/synchronization/lock.h" | 19 #include "base/synchronization/lock.h" |
| 20 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 20 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
| 21 #include "chrome/browser/io_thread.h" | 21 #include "chrome/browser/io_thread.h" |
| 22 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.
h" | |
| 23 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
| 24 #include "chrome/browser/profiles/storage_partition_descriptor.h" | 23 #include "chrome/browser/profiles/storage_partition_descriptor.h" |
| 25 #include "components/content_settings/core/common/content_settings_types.h" | 24 #include "components/content_settings/core/common/content_settings_types.h" |
| 26 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_auth
_request_handler.h" | 25 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
ata.h" |
| 27 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_stat
istics_prefs.h" | |
| 28 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_usag
e_stats.h" | |
| 29 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_event
_store.h" | |
| 30 #include "content/public/browser/content_browser_client.h" | 26 #include "content/public/browser/content_browser_client.h" |
| 31 #include "content/public/browser/resource_context.h" | 27 #include "content/public/browser/resource_context.h" |
| 32 #include "net/cookies/cookie_monster.h" | 28 #include "net/cookies/cookie_monster.h" |
| 33 #include "net/http/http_cache.h" | 29 #include "net/http/http_cache.h" |
| 34 #include "net/http/http_network_session.h" | 30 #include "net/http/http_network_session.h" |
| 35 #include "net/url_request/url_request_context.h" | 31 #include "net/url_request/url_request_context.h" |
| 36 #include "net/url_request/url_request_job_factory.h" | 32 #include "net/url_request/url_request_job_factory.h" |
| 37 | 33 |
| 38 class ChromeHttpUserAgentSettings; | 34 class ChromeHttpUserAgentSettings; |
| 39 class ChromeNetworkDelegate; | 35 class ChromeNetworkDelegate; |
| 40 class ChromeURLRequestContextGetter; | 36 class ChromeURLRequestContextGetter; |
| 41 class CookieSettings; | 37 class CookieSettings; |
| 42 class DevToolsNetworkController; | 38 class DevToolsNetworkController; |
| 43 class HostContentSettingsMap; | 39 class HostContentSettingsMap; |
| 44 class MediaDeviceIDSalt; | 40 class MediaDeviceIDSalt; |
| 45 class ProtocolHandlerRegistry; | 41 class ProtocolHandlerRegistry; |
| 46 class SigninNamesOnIOThread; | 42 class SigninNamesOnIOThread; |
| 47 class SupervisedUserURLFilter; | 43 class SupervisedUserURLFilter; |
| 48 | 44 |
| 49 namespace chrome_browser_net { | 45 namespace chrome_browser_net { |
| 50 class ResourcePrefetchPredictorObserver; | 46 class ResourcePrefetchPredictorObserver; |
| 51 } | 47 } |
| 52 | 48 |
| 49 namespace data_reduction_proxy { |
| 50 class DataReductionProxyIOData; |
| 51 } |
| 52 |
| 53 namespace extensions { | 53 namespace extensions { |
| 54 class InfoMap; | 54 class InfoMap; |
| 55 } | 55 } |
| 56 | 56 |
| 57 namespace net { | 57 namespace net { |
| 58 class CertVerifier; | 58 class CertVerifier; |
| 59 class ChannelIDService; | 59 class ChannelIDService; |
| 60 class CookieStore; | 60 class CookieStore; |
| 61 class FraudulentCertificateReporter; | 61 class FraudulentCertificateReporter; |
| 62 class FtpTransactionFactory; | 62 class FtpTransactionFactory; |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 | 247 |
| 248 // Initialize the member needed to track the metrics enabled state. This is | 248 // Initialize the member needed to track the metrics enabled state. This is |
| 249 // only to be called on the UI thread. | 249 // only to be called on the UI thread. |
| 250 void InitializeMetricsEnabledStateOnUIThread(); | 250 void InitializeMetricsEnabledStateOnUIThread(); |
| 251 | 251 |
| 252 // Returns whether or not metrics reporting is enabled in the browser instance | 252 // Returns whether or not metrics reporting is enabled in the browser instance |
| 253 // on which this profile resides. This is safe for use from the IO thread, and | 253 // on which this profile resides. This is safe for use from the IO thread, and |
| 254 // should only be called from there. | 254 // should only be called from there. |
| 255 bool GetMetricsEnabledStateOnIOThread() const; | 255 bool GetMetricsEnabledStateOnIOThread() const; |
| 256 | 256 |
| 257 // Returns whether or not data reduction proxy is enabled in the browser | |
| 258 // instance on which this profile resides. | |
| 259 virtual bool IsDataReductionProxyEnabled() const; | |
| 260 | |
| 261 void set_client_cert_store_factory_for_testing( | 257 void set_client_cert_store_factory_for_testing( |
| 262 const base::Callback<scoped_ptr<net::ClientCertStore>()>& factory) { | 258 const base::Callback<scoped_ptr<net::ClientCertStore>()>& factory) { |
| 263 client_cert_store_factory_ = factory; | 259 client_cert_store_factory_ = factory; |
| 264 } | 260 } |
| 265 | 261 |
| 262 bool IsDataReductionProxyEnabled() { |
| 263 return data_reduction_proxy_io_data()->IsEnabled(); |
| 264 } |
| 265 |
| 266 protected: | 266 protected: |
| 267 // A URLRequestContext for media that owns its HTTP factory, to ensure | 267 // A URLRequestContext for media that owns its HTTP factory, to ensure |
| 268 // it is deleted. | 268 // it is deleted. |
| 269 class MediaRequestContext : public net::URLRequestContext { | 269 class MediaRequestContext : public net::URLRequestContext { |
| 270 public: | 270 public: |
| 271 MediaRequestContext(); | 271 MediaRequestContext(); |
| 272 | 272 |
| 273 void SetHttpTransactionFactory( | 273 void SetHttpTransactionFactory( |
| 274 scoped_ptr<net::HttpTransactionFactory> http_factory); | 274 scoped_ptr<net::HttpTransactionFactory> http_factory); |
| 275 | 275 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 void ShutdownOnUIThread( | 364 void ShutdownOnUIThread( |
| 365 scoped_ptr<ChromeURLRequestContextGetterVector> context_getters); | 365 scoped_ptr<ChromeURLRequestContextGetterVector> context_getters); |
| 366 | 366 |
| 367 // A ChannelIDService object is created by a derived class of | 367 // A ChannelIDService object is created by a derived class of |
| 368 // ProfileIOData, and the derived class calls this method to set the | 368 // ProfileIOData, and the derived class calls this method to set the |
| 369 // channel_id_service_ member and transfers ownership to the base | 369 // channel_id_service_ member and transfers ownership to the base |
| 370 // class. | 370 // class. |
| 371 void set_channel_id_service( | 371 void set_channel_id_service( |
| 372 net::ChannelIDService* channel_id_service) const; | 372 net::ChannelIDService* channel_id_service) const; |
| 373 | 373 |
| 374 data_reduction_proxy::DataReductionProxyParams* data_reduction_proxy_params() | 374 void set_data_reduction_proxy_io_data( |
| 375 const { | 375 scoped_ptr<data_reduction_proxy::DataReductionProxyIOData> |
| 376 return data_reduction_proxy_params_.get(); | 376 data_reduction_proxy_io_data) const; |
| 377 } | |
| 378 | 377 |
| 379 void set_data_reduction_proxy_params( | 378 data_reduction_proxy::DataReductionProxyIOData* |
| 380 scoped_ptr<data_reduction_proxy::DataReductionProxyParams> | 379 data_reduction_proxy_io_data() const { |
| 381 data_reduction_proxy_params) const { | 380 return data_reduction_proxy_io_data_.get(); |
| 382 data_reduction_proxy_params_ = data_reduction_proxy_params.Pass(); | |
| 383 } | |
| 384 | |
| 385 data_reduction_proxy::DataReductionProxyUsageStats* | |
| 386 data_reduction_proxy_usage_stats() const { | |
| 387 return data_reduction_proxy_usage_stats_.get(); | |
| 388 } | |
| 389 | |
| 390 void set_data_reduction_proxy_statistics_prefs( | |
| 391 scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs> | |
| 392 data_reduction_proxy_statistics_prefs) { | |
| 393 data_reduction_proxy_statistics_prefs_ = | |
| 394 data_reduction_proxy_statistics_prefs.Pass(); | |
| 395 } | |
| 396 | |
| 397 data_reduction_proxy::DataReductionProxyStatisticsPrefs* | |
| 398 data_reduction_proxy_statistics_prefs() const { | |
| 399 return data_reduction_proxy_statistics_prefs_.get(); | |
| 400 } | |
| 401 | |
| 402 void set_data_reduction_proxy_usage_stats( | |
| 403 scoped_ptr<data_reduction_proxy::DataReductionProxyUsageStats> | |
| 404 data_reduction_proxy_usage_stats) const { | |
| 405 data_reduction_proxy_usage_stats_ = | |
| 406 data_reduction_proxy_usage_stats.Pass(); | |
| 407 } | |
| 408 | |
| 409 base::Callback<void(bool)> data_reduction_proxy_unavailable_callback() const { | |
| 410 return data_reduction_proxy_unavailable_callback_; | |
| 411 } | |
| 412 | |
| 413 void set_data_reduction_proxy_unavailable_callback( | |
| 414 const base::Callback<void(bool)>& unavailable_callback) const { | |
| 415 data_reduction_proxy_unavailable_callback_ = unavailable_callback; | |
| 416 } | |
| 417 | |
| 418 DataReductionProxyChromeConfigurator* | |
| 419 data_reduction_proxy_chrome_configurator() const { | |
| 420 return data_reduction_proxy_chrome_configurator_.get(); | |
| 421 } | |
| 422 | |
| 423 void set_data_reduction_proxy_chrome_configurator( | |
| 424 scoped_ptr<DataReductionProxyChromeConfigurator> | |
| 425 data_reduction_proxy_chrome_configurator) const { | |
| 426 data_reduction_proxy_chrome_configurator_ = | |
| 427 data_reduction_proxy_chrome_configurator.Pass(); | |
| 428 } | |
| 429 | |
| 430 data_reduction_proxy::DataReductionProxyAuthRequestHandler* | |
| 431 data_reduction_proxy_auth_request_handler() const { | |
| 432 return data_reduction_proxy_auth_request_handler_.get(); | |
| 433 } | |
| 434 | |
| 435 void set_data_reduction_proxy_auth_request_handler( | |
| 436 scoped_ptr<data_reduction_proxy::DataReductionProxyAuthRequestHandler> | |
| 437 data_reduction_proxy_auth_request_handler) const { | |
| 438 data_reduction_proxy_auth_request_handler_ = | |
| 439 data_reduction_proxy_auth_request_handler.Pass(); | |
| 440 } | |
| 441 | |
| 442 data_reduction_proxy::DataReductionProxyEventStore* | |
| 443 data_reduction_proxy_event_store() const { | |
| 444 return data_reduction_proxy_event_store_.get(); | |
| 445 } | |
| 446 | |
| 447 void set_data_reduction_proxy_event_store( | |
| 448 scoped_ptr<data_reduction_proxy::DataReductionProxyEventStore> | |
| 449 data_reduction_proxy_event_store) const { | |
| 450 data_reduction_proxy_event_store_ = | |
| 451 data_reduction_proxy_event_store.Pass(); | |
| 452 } | 381 } |
| 453 | 382 |
| 454 net::FraudulentCertificateReporter* fraudulent_certificate_reporter() const { | 383 net::FraudulentCertificateReporter* fraudulent_certificate_reporter() const { |
| 455 return fraudulent_certificate_reporter_.get(); | 384 return fraudulent_certificate_reporter_.get(); |
| 456 } | 385 } |
| 457 | 386 |
| 458 net::ProxyService* proxy_service() const { | 387 net::ProxyService* proxy_service() const { |
| 459 return proxy_service_.get(); | 388 return proxy_service_.get(); |
| 460 } | 389 } |
| 461 | 390 |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 mutable scoped_ptr<policy::URLBlacklistManager> url_blacklist_manager_; | 572 mutable scoped_ptr<policy::URLBlacklistManager> url_blacklist_manager_; |
| 644 mutable scoped_ptr<policy::PolicyHeaderIOHelper> policy_header_helper_; | 573 mutable scoped_ptr<policy::PolicyHeaderIOHelper> policy_header_helper_; |
| 645 #endif | 574 #endif |
| 646 | 575 |
| 647 // Pointed to by URLRequestContext. | 576 // Pointed to by URLRequestContext. |
| 648 #if defined(ENABLE_EXTENSIONS) | 577 #if defined(ENABLE_EXTENSIONS) |
| 649 mutable scoped_refptr<extensions::InfoMap> extension_info_map_; | 578 mutable scoped_refptr<extensions::InfoMap> extension_info_map_; |
| 650 #endif | 579 #endif |
| 651 mutable scoped_ptr<net::ChannelIDService> channel_id_service_; | 580 mutable scoped_ptr<net::ChannelIDService> channel_id_service_; |
| 652 | 581 |
| 653 // data_reduction_proxy_* classes must be declared before |network_delegate_|. | 582 mutable scoped_ptr<data_reduction_proxy::DataReductionProxyIOData> |
| 654 // The data_reduction_proxy_* classes are passed in to |network_delegate_|, | 583 data_reduction_proxy_io_data_; |
| 655 // so this ordering ensures that the |network_delegate_| never references | |
| 656 // freed objects. | |
| 657 mutable scoped_ptr<data_reduction_proxy::DataReductionProxyParams> | |
| 658 data_reduction_proxy_params_; | |
| 659 mutable scoped_ptr<data_reduction_proxy::DataReductionProxyUsageStats> | |
| 660 data_reduction_proxy_usage_stats_; | |
| 661 mutable scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs> | |
| 662 data_reduction_proxy_statistics_prefs_; | |
| 663 mutable base::Callback<void(bool)> data_reduction_proxy_unavailable_callback_; | |
| 664 mutable scoped_ptr<DataReductionProxyChromeConfigurator> | |
| 665 data_reduction_proxy_chrome_configurator_; | |
| 666 mutable scoped_ptr<data_reduction_proxy::DataReductionProxyAuthRequestHandler> | |
| 667 data_reduction_proxy_auth_request_handler_; | |
| 668 mutable scoped_ptr<data_reduction_proxy::DataReductionProxyEventStore> | |
| 669 data_reduction_proxy_event_store_; | |
| 670 | 584 |
| 671 mutable scoped_ptr<net::FraudulentCertificateReporter> | 585 mutable scoped_ptr<net::FraudulentCertificateReporter> |
| 672 fraudulent_certificate_reporter_; | 586 fraudulent_certificate_reporter_; |
| 673 mutable scoped_ptr<net::ProxyService> proxy_service_; | 587 mutable scoped_ptr<net::ProxyService> proxy_service_; |
| 674 mutable scoped_ptr<net::TransportSecurityState> transport_security_state_; | 588 mutable scoped_ptr<net::TransportSecurityState> transport_security_state_; |
| 675 mutable scoped_ptr<net::HttpServerProperties> | 589 mutable scoped_ptr<net::HttpServerProperties> |
| 676 http_server_properties_; | 590 http_server_properties_; |
| 677 #if defined(OS_CHROMEOS) | 591 #if defined(OS_CHROMEOS) |
| 678 // Set to |cert_verifier_| if it references a PolicyCertVerifier. In that | 592 // Set to |cert_verifier_| if it references a PolicyCertVerifier. In that |
| 679 // case, the verifier is owned by |cert_verifier_|. Otherwise, set to NULL. | 593 // case, the verifier is owned by |cert_verifier_|. Otherwise, set to NULL. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 | 629 |
| 716 // TODO(jhawkins): Remove once crbug.com/102004 is fixed. | 630 // TODO(jhawkins): Remove once crbug.com/102004 is fixed. |
| 717 bool initialized_on_UI_thread_; | 631 bool initialized_on_UI_thread_; |
| 718 | 632 |
| 719 const Profile::ProfileType profile_type_; | 633 const Profile::ProfileType profile_type_; |
| 720 | 634 |
| 721 DISALLOW_COPY_AND_ASSIGN(ProfileIOData); | 635 DISALLOW_COPY_AND_ASSIGN(ProfileIOData); |
| 722 }; | 636 }; |
| 723 | 637 |
| 724 #endif // CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ | 638 #endif // CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ |
| OLD | NEW |