Fix lifecycle of data reduction proxy objects in profile io data.
[chromium-blink-merge.git] / chrome / browser / profiles / profile_io_data.h
blob81f588c30f074d80c64d90cf17fa4eecd9b9853b
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_
6 #define CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_
8 #include <map>
9 #include <string>
10 #include <vector>
12 #include "base/basictypes.h"
13 #include "base/callback_forward.h"
14 #include "base/files/file_path.h"
15 #include "base/memory/ref_counted.h"
16 #include "base/memory/scoped_ptr.h"
17 #include "base/memory/weak_ptr.h"
18 #include "base/prefs/pref_member.h"
19 #include "base/synchronization/lock.h"
20 #include "chrome/browser/custom_handlers/protocol_handler_registry.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"
24 #include "chrome/browser/profiles/storage_partition_descriptor.h"
25 #include "components/content_settings/core/common/content_settings_types.h"
26 #include "components/data_reduction_proxy/browser/data_reduction_proxy_statistics_prefs.h"
27 #include "components/data_reduction_proxy/browser/data_reduction_proxy_usage_stats.h"
28 #include "content/public/browser/content_browser_client.h"
29 #include "content/public/browser/resource_context.h"
30 #include "net/cookies/cookie_monster.h"
31 #include "net/http/http_cache.h"
32 #include "net/http/http_network_session.h"
33 #include "net/url_request/url_request_context.h"
34 #include "net/url_request/url_request_job_factory.h"
36 #if defined(SPDY_PROXY_AUTH_ORIGIN)
37 #include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler.h"
38 #endif // SPDY_PROXY_AUTH_ORIGIN
40 class ChromeHttpUserAgentSettings;
41 class ChromeNetworkDelegate;
42 class ChromeURLRequestContextGetter;
43 class CookieSettings;
44 class DevToolsNetworkController;
45 class HostContentSettingsMap;
46 class MediaDeviceIDSalt;
47 class ProtocolHandlerRegistry;
48 class SigninNamesOnIOThread;
49 class SupervisedUserURLFilter;
51 namespace chrome_browser_net {
52 class ResourcePrefetchPredictorObserver;
55 namespace extensions {
56 class InfoMap;
59 namespace net {
60 class CertVerifier;
61 class ChannelIDService;
62 class CookieStore;
63 class FraudulentCertificateReporter;
64 class FtpTransactionFactory;
65 class HttpServerProperties;
66 class HttpTransactionFactory;
67 class ProxyConfigService;
68 class ProxyService;
69 class SSLConfigService;
70 class TransportSecurityPersister;
71 class TransportSecurityState;
72 class URLRequestJobFactoryImpl;
73 } // namespace net
75 namespace policy {
76 class PolicyCertVerifier;
77 class PolicyHeaderIOHelper;
78 class URLBlacklistManager;
79 } // namespace policy
81 namespace prerender {
82 class PrerenderTracker;
85 // Conceptually speaking, the ProfileIOData represents data that lives on the IO
86 // thread that is owned by a Profile, such as, but not limited to, network
87 // objects like CookieMonster, HttpTransactionFactory, etc. Profile owns
88 // ProfileIOData, but will make sure to delete it on the IO thread (except
89 // possibly in unit tests where there is no IO thread).
90 class ProfileIOData {
91 public:
92 typedef std::vector<scoped_refptr<ChromeURLRequestContextGetter>>
93 ChromeURLRequestContextGetterVector;
95 virtual ~ProfileIOData();
97 static ProfileIOData* FromResourceContext(content::ResourceContext* rc);
99 // Returns true if |scheme| is handled in Chrome, or by default handlers in
100 // net::URLRequest.
101 static bool IsHandledProtocol(const std::string& scheme);
103 // Returns true if |url| is handled in Chrome, or by default handlers in
104 // net::URLRequest.
105 static bool IsHandledURL(const GURL& url);
107 // Utility to install additional WebUI handlers into the |job_factory|.
108 // Ownership of the handlers is transfered from |protocol_handlers|
109 // to the |job_factory|.
110 static void InstallProtocolHandlers(
111 net::URLRequestJobFactoryImpl* job_factory,
112 content::ProtocolHandlerMap* protocol_handlers);
114 // Called by Profile.
115 content::ResourceContext* GetResourceContext() const;
117 // Initializes the ProfileIOData object and primes the RequestContext
118 // generation. Must be called prior to any of the Get*() methods other than
119 // GetResouceContext or GetMetricsEnabledStateOnIOThread.
120 void Init(
121 content::ProtocolHandlerMap* protocol_handlers,
122 content::URLRequestInterceptorScopedVector request_interceptors) const;
124 net::URLRequestContext* GetMainRequestContext() const;
125 net::URLRequestContext* GetMediaRequestContext() const;
126 net::URLRequestContext* GetExtensionsRequestContext() const;
127 net::URLRequestContext* GetIsolatedAppRequestContext(
128 net::URLRequestContext* main_context,
129 const StoragePartitionDescriptor& partition_descriptor,
130 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
131 protocol_handler_interceptor,
132 content::ProtocolHandlerMap* protocol_handlers,
133 content::URLRequestInterceptorScopedVector request_interceptors) const;
134 net::URLRequestContext* GetIsolatedMediaRequestContext(
135 net::URLRequestContext* app_context,
136 const StoragePartitionDescriptor& partition_descriptor) const;
138 // These are useful when the Chrome layer is called from the content layer
139 // with a content::ResourceContext, and they want access to Chrome data for
140 // that profile.
141 extensions::InfoMap* GetExtensionInfoMap() const;
142 CookieSettings* GetCookieSettings() const;
143 HostContentSettingsMap* GetHostContentSettingsMap() const;
145 IntegerPrefMember* session_startup_pref() const {
146 return &session_startup_pref_;
149 SigninNamesOnIOThread* signin_names() const {
150 return signin_names_.get();
153 StringPrefMember* google_services_account_id() const {
154 return &google_services_user_account_id_;
157 StringPrefMember* google_services_username() const {
158 return &google_services_username_;
161 StringPrefMember* google_services_username_pattern() const {
162 return &google_services_username_pattern_;
165 BooleanPrefMember* reverse_autologin_enabled() const {
166 return &reverse_autologin_enabled_;
169 const std::string& reverse_autologin_pending_email() const {
170 return reverse_autologin_pending_email_;
173 void set_reverse_autologin_pending_email(const std::string& email) {
174 reverse_autologin_pending_email_ = email;
177 StringListPrefMember* one_click_signin_rejected_email_list() const {
178 return &one_click_signin_rejected_email_list_;
181 net::URLRequestContext* extensions_request_context() const {
182 return extensions_request_context_.get();
185 BooleanPrefMember* safe_browsing_enabled() const {
186 return &safe_browsing_enabled_;
189 #if defined(SPDY_PROXY_AUTH_ORIGIN)
190 // TODO(feng): move the function to protected area.
191 // IsDataReductionProxyEnabled() should be used as public API.
192 BooleanPrefMember* data_reduction_proxy_enabled() const {
193 return &data_reduction_proxy_enabled_;
195 #endif
197 BooleanPrefMember* printing_enabled() const {
198 return &printing_enabled_;
201 BooleanPrefMember* sync_disabled() const {
202 return &sync_disabled_;
205 BooleanPrefMember* signin_allowed() const {
206 return &signin_allowed_;
209 IntegerPrefMember* network_prediction_options() const {
210 return &network_prediction_options_;
213 content::ResourceContext::SaltCallback GetMediaDeviceIDSalt() const;
215 DevToolsNetworkController* network_controller() const {
216 return network_controller_.get();
219 net::TransportSecurityState* transport_security_state() const {
220 return transport_security_state_.get();
223 #if defined(OS_CHROMEOS)
224 std::string username_hash() const {
225 return username_hash_;
228 bool use_system_key_slot() const { return use_system_key_slot_; }
229 #endif
231 Profile::ProfileType profile_type() const {
232 return profile_type_;
235 bool IsOffTheRecord() const;
237 IntegerPrefMember* incognito_availibility() const {
238 return &incognito_availibility_pref_;
241 chrome_browser_net::ResourcePrefetchPredictorObserver*
242 resource_prefetch_predictor_observer() const {
243 return resource_prefetch_predictor_observer_.get();
246 #if defined(ENABLE_CONFIGURATION_POLICY)
247 policy::PolicyHeaderIOHelper* policy_header_helper() const {
248 return policy_header_helper_.get();
250 #endif
252 #if defined(ENABLE_MANAGED_USERS)
253 const SupervisedUserURLFilter* supervised_user_url_filter() const {
254 return supervised_user_url_filter_.get();
256 #endif
258 // Initialize the member needed to track the metrics enabled state. This is
259 // only to be called on the UI thread.
260 void InitializeMetricsEnabledStateOnUIThread();
262 // 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
264 // should only be called from there.
265 bool GetMetricsEnabledStateOnIOThread() const;
267 #if defined(OS_ANDROID)
268 // Returns whether or not data reduction proxy is enabled in the browser
269 // instance on which this profile resides.
270 bool IsDataReductionProxyEnabled() const;
271 #endif
273 void set_client_cert_store_factory_for_testing(
274 const base::Callback<scoped_ptr<net::ClientCertStore>()>& factory) {
275 client_cert_store_factory_ = factory;
278 protected:
279 // A URLRequestContext for media that owns its HTTP factory, to ensure
280 // it is deleted.
281 class MediaRequestContext : public net::URLRequestContext {
282 public:
283 MediaRequestContext();
285 void SetHttpTransactionFactory(
286 scoped_ptr<net::HttpTransactionFactory> http_factory);
288 private:
289 virtual ~MediaRequestContext();
291 scoped_ptr<net::HttpTransactionFactory> http_factory_;
294 // A URLRequestContext for apps that owns its cookie store and HTTP factory,
295 // to ensure they are deleted.
296 class AppRequestContext : public net::URLRequestContext {
297 public:
298 AppRequestContext();
300 void SetCookieStore(net::CookieStore* cookie_store);
301 void SetHttpTransactionFactory(
302 scoped_ptr<net::HttpTransactionFactory> http_factory);
303 void SetJobFactory(scoped_ptr<net::URLRequestJobFactory> job_factory);
305 private:
306 virtual ~AppRequestContext();
308 scoped_refptr<net::CookieStore> cookie_store_;
309 scoped_ptr<net::HttpTransactionFactory> http_factory_;
310 scoped_ptr<net::URLRequestJobFactory> job_factory_;
313 // Created on the UI thread, read on the IO thread during ProfileIOData lazy
314 // initialization.
315 struct ProfileParams {
316 ProfileParams();
317 ~ProfileParams();
319 base::FilePath path;
320 IOThread* io_thread;
321 scoped_refptr<CookieSettings> cookie_settings;
322 scoped_refptr<HostContentSettingsMap> host_content_settings_map;
323 scoped_refptr<net::SSLConfigService> ssl_config_service;
324 scoped_refptr<net::CookieMonster::Delegate> cookie_monster_delegate;
325 #if defined(ENABLE_EXTENSIONS)
326 scoped_refptr<extensions::InfoMap> extension_info_map;
327 #endif
328 scoped_ptr<chrome_browser_net::ResourcePrefetchPredictorObserver>
329 resource_prefetch_predictor_observer_;
331 // This pointer exists only as a means of conveying a url job factory
332 // pointer from the protocol handler registry on the UI thread to the
333 // the URLRequestContext on the IO thread. The consumer MUST take
334 // ownership of the object by calling release() on this pointer.
335 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
336 protocol_handler_interceptor;
338 // We need to initialize the ProxyConfigService from the UI thread
339 // because on linux it relies on initializing things through gconf,
340 // and needs to be on the main thread.
341 scoped_ptr<net::ProxyConfigService> proxy_config_service;
343 #if defined(ENABLE_MANAGED_USERS)
344 scoped_refptr<const SupervisedUserURLFilter> supervised_user_url_filter;
345 #endif
347 #if defined(OS_CHROMEOS)
348 std::string username_hash;
349 bool use_system_key_slot;
350 #endif
352 // The profile this struct was populated from. It's passed as a void* to
353 // ensure it's not accidently used on the IO thread. Before using it on the
354 // UI thread, call ProfileManager::IsValidProfile to ensure it's alive.
355 void* profile;
357 prerender::PrerenderTracker* prerender_tracker;
360 explicit ProfileIOData(Profile::ProfileType profile_type);
362 static std::string GetSSLSessionCacheShard();
364 void InitializeOnUIThread(Profile* profile);
365 void ApplyProfileParamsToContext(net::URLRequestContext* context) const;
367 scoped_ptr<net::URLRequestJobFactory> SetUpJobFactoryDefaults(
368 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory,
369 content::URLRequestInterceptorScopedVector request_interceptors,
370 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
371 protocol_handler_interceptor,
372 net::NetworkDelegate* network_delegate,
373 net::FtpTransactionFactory* ftp_transaction_factory) const;
375 // Called when the profile is destroyed.
376 void ShutdownOnUIThread(
377 scoped_ptr<ChromeURLRequestContextGetterVector> context_getters);
379 // A ChannelIDService object is created by a derived class of
380 // ProfileIOData, and the derived class calls this method to set the
381 // channel_id_service_ member and transfers ownership to the base
382 // class.
383 void set_channel_id_service(
384 net::ChannelIDService* channel_id_service) const;
386 #if defined(SPDY_PROXY_AUTH_ORIGIN)
387 data_reduction_proxy::DataReductionProxyParams* data_reduction_proxy_params()
388 const {
389 return data_reduction_proxy_params_.get();
392 void set_data_reduction_proxy_params(
393 scoped_ptr<data_reduction_proxy::DataReductionProxyParams>
394 data_reduction_proxy_params) const {
395 data_reduction_proxy_params_ = data_reduction_proxy_params.Pass();
398 data_reduction_proxy::DataReductionProxyUsageStats*
399 data_reduction_proxy_usage_stats() const {
400 return data_reduction_proxy_usage_stats_.get();
403 void set_data_reduction_proxy_statistics_prefs(
404 scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs>
405 data_reduction_proxy_statistics_prefs) {
406 data_reduction_proxy_statistics_prefs_ =
407 data_reduction_proxy_statistics_prefs.Pass();
410 data_reduction_proxy::DataReductionProxyStatisticsPrefs*
411 data_reduction_proxy_statistics_prefs() const {
412 return data_reduction_proxy_statistics_prefs_.get();
415 void set_data_reduction_proxy_usage_stats(
416 scoped_ptr<data_reduction_proxy::DataReductionProxyUsageStats>
417 data_reduction_proxy_usage_stats) const {
418 data_reduction_proxy_usage_stats_ =
419 data_reduction_proxy_usage_stats.Pass();
422 base::Callback<void(bool)> data_reduction_proxy_unavailable_callback() const {
423 return data_reduction_proxy_unavailable_callback_;
426 void set_data_reduction_proxy_unavailable_callback(
427 const base::Callback<void(bool)>& unavailable_callback) const {
428 data_reduction_proxy_unavailable_callback_ = unavailable_callback;
431 DataReductionProxyChromeConfigurator*
432 data_reduction_proxy_chrome_configurator() const {
433 return data_reduction_proxy_chrome_configurator_.get();
436 void set_data_reduction_proxy_chrome_configurator(
437 scoped_ptr<DataReductionProxyChromeConfigurator>
438 data_reduction_proxy_chrome_configurator) const {
439 data_reduction_proxy_chrome_configurator_ =
440 data_reduction_proxy_chrome_configurator.Pass();
443 data_reduction_proxy::DataReductionProxyAuthRequestHandler*
444 data_reduction_proxy_auth_request_handler() const {
445 return data_reduction_proxy_auth_request_handler_.get();
448 void set_data_reduction_proxy_auth_request_handler(
449 scoped_ptr<data_reduction_proxy::DataReductionProxyAuthRequestHandler>
450 data_reduction_proxy_auth_request_handler) const {
451 data_reduction_proxy_auth_request_handler_ =
452 data_reduction_proxy_auth_request_handler.Pass();
454 #endif // defined(SPDY_PROXY_AUTH_ORIGIN)
456 ChromeNetworkDelegate* network_delegate() const {
457 return network_delegate_.get();
460 net::FraudulentCertificateReporter* fraudulent_certificate_reporter() const {
461 return fraudulent_certificate_reporter_.get();
464 net::ProxyService* proxy_service() const {
465 return proxy_service_.get();
468 base::WeakPtr<net::HttpServerProperties> http_server_properties() const;
470 void set_http_server_properties(
471 scoped_ptr<net::HttpServerProperties> http_server_properties) const;
473 net::URLRequestContext* main_request_context() const {
474 return main_request_context_.get();
477 bool initialized() const {
478 return initialized_;
481 // Destroys the ResourceContext first, to cancel any URLRequests that are
482 // using it still, before we destroy the member variables that those
483 // URLRequests may be accessing.
484 void DestroyResourceContext();
486 // Creates network session and main network transaction factory.
487 scoped_ptr<net::HttpCache> CreateMainHttpFactory(
488 const ProfileParams* profile_params,
489 net::HttpCache::BackendFactory* main_backend) const;
491 // Creates network transaction factory.
492 scoped_ptr<net::HttpCache> CreateHttpFactory(
493 net::HttpNetworkSession* shared_session,
494 net::HttpCache::BackendFactory* backend) const;
496 void SetCookieSettingsForTesting(CookieSettings* cookie_settings);
498 void set_signin_names_for_testing(SigninNamesOnIOThread* signin_names);
500 private:
501 class ResourceContext : public content::ResourceContext {
502 public:
503 explicit ResourceContext(ProfileIOData* io_data);
504 virtual ~ResourceContext();
506 // ResourceContext implementation:
507 virtual net::HostResolver* GetHostResolver() OVERRIDE;
508 virtual net::URLRequestContext* GetRequestContext() OVERRIDE;
509 virtual scoped_ptr<net::ClientCertStore> CreateClientCertStore() OVERRIDE;
510 virtual void CreateKeygenHandler(
511 uint32 key_size_in_bits,
512 const std::string& challenge_string,
513 const GURL& url,
514 const base::Callback<void(scoped_ptr<net::KeygenHandler>)>& callback)
515 OVERRIDE;
516 virtual SaltCallback GetMediaDeviceIDSalt() OVERRIDE;
518 private:
519 friend class ProfileIOData;
521 ProfileIOData* const io_data_;
523 net::HostResolver* host_resolver_;
524 net::URLRequestContext* request_context_;
527 typedef std::map<StoragePartitionDescriptor,
528 net::URLRequestContext*,
529 StoragePartitionDescriptorLess>
530 URLRequestContextMap;
532 // --------------------------------------------
533 // Virtual interface for subtypes to implement:
534 // --------------------------------------------
536 // Does the actual initialization of the ProfileIOData subtype. Subtypes
537 // should use the static helper functions above to implement this.
538 virtual void InitializeInternal(
539 ProfileParams* profile_params,
540 content::ProtocolHandlerMap* protocol_handlers,
541 content::URLRequestInterceptorScopedVector
542 request_interceptors) const = 0;
544 // Initializes the RequestContext for extensions.
545 virtual void InitializeExtensionsRequestContext(
546 ProfileParams* profile_params) const = 0;
547 // Does an on-demand initialization of a RequestContext for the given
548 // isolated app.
549 virtual net::URLRequestContext* InitializeAppRequestContext(
550 net::URLRequestContext* main_context,
551 const StoragePartitionDescriptor& details,
552 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
553 protocol_handler_interceptor,
554 content::ProtocolHandlerMap* protocol_handlers,
555 content::URLRequestInterceptorScopedVector
556 request_interceptors) const = 0;
558 // Does an on-demand initialization of a media RequestContext for the given
559 // isolated app.
560 virtual net::URLRequestContext* InitializeMediaRequestContext(
561 net::URLRequestContext* original_context,
562 const StoragePartitionDescriptor& details) const = 0;
564 // These functions are used to transfer ownership of the lazily initialized
565 // context from ProfileIOData to the URLRequestContextGetter.
566 virtual net::URLRequestContext*
567 AcquireMediaRequestContext() const = 0;
568 virtual net::URLRequestContext* AcquireIsolatedAppRequestContext(
569 net::URLRequestContext* main_context,
570 const StoragePartitionDescriptor& partition_descriptor,
571 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
572 protocol_handler_interceptor,
573 content::ProtocolHandlerMap* protocol_handlers,
574 content::URLRequestInterceptorScopedVector
575 request_interceptors) const = 0;
576 virtual net::URLRequestContext*
577 AcquireIsolatedMediaRequestContext(
578 net::URLRequestContext* app_context,
579 const StoragePartitionDescriptor& partition_descriptor) const = 0;
581 // The order *DOES* matter for the majority of these member variables, so
582 // don't move them around unless you know what you're doing!
583 // General rules:
584 // * ResourceContext references the URLRequestContexts, so
585 // URLRequestContexts must outlive ResourceContext, hence ResourceContext
586 // should be destroyed first.
587 // * URLRequestContexts reference a whole bunch of members, so
588 // URLRequestContext needs to be destroyed before them.
589 // * Therefore, ResourceContext should be listed last, and then the
590 // URLRequestContexts, and then the URLRequestContext members.
591 // * Note that URLRequestContext members have a directed dependency graph
592 // too, so they must themselves be ordered correctly.
594 // Tracks whether or not we've been lazily initialized.
595 mutable bool initialized_;
597 // Data from the UI thread from the Profile, used to initialize ProfileIOData.
598 // Deleted after lazy initialization.
599 mutable scoped_ptr<ProfileParams> profile_params_;
601 // Provides access to the email addresses of all signed in profiles.
602 mutable scoped_ptr<SigninNamesOnIOThread> signin_names_;
604 // Used for testing.
605 mutable base::Callback<scoped_ptr<net::ClientCertStore>()>
606 client_cert_store_factory_;
608 mutable StringPrefMember google_services_user_account_id_;
609 mutable StringPrefMember google_services_username_;
610 mutable StringPrefMember google_services_username_pattern_;
611 mutable BooleanPrefMember reverse_autologin_enabled_;
613 // During the reverse autologin request chain processing, this member saves
614 // the email of the google account that is being signed into.
615 std::string reverse_autologin_pending_email_;
617 mutable StringListPrefMember one_click_signin_rejected_email_list_;
619 mutable scoped_refptr<MediaDeviceIDSalt> media_device_id_salt_;
621 // Member variables which are pointed to by the various context objects.
622 mutable BooleanPrefMember enable_referrers_;
623 mutable BooleanPrefMember enable_do_not_track_;
624 mutable BooleanPrefMember force_safesearch_;
625 mutable BooleanPrefMember safe_browsing_enabled_;
626 #if defined(SPDY_PROXY_AUTH_ORIGIN)
627 mutable BooleanPrefMember data_reduction_proxy_enabled_;
628 #endif
629 mutable BooleanPrefMember printing_enabled_;
630 mutable BooleanPrefMember sync_disabled_;
631 mutable BooleanPrefMember signin_allowed_;
632 mutable IntegerPrefMember network_prediction_options_;
633 // TODO(marja): Remove session_startup_pref_ if no longer needed.
634 mutable IntegerPrefMember session_startup_pref_;
635 mutable BooleanPrefMember quick_check_enabled_;
636 mutable IntegerPrefMember incognito_availibility_pref_;
638 // The state of metrics reporting in the browser that this profile runs on.
639 // Unfortunately, since ChromeOS has a separate representation of this state,
640 // we need to make one available based on the platform.
641 #if defined(OS_CHROMEOS)
642 bool enable_metrics_;
643 #else
644 BooleanPrefMember enable_metrics_;
645 #endif
647 #if defined(ENABLE_CONFIGURATION_POLICY)
648 // Pointed to by NetworkDelegate.
649 mutable scoped_ptr<policy::URLBlacklistManager> url_blacklist_manager_;
650 mutable scoped_ptr<policy::PolicyHeaderIOHelper> policy_header_helper_;
651 #endif
653 // Pointed to by URLRequestContext.
654 #if defined(ENABLE_EXTENSIONS)
655 mutable scoped_refptr<extensions::InfoMap> extension_info_map_;
656 #endif
657 mutable scoped_ptr<net::ChannelIDService> channel_id_service_;
659 #if defined(SPDY_PROXY_AUTH_ORIGIN)
660 // data_reduction_proxy_* classes must be declared before |network_delegate_|.
661 // The data_reduction_proxy_* classes are passed in to |network_delegate_|,
662 // so this ordering ensures that the |network_delegate_| never references
663 // freed objects.
664 mutable scoped_ptr<data_reduction_proxy::DataReductionProxyParams>
665 data_reduction_proxy_params_;
666 mutable scoped_ptr<data_reduction_proxy::DataReductionProxyUsageStats>
667 data_reduction_proxy_usage_stats_;
668 mutable scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs>
669 data_reduction_proxy_statistics_prefs_;
670 mutable base::Callback<void(bool)> data_reduction_proxy_unavailable_callback_;
671 mutable scoped_ptr<DataReductionProxyChromeConfigurator>
672 data_reduction_proxy_chrome_configurator_;
673 mutable scoped_ptr<data_reduction_proxy::DataReductionProxyAuthRequestHandler>
674 data_reduction_proxy_auth_request_handler_;
675 #endif // defined(SPDY_PROXY_AUTH_ORIGIN)
677 mutable scoped_ptr<ChromeNetworkDelegate> network_delegate_;
678 mutable scoped_ptr<net::FraudulentCertificateReporter>
679 fraudulent_certificate_reporter_;
680 mutable scoped_ptr<net::ProxyService> proxy_service_;
681 mutable scoped_ptr<net::TransportSecurityState> transport_security_state_;
682 mutable scoped_ptr<net::HttpServerProperties>
683 http_server_properties_;
684 #if defined(OS_CHROMEOS)
685 // Set to |cert_verifier_| if it references a PolicyCertVerifier. In that
686 // case, the verifier is owned by |cert_verifier_|. Otherwise, set to NULL.
687 mutable policy::PolicyCertVerifier* policy_cert_verifier_;
688 mutable scoped_ptr<net::CertVerifier> cert_verifier_;
689 mutable std::string username_hash_;
690 mutable bool use_system_key_slot_;
691 #endif
693 mutable scoped_ptr<net::TransportSecurityPersister>
694 transport_security_persister_;
696 // These are only valid in between LazyInitialize() and their accessor being
697 // called.
698 mutable scoped_ptr<net::URLRequestContext> main_request_context_;
699 mutable scoped_ptr<net::URLRequestContext> extensions_request_context_;
700 // One URLRequestContext per isolated app for main and media requests.
701 mutable URLRequestContextMap app_request_context_map_;
702 mutable URLRequestContextMap isolated_media_request_context_map_;
704 mutable scoped_ptr<ResourceContext> resource_context_;
706 mutable scoped_refptr<CookieSettings> cookie_settings_;
708 mutable scoped_refptr<HostContentSettingsMap> host_content_settings_map_;
710 mutable scoped_ptr<chrome_browser_net::ResourcePrefetchPredictorObserver>
711 resource_prefetch_predictor_observer_;
713 mutable scoped_ptr<ChromeHttpUserAgentSettings>
714 chrome_http_user_agent_settings_;
716 #if defined(ENABLE_MANAGED_USERS)
717 mutable scoped_refptr<const SupervisedUserURLFilter>
718 supervised_user_url_filter_;
719 #endif
721 mutable scoped_ptr<DevToolsNetworkController> network_controller_;
723 // TODO(jhawkins): Remove once crbug.com/102004 is fixed.
724 bool initialized_on_UI_thread_;
726 const Profile::ProfileType profile_type_;
728 DISALLOW_COPY_AND_ASSIGN(ProfileIOData);
731 #endif // CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_