15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
8116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#include <map>
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <string>
1003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)#include <vector>
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/basictypes.h"
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/callback_forward.h"
142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "base/files/file_path.h"
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/memory/ref_counted.h"
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/memory/scoped_ptr.h"
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/memory/weak_ptr.h"
182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "base/prefs/pref_member.h"
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/synchronization/lock.h"
202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "chrome/browser/custom_handlers/protocol_handler_registry.h"
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/browser/io_thread.h"
221320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.h"
23a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "chrome/browser/profiles/profile.h"
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/browser/profiles/storage_partition_descriptor.h"
255f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#include "components/content_settings/core/common/content_settings_types.h"
261320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler.h"
271320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#include "components/data_reduction_proxy/browser/data_reduction_proxy_statistics_prefs.h"
28116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#include "components/data_reduction_proxy/browser/data_reduction_proxy_usage_stats.h"
292a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "content/public/browser/content_browser_client.h"
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "content/public/browser/resource_context.h"
315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "net/cookies/cookie_monster.h"
3246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)#include "net/http/http_cache.h"
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "net/http/http_network_session.h"
345f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#include "net/url_request/url_request_context.h"
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "net/url_request/url_request_job_factory.h"
365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ChromeHttpUserAgentSettings;
382a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class ChromeNetworkDelegate;
3903b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)class ChromeURLRequestContextGetter;
405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class CookieSettings;
4146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)class DevToolsNetworkController;
425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class HostContentSettingsMap;
43a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)class MediaDeviceIDSalt;
445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ProtocolHandlerRegistry;
455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class SigninNamesOnIOThread;
46f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)class SupervisedUserURLFilter;
475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
481320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tuccinamespace chrome_browser_net {
491320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucciclass ResourcePrefetchPredictorObserver;
501320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci}
511320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
52f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)namespace extensions {
53f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)class InfoMap;
54f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)}
55f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace net {
571320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucciclass CertVerifier;
585f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)class ChannelIDService;
595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class CookieStore;
605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class FraudulentCertificateReporter;
61b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)class FtpTransactionFactory;
622a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class HttpServerProperties;
635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class HttpTransactionFactory;
645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ProxyConfigService;
655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ProxyService;
665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class SSLConfigService;
67f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)class TransportSecurityPersister;
685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class TransportSecurityState;
695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class URLRequestJobFactoryImpl;
705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}  // namespace net
715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace policy {
73424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)class PolicyCertVerifier;
74a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)class PolicyHeaderIOHelper;
755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class URLBlacklistManager;
765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}  // namespace policy
775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
78cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)namespace prerender {
79cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)class PrerenderTracker;
80cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)}
81cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Conceptually speaking, the ProfileIOData represents data that lives on the IO
835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// thread that is owned by a Profile, such as, but not limited to, network
845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// objects like CookieMonster, HttpTransactionFactory, etc.  Profile owns
855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// ProfileIOData, but will make sure to delete it on the IO thread (except
865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// possibly in unit tests where there is no IO thread).
875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ProfileIOData {
885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public:
8903b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)  typedef std::vector<scoped_refptr<ChromeURLRequestContextGetter>>
9003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)      ChromeURLRequestContextGetterVector;
9103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)
925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual ~ProfileIOData();
935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static ProfileIOData* FromResourceContext(content::ResourceContext* rc);
955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns true if |scheme| is handled in Chrome, or by default handlers in
975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // net::URLRequest.
985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static bool IsHandledProtocol(const std::string& scheme);
995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns true if |url| is handled in Chrome, or by default handlers in
1015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // net::URLRequest.
1025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static bool IsHandledURL(const GURL& url);
1035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1042a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Utility to install additional WebUI handlers into the |job_factory|.
1052a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Ownership of the handlers is transfered from |protocol_handlers|
1062a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // to the |job_factory|.
1072a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  static void InstallProtocolHandlers(
1082a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      net::URLRequestJobFactoryImpl* job_factory,
1092a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      content::ProtocolHandlerMap* protocol_handlers);
1102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Called by Profile.
1125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  content::ResourceContext* GetResourceContext() const;
1135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Initializes the ProfileIOData object and primes the RequestContext
1152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // generation. Must be called prior to any of the Get*() methods other than
1162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // GetResouceContext or GetMetricsEnabledStateOnIOThread.
117cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  void Init(
118cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)      content::ProtocolHandlerMap* protocol_handlers,
119cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)      content::URLRequestInterceptorScopedVector request_interceptors) const;
1202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1215f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  net::URLRequestContext* GetMainRequestContext() const;
1225f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  net::URLRequestContext* GetMediaRequestContext() const;
1235f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  net::URLRequestContext* GetExtensionsRequestContext() const;
1245f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  net::URLRequestContext* GetIsolatedAppRequestContext(
1255f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)      net::URLRequestContext* main_context,
1265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      const StoragePartitionDescriptor& partition_descriptor,
1272a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
1282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)          protocol_handler_interceptor,
129a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      content::ProtocolHandlerMap* protocol_handlers,
130cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)      content::URLRequestInterceptorScopedVector request_interceptors) const;
1315f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  net::URLRequestContext* GetIsolatedMediaRequestContext(
1325f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)      net::URLRequestContext* app_context,
1335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      const StoragePartitionDescriptor& partition_descriptor) const;
1345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // These are useful when the Chrome layer is called from the content layer
1365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // with a content::ResourceContext, and they want access to Chrome data for
1375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // that profile.
138f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  extensions::InfoMap* GetExtensionInfoMap() const;
1395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  CookieSettings* GetCookieSettings() const;
140558790d6acca3451cf3a6b497803a5f07d0bec58Ben Murdoch  HostContentSettingsMap* GetHostContentSettingsMap() const;
1415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  IntegerPrefMember* session_startup_pref() const {
1435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return &session_startup_pref_;
1445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
1455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  SigninNamesOnIOThread* signin_names() const {
1475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return signin_names_.get();
1485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
1495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
150a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  StringPrefMember* google_services_account_id() const {
151a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)    return &google_services_user_account_id_;
152a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  }
153a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
1545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  StringPrefMember* google_services_username() const {
1555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return &google_services_username_;
1565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
1575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  StringPrefMember* google_services_username_pattern() const {
1595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return &google_services_username_pattern_;
1605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
1615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  BooleanPrefMember* reverse_autologin_enabled() const {
1635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return &reverse_autologin_enabled_;
1645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
1655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1662a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  const std::string& reverse_autologin_pending_email() const {
1672a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    return reverse_autologin_pending_email_;
1682a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  }
1692a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1702a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  void set_reverse_autologin_pending_email(const std::string& email) {
1712a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    reverse_autologin_pending_email_ = email;
1722a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  }
1732a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  StringListPrefMember* one_click_signin_rejected_email_list() const {
1755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return &one_click_signin_rejected_email_list_;
1765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
1775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1785f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  net::URLRequestContext* extensions_request_context() const {
1795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return extensions_request_context_.get();
1805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
1815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  BooleanPrefMember* safe_browsing_enabled() const {
1835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return &safe_browsing_enabled_;
1845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
1855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
186116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  // TODO(feng): move the function to protected area.
187116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  // IsDataReductionProxyEnabled() should be used as public API.
188f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  BooleanPrefMember* data_reduction_proxy_enabled() const {
189f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)    return &data_reduction_proxy_enabled_;
190f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  }
191f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)
1925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  BooleanPrefMember* printing_enabled() const {
1935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return &printing_enabled_;
1945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
1955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1962a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  BooleanPrefMember* sync_disabled() const {
1972a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    return &sync_disabled_;
1982a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  }
1992a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
2002a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  BooleanPrefMember* signin_allowed() const {
2012a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    return &signin_allowed_;
2022a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  }
2032a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
204116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  IntegerPrefMember* network_prediction_options() const {
205116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch    return &network_prediction_options_;
206116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  }
207116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch
2085d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  content::ResourceContext::SaltCallback GetMediaDeviceIDSalt() const;
209a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
21046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  DevToolsNetworkController* network_controller() const {
21146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)    return network_controller_.get();
21246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  }
21346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
2145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  net::TransportSecurityState* transport_security_state() const {
2155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return transport_security_state_.get();
2165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
2175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
218a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#if defined(OS_CHROMEOS)
219a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  std::string username_hash() const {
220a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)    return username_hash_;
221a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  }
2225f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
2235f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  bool use_system_key_slot() const { return use_system_key_slot_; }
224a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#endif
225a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
226a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  Profile::ProfileType profile_type() const {
227a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    return profile_type_;
2285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
2295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
230a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  bool IsOffTheRecord() const;
231a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
2325c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu  IntegerPrefMember* incognito_availibility() const {
2335c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu    return &incognito_availibility_pref_;
2345c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu  }
2355c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu
2361320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  chrome_browser_net::ResourcePrefetchPredictorObserver*
2371320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci      resource_prefetch_predictor_observer() const {
2381320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    return resource_prefetch_predictor_observer_.get();
2391320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  }
2401320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
241a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#if defined(ENABLE_CONFIGURATION_POLICY)
242a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  policy::PolicyHeaderIOHelper* policy_header_helper() const {
243a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)    return policy_header_helper_.get();
244a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  }
245a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#endif
246a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
2472a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#if defined(ENABLE_MANAGED_USERS)
248f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  const SupervisedUserURLFilter* supervised_user_url_filter() const {
249f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)    return supervised_user_url_filter_.get();
2502a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  }
2512a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#endif
2522a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
2535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Initialize the member needed to track the metrics enabled state. This is
2545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // only to be called on the UI thread.
2555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void InitializeMetricsEnabledStateOnUIThread();
2565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns whether or not metrics reporting is enabled in the browser instance
2585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // on which this profile resides. This is safe for use from the IO thread, and
2595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // should only be called from there.
2605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool GetMetricsEnabledStateOnIOThread() const;
2615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
262116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  // Returns whether or not data reduction proxy is enabled in the browser
263116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  // instance on which this profile resides.
264116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  bool IsDataReductionProxyEnabled() const;
265116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch
2665d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void set_client_cert_store_factory_for_testing(
2675d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    const base::Callback<scoped_ptr<net::ClientCertStore>()>& factory) {
2685d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)      client_cert_store_factory_ = factory;
2695d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  }
2705d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
2715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) protected:
2725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // A URLRequestContext for media that owns its HTTP factory, to ensure
2735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // it is deleted.
2745f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  class MediaRequestContext : public net::URLRequestContext {
2755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   public:
2765d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    MediaRequestContext();
2775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    void SetHttpTransactionFactory(
2795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)        scoped_ptr<net::HttpTransactionFactory> http_factory);
2805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   private:
2825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    virtual ~MediaRequestContext();
2835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    scoped_ptr<net::HttpTransactionFactory> http_factory_;
2855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  };
2865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // A URLRequestContext for apps that owns its cookie store and HTTP factory,
2885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // to ensure they are deleted.
2895f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  class AppRequestContext : public net::URLRequestContext {
2905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   public:
2915d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    AppRequestContext();
2925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    void SetCookieStore(net::CookieStore* cookie_store);
2945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    void SetHttpTransactionFactory(
2955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)        scoped_ptr<net::HttpTransactionFactory> http_factory);
2965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    void SetJobFactory(scoped_ptr<net::URLRequestJobFactory> job_factory);
2975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   private:
2995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    virtual ~AppRequestContext();
3005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    scoped_refptr<net::CookieStore> cookie_store_;
3025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    scoped_ptr<net::HttpTransactionFactory> http_factory_;
3035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    scoped_ptr<net::URLRequestJobFactory> job_factory_;
3045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  };
3055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Created on the UI thread, read on the IO thread during ProfileIOData lazy
3075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // initialization.
3085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  struct ProfileParams {
3095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    ProfileParams();
3105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    ~ProfileParams();
3115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    base::FilePath path;
3135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    IOThread* io_thread;
3145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    scoped_refptr<CookieSettings> cookie_settings;
315558790d6acca3451cf3a6b497803a5f07d0bec58Ben Murdoch    scoped_refptr<HostContentSettingsMap> host_content_settings_map;
3165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    scoped_refptr<net::SSLConfigService> ssl_config_service;
3175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    scoped_refptr<net::CookieMonster::Delegate> cookie_monster_delegate;
3185f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#if defined(ENABLE_EXTENSIONS)
319f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)    scoped_refptr<extensions::InfoMap> extension_info_map;
3205f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#endif
3211320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    scoped_ptr<chrome_browser_net::ResourcePrefetchPredictorObserver>
3221320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci        resource_prefetch_predictor_observer_;
3235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    // This pointer exists only as a means of conveying a url job factory
3255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    // pointer from the protocol handler registry on the UI thread to the
3262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    // the URLRequestContext on the IO thread. The consumer MUST take
3275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    // ownership of the object by calling release() on this pointer.
3282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
3295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)        protocol_handler_interceptor;
3305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    // We need to initialize the ProxyConfigService from the UI thread
3325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    // because on linux it relies on initializing things through gconf,
3335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    // and needs to be on the main thread.
3345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    scoped_ptr<net::ProxyConfigService> proxy_config_service;
3352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
3362a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#if defined(ENABLE_MANAGED_USERS)
337f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)    scoped_refptr<const SupervisedUserURLFilter> supervised_user_url_filter;
3382a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#endif
3392a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
340a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#if defined(OS_CHROMEOS)
341a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)    std::string username_hash;
3425f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    bool use_system_key_slot;
343a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#endif
344a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
3455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    // The profile this struct was populated from. It's passed as a void* to
3465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    // ensure it's not accidently used on the IO thread. Before using it on the
3475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    // UI thread, call ProfileManager::IsValidProfile to ensure it's alive.
3485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    void* profile;
349cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
350cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    prerender::PrerenderTracker* prerender_tracker;
3515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  };
3525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
353a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  explicit ProfileIOData(Profile::ProfileType profile_type);
3545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static std::string GetSSLSessionCacheShard();
3565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void InitializeOnUIThread(Profile* profile);
3585f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  void ApplyProfileParamsToContext(net::URLRequestContext* context) const;
3595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3602a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  scoped_ptr<net::URLRequestJobFactory> SetUpJobFactoryDefaults(
3612a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      scoped_ptr<net::URLRequestJobFactoryImpl> job_factory,
362cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)      content::URLRequestInterceptorScopedVector request_interceptors,
3632a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
3645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)          protocol_handler_interceptor,
3655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      net::NetworkDelegate* network_delegate,
366b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)      net::FtpTransactionFactory* ftp_transaction_factory) const;
3675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Called when the profile is destroyed.
36903b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)  void ShutdownOnUIThread(
37003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)      scoped_ptr<ChromeURLRequestContextGetterVector> context_getters);
3715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3725f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  // A ChannelIDService object is created by a derived class of
3735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // ProfileIOData, and the derived class calls this method to set the
3745f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  // channel_id_service_ member and transfers ownership to the base
3755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // class.
3765f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  void set_channel_id_service(
3775f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)      net::ChannelIDService* channel_id_service) const;
3785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3791320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  data_reduction_proxy::DataReductionProxyParams* data_reduction_proxy_params()
3801320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci      const {
3811320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    return data_reduction_proxy_params_.get();
3821320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  }
3831320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
3841320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  void set_data_reduction_proxy_params(
3851320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci      scoped_ptr<data_reduction_proxy::DataReductionProxyParams>
3861320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci          data_reduction_proxy_params) const {
3871320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    data_reduction_proxy_params_ = data_reduction_proxy_params.Pass();
3881320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  }
3891320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
3901320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  data_reduction_proxy::DataReductionProxyUsageStats*
3911320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci      data_reduction_proxy_usage_stats() const {
3921320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    return data_reduction_proxy_usage_stats_.get();
3931320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  }
3941320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
3951320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  void set_data_reduction_proxy_statistics_prefs(
3961320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci      scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs>
3971320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci          data_reduction_proxy_statistics_prefs) {
3981320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    data_reduction_proxy_statistics_prefs_ =
3991320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci        data_reduction_proxy_statistics_prefs.Pass();
4001320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  }
4011320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
4021320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  data_reduction_proxy::DataReductionProxyStatisticsPrefs*
4031320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci      data_reduction_proxy_statistics_prefs() const {
4041320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    return data_reduction_proxy_statistics_prefs_.get();
4051320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  }
4061320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
4071320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  void set_data_reduction_proxy_usage_stats(
4081320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci      scoped_ptr<data_reduction_proxy::DataReductionProxyUsageStats>
4091320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci          data_reduction_proxy_usage_stats) const {
4101320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci     data_reduction_proxy_usage_stats_ =
4111320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci         data_reduction_proxy_usage_stats.Pass();
4121320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  }
4131320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
4141320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  base::Callback<void(bool)> data_reduction_proxy_unavailable_callback() const {
4151320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    return data_reduction_proxy_unavailable_callback_;
4161320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  }
4171320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
4181320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  void set_data_reduction_proxy_unavailable_callback(
4191320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci      const base::Callback<void(bool)>& unavailable_callback) const {
4201320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    data_reduction_proxy_unavailable_callback_ = unavailable_callback;
4211320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  }
4221320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
4231320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  DataReductionProxyChromeConfigurator*
4241320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci      data_reduction_proxy_chrome_configurator() const {
4251320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    return data_reduction_proxy_chrome_configurator_.get();
4261320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  }
4271320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
4281320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  void set_data_reduction_proxy_chrome_configurator(
4291320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci      scoped_ptr<DataReductionProxyChromeConfigurator>
4301320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci          data_reduction_proxy_chrome_configurator) const {
4311320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    data_reduction_proxy_chrome_configurator_ =
4321320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci        data_reduction_proxy_chrome_configurator.Pass();
4331320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  }
4341320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
4351320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  data_reduction_proxy::DataReductionProxyAuthRequestHandler*
4361320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci      data_reduction_proxy_auth_request_handler() const {
4371320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    return data_reduction_proxy_auth_request_handler_.get();
4381320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  }
4391320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
4401320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  void set_data_reduction_proxy_auth_request_handler(
4411320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci      scoped_ptr<data_reduction_proxy::DataReductionProxyAuthRequestHandler>
4421320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci          data_reduction_proxy_auth_request_handler) const {
4431320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    data_reduction_proxy_auth_request_handler_ =
4441320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci        data_reduction_proxy_auth_request_handler.Pass();
4451320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  }
4461320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
4472a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  ChromeNetworkDelegate* network_delegate() const {
4485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return network_delegate_.get();
4495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
4505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  net::FraudulentCertificateReporter* fraudulent_certificate_reporter() const {
4525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return fraudulent_certificate_reporter_.get();
4535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
4545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  net::ProxyService* proxy_service() const {
4565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return proxy_service_.get();
4575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
4585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
459ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch  base::WeakPtr<net::HttpServerProperties> http_server_properties() const;
4602a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
4612a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  void set_http_server_properties(
462ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch      scoped_ptr<net::HttpServerProperties> http_server_properties) const;
4635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4645f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  net::URLRequestContext* main_request_context() const {
4655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return main_request_context_.get();
4665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
4675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4682a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  bool initialized() const {
4692a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    return initialized_;
4702a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  }
4712a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
4725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Destroys the ResourceContext first, to cancel any URLRequests that are
4735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // using it still, before we destroy the member variables that those
4745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // URLRequests may be accessing.
4755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void DestroyResourceContext();
4765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
47746d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // Creates network session and main network transaction factory.
47846d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  scoped_ptr<net::HttpCache> CreateMainHttpFactory(
4795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      const ProfileParams* profile_params,
48046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)      net::HttpCache::BackendFactory* main_backend) const;
48146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
48246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // Creates network transaction factory.
48346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  scoped_ptr<net::HttpCache> CreateHttpFactory(
48446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)      net::HttpNetworkSession* shared_session,
48546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)      net::HttpCache::BackendFactory* backend) const;
4865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void SetCookieSettingsForTesting(CookieSettings* cookie_settings);
4885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void set_signin_names_for_testing(SigninNamesOnIOThread* signin_names);
4905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) private:
4925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  class ResourceContext : public content::ResourceContext {
4935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   public:
4945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    explicit ResourceContext(ProfileIOData* io_data);
4955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    virtual ~ResourceContext();
4965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    // ResourceContext implementation:
4985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    virtual net::HostResolver* GetHostResolver() OVERRIDE;
4995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    virtual net::URLRequestContext* GetRequestContext() OVERRIDE;
5001e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)    virtual scoped_ptr<net::ClientCertStore> CreateClientCertStore() OVERRIDE;
5015d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    virtual void CreateKeygenHandler(
5025d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)        uint32 key_size_in_bits,
5035d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)        const std::string& challenge_string,
5045d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)        const GURL& url,
5055d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)        const base::Callback<void(scoped_ptr<net::KeygenHandler>)>& callback)
5065d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)        OVERRIDE;
5075d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    virtual SaltCallback GetMediaDeviceIDSalt() OVERRIDE;
5085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
5095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   private:
5105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    friend class ProfileIOData;
5115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
5125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    ProfileIOData* const io_data_;
5135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
5145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    net::HostResolver* host_resolver_;
5155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    net::URLRequestContext* request_context_;
5165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  };
5175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
5185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  typedef std::map<StoragePartitionDescriptor,
5195f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)                   net::URLRequestContext*,
5205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                   StoragePartitionDescriptorLess>
5215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      URLRequestContextMap;
5225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
5235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // --------------------------------------------
5245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Virtual interface for subtypes to implement:
5255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // --------------------------------------------
5265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
5275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Does the actual initialization of the ProfileIOData subtype. Subtypes
5285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // should use the static helper functions above to implement this.
5292a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void InitializeInternal(
5302a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      ProfileParams* profile_params,
531a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      content::ProtocolHandlerMap* protocol_handlers,
532cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)      content::URLRequestInterceptorScopedVector
533cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)          request_interceptors) const = 0;
5345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
5352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Initializes the RequestContext for extensions.
5362a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void InitializeExtensionsRequestContext(
5372a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      ProfileParams* profile_params) const = 0;
5385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Does an on-demand initialization of a RequestContext for the given
5395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // isolated app.
5405f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  virtual net::URLRequestContext* InitializeAppRequestContext(
5415f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)      net::URLRequestContext* main_context,
5425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      const StoragePartitionDescriptor& details,
5432a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
5442a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)          protocol_handler_interceptor,
545a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      content::ProtocolHandlerMap* protocol_handlers,
546cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)      content::URLRequestInterceptorScopedVector
547cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)          request_interceptors) const = 0;
5485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
5495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Does an on-demand initialization of a media RequestContext for the given
5505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // isolated app.
5515f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  virtual net::URLRequestContext* InitializeMediaRequestContext(
5525f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)      net::URLRequestContext* original_context,
5535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      const StoragePartitionDescriptor& details) const = 0;
5545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
5555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // These functions are used to transfer ownership of the lazily initialized
5565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // context from ProfileIOData to the URLRequestContextGetter.
5575f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  virtual net::URLRequestContext*
5585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      AcquireMediaRequestContext() const = 0;
5595f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  virtual net::URLRequestContext* AcquireIsolatedAppRequestContext(
5605f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)      net::URLRequestContext* main_context,
561a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      const StoragePartitionDescriptor& partition_descriptor,
562a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
563a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)          protocol_handler_interceptor,
564a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      content::ProtocolHandlerMap* protocol_handlers,
565cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)      content::URLRequestInterceptorScopedVector
566cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)          request_interceptors) const = 0;
5675f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  virtual net::URLRequestContext*
5685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      AcquireIsolatedMediaRequestContext(
5695f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)          net::URLRequestContext* app_context,
5705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)          const StoragePartitionDescriptor& partition_descriptor) const = 0;
5715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
5725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The order *DOES* matter for the majority of these member variables, so
5735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // don't move them around unless you know what you're doing!
5745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // General rules:
5755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  //   * ResourceContext references the URLRequestContexts, so
5765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  //   URLRequestContexts must outlive ResourceContext, hence ResourceContext
5775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  //   should be destroyed first.
5785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  //   * URLRequestContexts reference a whole bunch of members, so
5795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  //   URLRequestContext needs to be destroyed before them.
5805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  //   * Therefore, ResourceContext should be listed last, and then the
5815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  //   URLRequestContexts, and then the URLRequestContext members.
5825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  //   * Note that URLRequestContext members have a directed dependency graph
5835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  //   too, so they must themselves be ordered correctly.
5845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
5855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Tracks whether or not we've been lazily initialized.
5865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  mutable bool initialized_;
5875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
5885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Data from the UI thread from the Profile, used to initialize ProfileIOData.
5895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Deleted after lazy initialization.
5905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  mutable scoped_ptr<ProfileParams> profile_params_;
5915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
5925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Provides access to the email addresses of all signed in profiles.
5935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  mutable scoped_ptr<SigninNamesOnIOThread> signin_names_;
5945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
5955d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Used for testing.
5965d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  mutable base::Callback<scoped_ptr<net::ClientCertStore>()>
5975d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)      client_cert_store_factory_;
5985d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
599a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  mutable StringPrefMember google_services_user_account_id_;
6005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  mutable StringPrefMember google_services_username_;
6015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  mutable StringPrefMember google_services_username_pattern_;
6025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  mutable BooleanPrefMember reverse_autologin_enabled_;
6032a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
6042a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // During the reverse autologin request chain processing, this member saves
6052a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // the email of the google account that is being signed into.
6062a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  std::string reverse_autologin_pending_email_;
6072a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
6085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  mutable StringListPrefMember one_click_signin_rejected_email_list_;
6095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
6105d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  mutable scoped_refptr<MediaDeviceIDSalt> media_device_id_salt_;
611a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
6125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Member variables which are pointed to by the various context objects.
6135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  mutable BooleanPrefMember enable_referrers_;
6145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  mutable BooleanPrefMember enable_do_not_track_;
6155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  mutable BooleanPrefMember force_safesearch_;
6165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  mutable BooleanPrefMember safe_browsing_enabled_;
617f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  mutable BooleanPrefMember data_reduction_proxy_enabled_;
6185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  mutable BooleanPrefMember printing_enabled_;
6192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  mutable BooleanPrefMember sync_disabled_;
6202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  mutable BooleanPrefMember signin_allowed_;
621116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  mutable IntegerPrefMember network_prediction_options_;
6225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // TODO(marja): Remove session_startup_pref_ if no longer needed.
6235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  mutable IntegerPrefMember session_startup_pref_;
6245d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  mutable BooleanPrefMember quick_check_enabled_;
6255c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu  mutable IntegerPrefMember incognito_availibility_pref_;
6265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
6275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The state of metrics reporting in the browser that this profile runs on.
6285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Unfortunately, since ChromeOS has a separate representation of this state,
6295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // we need to make one available based on the platform.
6305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#if defined(OS_CHROMEOS)
6315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool enable_metrics_;
6325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#else
6335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  BooleanPrefMember enable_metrics_;
6345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif
6355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
6365d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#if defined(ENABLE_CONFIGURATION_POLICY)
6375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Pointed to by NetworkDelegate.
6385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  mutable scoped_ptr<policy::URLBlacklistManager> url_blacklist_manager_;
639a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  mutable scoped_ptr<policy::PolicyHeaderIOHelper> policy_header_helper_;
640a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#endif
641a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
6425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Pointed to by URLRequestContext.
6435f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#if defined(ENABLE_EXTENSIONS)
644f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  mutable scoped_refptr<extensions::InfoMap> extension_info_map_;
6455f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#endif
6465f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  mutable scoped_ptr<net::ChannelIDService> channel_id_service_;
6471320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
6481320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  // data_reduction_proxy_* classes must be declared before |network_delegate_|.
6491320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  // The data_reduction_proxy_* classes are passed in to |network_delegate_|,
6501320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  // so this ordering ensures that the |network_delegate_| never references
6511320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  // freed objects.
6521320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  mutable scoped_ptr<data_reduction_proxy::DataReductionProxyParams>
6531320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci      data_reduction_proxy_params_;
6541320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  mutable scoped_ptr<data_reduction_proxy::DataReductionProxyUsageStats>
6551320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci      data_reduction_proxy_usage_stats_;
6561320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  mutable scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs>
6571320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci            data_reduction_proxy_statistics_prefs_;
6581320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  mutable base::Callback<void(bool)> data_reduction_proxy_unavailable_callback_;
6591320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  mutable scoped_ptr<DataReductionProxyChromeConfigurator>
6601320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci      data_reduction_proxy_chrome_configurator_;
6611320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  mutable scoped_ptr<data_reduction_proxy::DataReductionProxyAuthRequestHandler>
6621320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci      data_reduction_proxy_auth_request_handler_;
6631320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
6642a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  mutable scoped_ptr<ChromeNetworkDelegate> network_delegate_;
6655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  mutable scoped_ptr<net::FraudulentCertificateReporter>
6665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      fraudulent_certificate_reporter_;
6675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  mutable scoped_ptr<net::ProxyService> proxy_service_;
6685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  mutable scoped_ptr<net::TransportSecurityState> transport_security_state_;
6692a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  mutable scoped_ptr<net::HttpServerProperties>
6702a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      http_server_properties_;
671c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)#if defined(OS_CHROMEOS)
6721320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  // Set to |cert_verifier_| if it references a PolicyCertVerifier. In that
6731320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  // case, the verifier is owned by  |cert_verifier_|. Otherwise, set to NULL.
6741320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  mutable policy::PolicyCertVerifier* policy_cert_verifier_;
6751320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  mutable scoped_ptr<net::CertVerifier> cert_verifier_;
676a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  mutable std::string username_hash_;
6775f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  mutable bool use_system_key_slot_;
6785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif
6795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
680f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  mutable scoped_ptr<net::TransportSecurityPersister>
6815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      transport_security_persister_;
6825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
6835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // These are only valid in between LazyInitialize() and their accessor being
6845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // called.
6855f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  mutable scoped_ptr<net::URLRequestContext> main_request_context_;
6865f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  mutable scoped_ptr<net::URLRequestContext> extensions_request_context_;
6875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // One URLRequestContext per isolated app for main and media requests.
6885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  mutable URLRequestContextMap app_request_context_map_;
6895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  mutable URLRequestContextMap isolated_media_request_context_map_;
6905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
6915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  mutable scoped_ptr<ResourceContext> resource_context_;
6925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
6935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  mutable scoped_refptr<CookieSettings> cookie_settings_;
6945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
695558790d6acca3451cf3a6b497803a5f07d0bec58Ben Murdoch  mutable scoped_refptr<HostContentSettingsMap> host_content_settings_map_;
696558790d6acca3451cf3a6b497803a5f07d0bec58Ben Murdoch
6971320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  mutable scoped_ptr<chrome_browser_net::ResourcePrefetchPredictorObserver>
6981320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci      resource_prefetch_predictor_observer_;
6991320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
7005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  mutable scoped_ptr<ChromeHttpUserAgentSettings>
7015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      chrome_http_user_agent_settings_;
7025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
7032a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#if defined(ENABLE_MANAGED_USERS)
704f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  mutable scoped_refptr<const SupervisedUserURLFilter>
705f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)      supervised_user_url_filter_;
7062a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#endif
7072a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
70846d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  mutable scoped_ptr<DevToolsNetworkController> network_controller_;
70946d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
7105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // TODO(jhawkins): Remove once crbug.com/102004 is fixed.
7115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool initialized_on_UI_thread_;
7125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
713a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  const Profile::ProfileType profile_type_;
7145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
7155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(ProfileIOData);
7165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
7175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
7185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif  // CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_
719