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/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
23 #include "chrome/browser/profiles/storage_partition_descriptor.h" | 23 #include "chrome/browser/profiles/storage_partition_descriptor.h" |
24 #include "components/content_settings/core/common/content_settings_types.h" | 24 #include "components/content_settings/core/common/content_settings_types.h" |
25 #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" |
sclittle
2015/01/14 22:54:46
Remove this
bengr
2015/01/15 00:30:31
Done.
| |
26 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf igurator.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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
243 | 243 |
244 // Initialize the member needed to track the metrics enabled state. This is | 244 // Initialize the member needed to track the metrics enabled state. This is |
245 // only to be called on the UI thread. | 245 // only to be called on the UI thread. |
246 void InitializeMetricsEnabledStateOnUIThread(); | 246 void InitializeMetricsEnabledStateOnUIThread(); |
247 | 247 |
248 // Returns whether or not metrics reporting is enabled in the browser instance | 248 // Returns whether or not metrics reporting is enabled in the browser instance |
249 // on which this profile resides. This is safe for use from the IO thread, and | 249 // on which this profile resides. This is safe for use from the IO thread, and |
250 // should only be called from there. | 250 // should only be called from there. |
251 bool GetMetricsEnabledStateOnIOThread() const; | 251 bool GetMetricsEnabledStateOnIOThread() const; |
252 | 252 |
253 // Returns whether or not data reduction proxy is enabled in the browser | |
254 // instance on which this profile resides. | |
255 virtual bool IsDataReductionProxyEnabled() const; | |
256 | |
257 void set_client_cert_store_factory_for_testing( | 253 void set_client_cert_store_factory_for_testing( |
258 const base::Callback<scoped_ptr<net::ClientCertStore>()>& factory) { | 254 const base::Callback<scoped_ptr<net::ClientCertStore>()>& factory) { |
259 client_cert_store_factory_ = factory; | 255 client_cert_store_factory_ = factory; |
260 } | 256 } |
261 | 257 |
258 bool IsDataReductionProxyEnabled() { | |
sclittle
2015/01/14 22:54:46
Make const and define in .cc file
bengr
2015/01/15 00:30:31
Done.
| |
259 return data_reduction_proxy_io_data()->IsEnabled(); | |
260 } | |
261 | |
262 protected: | 262 protected: |
263 // A URLRequestContext for media that owns its HTTP factory, to ensure | 263 // A URLRequestContext for media that owns its HTTP factory, to ensure |
264 // it is deleted. | 264 // it is deleted. |
265 class MediaRequestContext : public net::URLRequestContext { | 265 class MediaRequestContext : public net::URLRequestContext { |
266 public: | 266 public: |
267 MediaRequestContext(); | 267 MediaRequestContext(); |
268 | 268 |
269 void SetHttpTransactionFactory( | 269 void SetHttpTransactionFactory( |
270 scoped_ptr<net::HttpTransactionFactory> http_factory); | 270 scoped_ptr<net::HttpTransactionFactory> http_factory); |
271 | 271 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
360 void ShutdownOnUIThread( | 360 void ShutdownOnUIThread( |
361 scoped_ptr<ChromeURLRequestContextGetterVector> context_getters); | 361 scoped_ptr<ChromeURLRequestContextGetterVector> context_getters); |
362 | 362 |
363 // A ChannelIDService object is created by a derived class of | 363 // A ChannelIDService object is created by a derived class of |
364 // ProfileIOData, and the derived class calls this method to set the | 364 // ProfileIOData, and the derived class calls this method to set the |
365 // channel_id_service_ member and transfers ownership to the base | 365 // channel_id_service_ member and transfers ownership to the base |
366 // class. | 366 // class. |
367 void set_channel_id_service( | 367 void set_channel_id_service( |
368 net::ChannelIDService* channel_id_service) const; | 368 net::ChannelIDService* channel_id_service) const; |
369 | 369 |
370 data_reduction_proxy::DataReductionProxyParams* data_reduction_proxy_params() | 370 void set_data_reduction_proxy_io_data( |
371 const { | 371 scoped_ptr<data_reduction_proxy::DataReductionProxyIOData> |
372 return data_reduction_proxy_params_.get(); | 372 data_reduction_proxy_io_data) const; |
373 } | |
374 | 373 |
375 void set_data_reduction_proxy_params( | 374 data_reduction_proxy::DataReductionProxyIOData* |
376 scoped_ptr<data_reduction_proxy::DataReductionProxyParams> | 375 data_reduction_proxy_io_data() const { |
377 data_reduction_proxy_params) const { | 376 return data_reduction_proxy_io_data_.get(); |
378 data_reduction_proxy_params_ = data_reduction_proxy_params.Pass(); | |
379 } | |
380 | |
381 data_reduction_proxy::DataReductionProxyUsageStats* | |
382 data_reduction_proxy_usage_stats() const { | |
383 return data_reduction_proxy_usage_stats_.get(); | |
384 } | |
385 | |
386 void set_data_reduction_proxy_statistics_prefs( | |
387 scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs> | |
388 data_reduction_proxy_statistics_prefs) { | |
389 data_reduction_proxy_statistics_prefs_ = | |
390 data_reduction_proxy_statistics_prefs.Pass(); | |
391 } | |
392 | |
393 data_reduction_proxy::DataReductionProxyStatisticsPrefs* | |
394 data_reduction_proxy_statistics_prefs() const { | |
395 return data_reduction_proxy_statistics_prefs_.get(); | |
396 } | |
397 | |
398 void set_data_reduction_proxy_usage_stats( | |
399 scoped_ptr<data_reduction_proxy::DataReductionProxyUsageStats> | |
400 data_reduction_proxy_usage_stats) const { | |
401 data_reduction_proxy_usage_stats_ = | |
402 data_reduction_proxy_usage_stats.Pass(); | |
403 } | |
404 | |
405 base::Callback<void(bool)> data_reduction_proxy_unavailable_callback() const { | |
406 return data_reduction_proxy_unavailable_callback_; | |
407 } | |
408 | |
409 void set_data_reduction_proxy_unavailable_callback( | |
410 const base::Callback<void(bool)>& unavailable_callback) const { | |
411 data_reduction_proxy_unavailable_callback_ = unavailable_callback; | |
412 } | |
413 | |
414 data_reduction_proxy::DataReductionProxyConfigurator* | |
415 data_reduction_proxy_configurator() const { | |
416 return data_reduction_proxy_configurator_.get(); | |
417 } | |
418 | |
419 void set_data_reduction_proxy_configurator( | |
420 scoped_ptr<data_reduction_proxy::DataReductionProxyConfigurator> | |
421 data_reduction_proxy_configurator) const { | |
422 data_reduction_proxy_configurator_ = | |
423 data_reduction_proxy_configurator.Pass(); | |
424 } | |
425 | |
426 data_reduction_proxy::DataReductionProxyAuthRequestHandler* | |
427 data_reduction_proxy_auth_request_handler() const { | |
428 return data_reduction_proxy_auth_request_handler_.get(); | |
429 } | |
430 | |
431 void set_data_reduction_proxy_auth_request_handler( | |
432 scoped_ptr<data_reduction_proxy::DataReductionProxyAuthRequestHandler> | |
433 data_reduction_proxy_auth_request_handler) const { | |
434 data_reduction_proxy_auth_request_handler_ = | |
435 data_reduction_proxy_auth_request_handler.Pass(); | |
436 } | |
437 | |
438 data_reduction_proxy::DataReductionProxyEventStore* | |
439 data_reduction_proxy_event_store() const { | |
440 return data_reduction_proxy_event_store_.get(); | |
441 } | |
442 | |
443 void set_data_reduction_proxy_event_store( | |
444 scoped_ptr<data_reduction_proxy::DataReductionProxyEventStore> | |
445 data_reduction_proxy_event_store) const { | |
446 data_reduction_proxy_event_store_ = | |
447 data_reduction_proxy_event_store.Pass(); | |
448 } | 377 } |
449 | 378 |
450 net::FraudulentCertificateReporter* fraudulent_certificate_reporter() const { | 379 net::FraudulentCertificateReporter* fraudulent_certificate_reporter() const { |
451 return fraudulent_certificate_reporter_.get(); | 380 return fraudulent_certificate_reporter_.get(); |
452 } | 381 } |
453 | 382 |
454 net::ProxyService* proxy_service() const { | 383 net::ProxyService* proxy_service() const { |
455 return proxy_service_.get(); | 384 return proxy_service_.get(); |
456 } | 385 } |
457 | 386 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
638 mutable scoped_ptr<policy::URLBlacklistManager> url_blacklist_manager_; | 567 mutable scoped_ptr<policy::URLBlacklistManager> url_blacklist_manager_; |
639 mutable scoped_ptr<policy::PolicyHeaderIOHelper> policy_header_helper_; | 568 mutable scoped_ptr<policy::PolicyHeaderIOHelper> policy_header_helper_; |
640 #endif | 569 #endif |
641 | 570 |
642 // Pointed to by URLRequestContext. | 571 // Pointed to by URLRequestContext. |
643 #if defined(ENABLE_EXTENSIONS) | 572 #if defined(ENABLE_EXTENSIONS) |
644 mutable scoped_refptr<extensions::InfoMap> extension_info_map_; | 573 mutable scoped_refptr<extensions::InfoMap> extension_info_map_; |
645 #endif | 574 #endif |
646 mutable scoped_ptr<net::ChannelIDService> channel_id_service_; | 575 mutable scoped_ptr<net::ChannelIDService> channel_id_service_; |
647 | 576 |
648 // data_reduction_proxy_* classes must be declared before |network_delegate_|. | 577 mutable scoped_ptr<data_reduction_proxy::DataReductionProxyIOData> |
649 // The data_reduction_proxy_* classes are passed in to |network_delegate_|, | 578 data_reduction_proxy_io_data_; |
650 // so this ordering ensures that the |network_delegate_| never references | |
651 // freed objects. | |
652 mutable scoped_ptr<data_reduction_proxy::DataReductionProxyParams> | |
653 data_reduction_proxy_params_; | |
654 mutable scoped_ptr<data_reduction_proxy::DataReductionProxyUsageStats> | |
655 data_reduction_proxy_usage_stats_; | |
656 mutable scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs> | |
657 data_reduction_proxy_statistics_prefs_; | |
658 mutable base::Callback<void(bool)> data_reduction_proxy_unavailable_callback_; | |
659 mutable scoped_ptr<data_reduction_proxy::DataReductionProxyConfigurator> | |
660 data_reduction_proxy_configurator_; | |
661 mutable scoped_ptr<data_reduction_proxy::DataReductionProxyAuthRequestHandler> | |
662 data_reduction_proxy_auth_request_handler_; | |
663 mutable scoped_ptr<data_reduction_proxy::DataReductionProxyEventStore> | |
664 data_reduction_proxy_event_store_; | |
665 | 579 |
666 mutable scoped_ptr<net::FraudulentCertificateReporter> | 580 mutable scoped_ptr<net::FraudulentCertificateReporter> |
667 fraudulent_certificate_reporter_; | 581 fraudulent_certificate_reporter_; |
668 mutable scoped_ptr<net::ProxyService> proxy_service_; | 582 mutable scoped_ptr<net::ProxyService> proxy_service_; |
669 mutable scoped_ptr<net::TransportSecurityState> transport_security_state_; | 583 mutable scoped_ptr<net::TransportSecurityState> transport_security_state_; |
670 mutable scoped_ptr<net::HttpServerProperties> | 584 mutable scoped_ptr<net::HttpServerProperties> |
671 http_server_properties_; | 585 http_server_properties_; |
672 #if defined(OS_CHROMEOS) | 586 #if defined(OS_CHROMEOS) |
673 // Set to |cert_verifier_| if it references a PolicyCertVerifier. In that | 587 // Set to |cert_verifier_| if it references a PolicyCertVerifier. In that |
674 // case, the verifier is owned by |cert_verifier_|. Otherwise, set to NULL. | 588 // 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... | |
710 | 624 |
711 // TODO(jhawkins): Remove once crbug.com/102004 is fixed. | 625 // TODO(jhawkins): Remove once crbug.com/102004 is fixed. |
712 bool initialized_on_UI_thread_; | 626 bool initialized_on_UI_thread_; |
713 | 627 |
714 const Profile::ProfileType profile_type_; | 628 const Profile::ProfileType profile_type_; |
715 | 629 |
716 DISALLOW_COPY_AND_ASSIGN(ProfileIOData); | 630 DISALLOW_COPY_AND_ASSIGN(ProfileIOData); |
717 }; | 631 }; |
718 | 632 |
719 #endif // CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ | 633 #endif // CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ |
OLD | NEW |