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" | 22 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.
h" |
23 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
24 #include "chrome/browser/profiles/storage_partition_descriptor.h" | 24 #include "chrome/browser/profiles/storage_partition_descriptor.h" |
25 #include "components/content_settings/core/common/content_settings_types.h" | 25 #include "components/content_settings/core/common/content_settings_types.h" |
| 26 #include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_requ
est_handler.h" |
26 #include "components/data_reduction_proxy/browser/data_reduction_proxy_statistic
s_prefs.h" | 27 #include "components/data_reduction_proxy/browser/data_reduction_proxy_statistic
s_prefs.h" |
27 #include "components/data_reduction_proxy/browser/data_reduction_proxy_usage_sta
ts.h" | 28 #include "components/data_reduction_proxy/browser/data_reduction_proxy_usage_sta
ts.h" |
28 #include "content/public/browser/content_browser_client.h" | 29 #include "content/public/browser/content_browser_client.h" |
29 #include "content/public/browser/resource_context.h" | 30 #include "content/public/browser/resource_context.h" |
30 #include "net/cookies/cookie_monster.h" | 31 #include "net/cookies/cookie_monster.h" |
31 #include "net/http/http_cache.h" | 32 #include "net/http/http_cache.h" |
32 #include "net/http/http_network_session.h" | 33 #include "net/http/http_network_session.h" |
33 #include "net/url_request/url_request_context.h" | 34 #include "net/url_request/url_request_context.h" |
34 #include "net/url_request/url_request_job_factory.h" | 35 #include "net/url_request/url_request_job_factory.h" |
35 | 36 |
36 #if defined(SPDY_PROXY_AUTH_ORIGIN) | |
37 #include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_requ
est_handler.h" | |
38 #endif // SPDY_PROXY_AUTH_ORIGIN | |
39 | |
40 class ChromeHttpUserAgentSettings; | 37 class ChromeHttpUserAgentSettings; |
41 class ChromeNetworkDelegate; | 38 class ChromeNetworkDelegate; |
42 class ChromeURLRequestContextGetter; | 39 class ChromeURLRequestContextGetter; |
43 class CookieSettings; | 40 class CookieSettings; |
44 class DevToolsNetworkController; | 41 class DevToolsNetworkController; |
45 class HostContentSettingsMap; | 42 class HostContentSettingsMap; |
46 class MediaDeviceIDSalt; | 43 class MediaDeviceIDSalt; |
47 class ProtocolHandlerRegistry; | 44 class ProtocolHandlerRegistry; |
48 class SigninNamesOnIOThread; | 45 class SigninNamesOnIOThread; |
49 class SupervisedUserURLFilter; | 46 class SupervisedUserURLFilter; |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 } | 176 } |
180 | 177 |
181 net::URLRequestContext* extensions_request_context() const { | 178 net::URLRequestContext* extensions_request_context() const { |
182 return extensions_request_context_.get(); | 179 return extensions_request_context_.get(); |
183 } | 180 } |
184 | 181 |
185 BooleanPrefMember* safe_browsing_enabled() const { | 182 BooleanPrefMember* safe_browsing_enabled() const { |
186 return &safe_browsing_enabled_; | 183 return &safe_browsing_enabled_; |
187 } | 184 } |
188 | 185 |
189 #if defined(SPDY_PROXY_AUTH_ORIGIN) | |
190 // TODO(feng): move the function to protected area. | 186 // TODO(feng): move the function to protected area. |
191 // IsDataReductionProxyEnabled() should be used as public API. | 187 // IsDataReductionProxyEnabled() should be used as public API. |
192 BooleanPrefMember* data_reduction_proxy_enabled() const { | 188 BooleanPrefMember* data_reduction_proxy_enabled() const { |
193 return &data_reduction_proxy_enabled_; | 189 return &data_reduction_proxy_enabled_; |
194 } | 190 } |
195 #endif | |
196 | 191 |
197 BooleanPrefMember* printing_enabled() const { | 192 BooleanPrefMember* printing_enabled() const { |
198 return &printing_enabled_; | 193 return &printing_enabled_; |
199 } | 194 } |
200 | 195 |
201 BooleanPrefMember* sync_disabled() const { | 196 BooleanPrefMember* sync_disabled() const { |
202 return &sync_disabled_; | 197 return &sync_disabled_; |
203 } | 198 } |
204 | 199 |
205 BooleanPrefMember* signin_allowed() const { | 200 BooleanPrefMember* signin_allowed() const { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 | 252 |
258 // Initialize the member needed to track the metrics enabled state. This is | 253 // Initialize the member needed to track the metrics enabled state. This is |
259 // only to be called on the UI thread. | 254 // only to be called on the UI thread. |
260 void InitializeMetricsEnabledStateOnUIThread(); | 255 void InitializeMetricsEnabledStateOnUIThread(); |
261 | 256 |
262 // Returns whether or not metrics reporting is enabled in the browser instance | 257 // Returns whether or not metrics reporting is enabled in the browser instance |
263 // on which this profile resides. This is safe for use from the IO thread, and | 258 // on which this profile resides. This is safe for use from the IO thread, and |
264 // should only be called from there. | 259 // should only be called from there. |
265 bool GetMetricsEnabledStateOnIOThread() const; | 260 bool GetMetricsEnabledStateOnIOThread() const; |
266 | 261 |
267 #if defined(OS_ANDROID) | |
268 // Returns whether or not data reduction proxy is enabled in the browser | 262 // Returns whether or not data reduction proxy is enabled in the browser |
269 // instance on which this profile resides. | 263 // instance on which this profile resides. |
270 bool IsDataReductionProxyEnabled() const; | 264 bool IsDataReductionProxyEnabled() const; |
271 #endif | |
272 | 265 |
273 void set_client_cert_store_factory_for_testing( | 266 void set_client_cert_store_factory_for_testing( |
274 const base::Callback<scoped_ptr<net::ClientCertStore>()>& factory) { | 267 const base::Callback<scoped_ptr<net::ClientCertStore>()>& factory) { |
275 client_cert_store_factory_ = factory; | 268 client_cert_store_factory_ = factory; |
276 } | 269 } |
277 | 270 |
278 protected: | 271 protected: |
279 // A URLRequestContext for media that owns its HTTP factory, to ensure | 272 // A URLRequestContext for media that owns its HTTP factory, to ensure |
280 // it is deleted. | 273 // it is deleted. |
281 class MediaRequestContext : public net::URLRequestContext { | 274 class MediaRequestContext : public net::URLRequestContext { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 void ShutdownOnUIThread( | 369 void ShutdownOnUIThread( |
377 scoped_ptr<ChromeURLRequestContextGetterVector> context_getters); | 370 scoped_ptr<ChromeURLRequestContextGetterVector> context_getters); |
378 | 371 |
379 // A ChannelIDService object is created by a derived class of | 372 // A ChannelIDService object is created by a derived class of |
380 // ProfileIOData, and the derived class calls this method to set the | 373 // ProfileIOData, and the derived class calls this method to set the |
381 // channel_id_service_ member and transfers ownership to the base | 374 // channel_id_service_ member and transfers ownership to the base |
382 // class. | 375 // class. |
383 void set_channel_id_service( | 376 void set_channel_id_service( |
384 net::ChannelIDService* channel_id_service) const; | 377 net::ChannelIDService* channel_id_service) const; |
385 | 378 |
386 #if defined(SPDY_PROXY_AUTH_ORIGIN) | |
387 data_reduction_proxy::DataReductionProxyParams* data_reduction_proxy_params() | 379 data_reduction_proxy::DataReductionProxyParams* data_reduction_proxy_params() |
388 const { | 380 const { |
389 return data_reduction_proxy_params_.get(); | 381 return data_reduction_proxy_params_.get(); |
390 } | 382 } |
391 | 383 |
392 void set_data_reduction_proxy_params( | 384 void set_data_reduction_proxy_params( |
393 scoped_ptr<data_reduction_proxy::DataReductionProxyParams> | 385 scoped_ptr<data_reduction_proxy::DataReductionProxyParams> |
394 data_reduction_proxy_params) const { | 386 data_reduction_proxy_params) const { |
395 data_reduction_proxy_params_ = data_reduction_proxy_params.Pass(); | 387 data_reduction_proxy_params_ = data_reduction_proxy_params.Pass(); |
396 } | 388 } |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 data_reduction_proxy_auth_request_handler() const { | 436 data_reduction_proxy_auth_request_handler() const { |
445 return data_reduction_proxy_auth_request_handler_.get(); | 437 return data_reduction_proxy_auth_request_handler_.get(); |
446 } | 438 } |
447 | 439 |
448 void set_data_reduction_proxy_auth_request_handler( | 440 void set_data_reduction_proxy_auth_request_handler( |
449 scoped_ptr<data_reduction_proxy::DataReductionProxyAuthRequestHandler> | 441 scoped_ptr<data_reduction_proxy::DataReductionProxyAuthRequestHandler> |
450 data_reduction_proxy_auth_request_handler) const { | 442 data_reduction_proxy_auth_request_handler) const { |
451 data_reduction_proxy_auth_request_handler_ = | 443 data_reduction_proxy_auth_request_handler_ = |
452 data_reduction_proxy_auth_request_handler.Pass(); | 444 data_reduction_proxy_auth_request_handler.Pass(); |
453 } | 445 } |
454 #endif // defined(SPDY_PROXY_AUTH_ORIGIN) | |
455 | 446 |
456 ChromeNetworkDelegate* network_delegate() const { | 447 ChromeNetworkDelegate* network_delegate() const { |
457 return network_delegate_.get(); | 448 return network_delegate_.get(); |
458 } | 449 } |
459 | 450 |
460 net::FraudulentCertificateReporter* fraudulent_certificate_reporter() const { | 451 net::FraudulentCertificateReporter* fraudulent_certificate_reporter() const { |
461 return fraudulent_certificate_reporter_.get(); | 452 return fraudulent_certificate_reporter_.get(); |
462 } | 453 } |
463 | 454 |
464 net::ProxyService* proxy_service() const { | 455 net::ProxyService* proxy_service() const { |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 | 607 |
617 mutable StringListPrefMember one_click_signin_rejected_email_list_; | 608 mutable StringListPrefMember one_click_signin_rejected_email_list_; |
618 | 609 |
619 mutable scoped_refptr<MediaDeviceIDSalt> media_device_id_salt_; | 610 mutable scoped_refptr<MediaDeviceIDSalt> media_device_id_salt_; |
620 | 611 |
621 // Member variables which are pointed to by the various context objects. | 612 // Member variables which are pointed to by the various context objects. |
622 mutable BooleanPrefMember enable_referrers_; | 613 mutable BooleanPrefMember enable_referrers_; |
623 mutable BooleanPrefMember enable_do_not_track_; | 614 mutable BooleanPrefMember enable_do_not_track_; |
624 mutable BooleanPrefMember force_safesearch_; | 615 mutable BooleanPrefMember force_safesearch_; |
625 mutable BooleanPrefMember safe_browsing_enabled_; | 616 mutable BooleanPrefMember safe_browsing_enabled_; |
626 #if defined(SPDY_PROXY_AUTH_ORIGIN) | |
627 mutable BooleanPrefMember data_reduction_proxy_enabled_; | 617 mutable BooleanPrefMember data_reduction_proxy_enabled_; |
628 #endif | |
629 mutable BooleanPrefMember printing_enabled_; | 618 mutable BooleanPrefMember printing_enabled_; |
630 mutable BooleanPrefMember sync_disabled_; | 619 mutable BooleanPrefMember sync_disabled_; |
631 mutable BooleanPrefMember signin_allowed_; | 620 mutable BooleanPrefMember signin_allowed_; |
632 mutable IntegerPrefMember network_prediction_options_; | 621 mutable IntegerPrefMember network_prediction_options_; |
633 // TODO(marja): Remove session_startup_pref_ if no longer needed. | 622 // TODO(marja): Remove session_startup_pref_ if no longer needed. |
634 mutable IntegerPrefMember session_startup_pref_; | 623 mutable IntegerPrefMember session_startup_pref_; |
635 mutable BooleanPrefMember quick_check_enabled_; | 624 mutable BooleanPrefMember quick_check_enabled_; |
636 mutable IntegerPrefMember incognito_availibility_pref_; | 625 mutable IntegerPrefMember incognito_availibility_pref_; |
637 | 626 |
638 // The state of metrics reporting in the browser that this profile runs on. | 627 // The state of metrics reporting in the browser that this profile runs on. |
(...skipping 10 matching lines...) Expand all Loading... |
649 mutable scoped_ptr<policy::URLBlacklistManager> url_blacklist_manager_; | 638 mutable scoped_ptr<policy::URLBlacklistManager> url_blacklist_manager_; |
650 mutable scoped_ptr<policy::PolicyHeaderIOHelper> policy_header_helper_; | 639 mutable scoped_ptr<policy::PolicyHeaderIOHelper> policy_header_helper_; |
651 #endif | 640 #endif |
652 | 641 |
653 // Pointed to by URLRequestContext. | 642 // Pointed to by URLRequestContext. |
654 #if defined(ENABLE_EXTENSIONS) | 643 #if defined(ENABLE_EXTENSIONS) |
655 mutable scoped_refptr<extensions::InfoMap> extension_info_map_; | 644 mutable scoped_refptr<extensions::InfoMap> extension_info_map_; |
656 #endif | 645 #endif |
657 mutable scoped_ptr<net::ChannelIDService> channel_id_service_; | 646 mutable scoped_ptr<net::ChannelIDService> channel_id_service_; |
658 | 647 |
659 #if defined(SPDY_PROXY_AUTH_ORIGIN) | |
660 // data_reduction_proxy_* classes must be declared before |network_delegate_|. | 648 // data_reduction_proxy_* classes must be declared before |network_delegate_|. |
661 // The data_reduction_proxy_* classes are passed in to |network_delegate_|, | 649 // The data_reduction_proxy_* classes are passed in to |network_delegate_|, |
662 // so this ordering ensures that the |network_delegate_| never references | 650 // so this ordering ensures that the |network_delegate_| never references |
663 // freed objects. | 651 // freed objects. |
664 mutable scoped_ptr<data_reduction_proxy::DataReductionProxyParams> | 652 mutable scoped_ptr<data_reduction_proxy::DataReductionProxyParams> |
665 data_reduction_proxy_params_; | 653 data_reduction_proxy_params_; |
666 mutable scoped_ptr<data_reduction_proxy::DataReductionProxyUsageStats> | 654 mutable scoped_ptr<data_reduction_proxy::DataReductionProxyUsageStats> |
667 data_reduction_proxy_usage_stats_; | 655 data_reduction_proxy_usage_stats_; |
668 mutable scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs> | 656 mutable scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs> |
669 data_reduction_proxy_statistics_prefs_; | 657 data_reduction_proxy_statistics_prefs_; |
670 mutable base::Callback<void(bool)> data_reduction_proxy_unavailable_callback_; | 658 mutable base::Callback<void(bool)> data_reduction_proxy_unavailable_callback_; |
671 mutable scoped_ptr<DataReductionProxyChromeConfigurator> | 659 mutable scoped_ptr<DataReductionProxyChromeConfigurator> |
672 data_reduction_proxy_chrome_configurator_; | 660 data_reduction_proxy_chrome_configurator_; |
673 mutable scoped_ptr<data_reduction_proxy::DataReductionProxyAuthRequestHandler> | 661 mutable scoped_ptr<data_reduction_proxy::DataReductionProxyAuthRequestHandler> |
674 data_reduction_proxy_auth_request_handler_; | 662 data_reduction_proxy_auth_request_handler_; |
675 #endif // defined(SPDY_PROXY_AUTH_ORIGIN) | |
676 | 663 |
677 mutable scoped_ptr<ChromeNetworkDelegate> network_delegate_; | 664 mutable scoped_ptr<ChromeNetworkDelegate> network_delegate_; |
678 mutable scoped_ptr<net::FraudulentCertificateReporter> | 665 mutable scoped_ptr<net::FraudulentCertificateReporter> |
679 fraudulent_certificate_reporter_; | 666 fraudulent_certificate_reporter_; |
680 mutable scoped_ptr<net::ProxyService> proxy_service_; | 667 mutable scoped_ptr<net::ProxyService> proxy_service_; |
681 mutable scoped_ptr<net::TransportSecurityState> transport_security_state_; | 668 mutable scoped_ptr<net::TransportSecurityState> transport_security_state_; |
682 mutable scoped_ptr<net::HttpServerProperties> | 669 mutable scoped_ptr<net::HttpServerProperties> |
683 http_server_properties_; | 670 http_server_properties_; |
684 #if defined(OS_CHROMEOS) | 671 #if defined(OS_CHROMEOS) |
685 // Set to |cert_verifier_| if it references a PolicyCertVerifier. In that | 672 // Set to |cert_verifier_| if it references a PolicyCertVerifier. In that |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 | 709 |
723 // TODO(jhawkins): Remove once crbug.com/102004 is fixed. | 710 // TODO(jhawkins): Remove once crbug.com/102004 is fixed. |
724 bool initialized_on_UI_thread_; | 711 bool initialized_on_UI_thread_; |
725 | 712 |
726 const Profile::ProfileType profile_type_; | 713 const Profile::ProfileType profile_type_; |
727 | 714 |
728 DISALLOW_COPY_AND_ASSIGN(ProfileIOData); | 715 DISALLOW_COPY_AND_ASSIGN(ProfileIOData); |
729 }; | 716 }; |
730 | 717 |
731 #endif // CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ | 718 #endif // CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ |
OLD | NEW |