summaryrefslogtreecommitdiffstats
path: root/chrome/browser/net/chrome_url_request_context.h
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-11 03:39:54 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-11 03:39:54 +0000
commitf40061ba0477aff1326f71d663748d6359c48a19 (patch)
tree7883c33c34d6bfd7edefccdf36d14b242c9a48b9 /chrome/browser/net/chrome_url_request_context.h
parentfdbc2271fbdd751361dbb1980793bb074d482242 (diff)
downloadchromium_src-f40061ba0477aff1326f71d663748d6359c48a19.zip
chromium_src-f40061ba0477aff1326f71d663748d6359c48a19.tar.gz
chromium_src-f40061ba0477aff1326f71d663748d6359c48a19.tar.bz2
Introduce OffTheRecordProfileIOData and ProfileImplIOData.
They both inherit from ProfileIOData. The former is for the off the record (incognito) profile. The latter is for the normal ProfileImpl profile. All of the IO related Profile objects are now initialized at the same time, in the subtype implementations of ProfileIOData::LazyInitializeInternal(). I also took this opportunity to clean URLRequestContext up so it is a class and keeps its member variables private. This required touching a fair number of files. TODO: Remove lots of the refcounting of member variables, since they can now be owned by ProfileIOData. BUG=67237 TEST=none Review URL: http://codereview.chromium.org/6286133 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74561 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net/chrome_url_request_context.h')
-rw-r--r--chrome/browser/net/chrome_url_request_context.h118
1 files changed, 14 insertions, 104 deletions
diff --git a/chrome/browser/net/chrome_url_request_context.h b/chrome/browser/net/chrome_url_request_context.h
index 943b0fd..9e0fa52 100644
--- a/chrome/browser/net/chrome_url_request_context.h
+++ b/chrome/browser/net/chrome_url_request_context.h
@@ -17,32 +17,27 @@
#include "chrome/browser/extensions/extension_io_event_router.h"
#include "chrome/browser/extensions/extension_webrequest_api.h"
#include "chrome/browser/host_zoom_map.h"
-#include "chrome/browser/io_thread.h"
-#include "chrome/browser/net/chrome_cookie_policy.h"
#include "chrome/browser/prefs/pref_change_registrar.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/prerender/prerender_manager.h"
#include "chrome/common/extensions/extension_icon_set.h"
#include "chrome/common/net/url_request_context_getter.h"
-#include "net/base/cookie_monster.h"
#include "net/base/cookie_policy.h"
#include "net/url_request/url_request_context.h"
#include "webkit/database/database_tracker.h"
#include "webkit/fileapi/sandboxed_file_system_context.h"
-class CommandLine;
-class PrefService;
-class Profile;
-class ProfileIOData;
-
+class ChromeCookiePolicy;
+class ChromeURLDataManagerBackend;
+class ChromeURLRequestContextFactory;
+class IOThread;
namespace net {
class DnsCertProvenanceChecker;
class NetworkDelegate;
}
-
-class ChromeURLDataManagerBackend;
-class ChromeURLRequestContext;
-class ChromeURLRequestContextFactory;
+class PrefService;
+class Profile;
+class ProfileIOData;
// Subclass of net::URLRequestContext which can be used to store extra
// information for requests.
@@ -105,38 +100,9 @@ class ChromeURLRequestContext : public net::URLRequestContext {
ChromeURLDataManagerBackend* GetChromeURLDataManagerBackend();
- protected:
- virtual ~ChromeURLRequestContext();
-
- public:
// Setters to simplify initializing from factory objects.
+ void set_chrome_cookie_policy(ChromeCookiePolicy* cookie_policy);
- void set_accept_language(const std::string& accept_language) {
- accept_language_ = accept_language;
- }
- void set_accept_charset(const std::string& accept_charset) {
- accept_charset_ = accept_charset;
- }
- void set_referrer_charset(const std::string& referrer_charset) {
- referrer_charset_ = referrer_charset;
- }
- void set_transport_security_state(
- net::TransportSecurityState* state) {
- transport_security_state_ = state;
- }
- void set_ssl_config_service(net::SSLConfigService* service) {
- ssl_config_service_ = service;
- }
- void set_dns_cert_checker(net::DnsCertProvenanceChecker* ctx) {
- dns_cert_checker_.reset(ctx);
- }
- void set_ftp_transaction_factory(net::FtpTransactionFactory* factory) {
- ftp_transaction_factory_ = factory;
- }
- void set_cookie_policy(ChromeCookiePolicy* cookie_policy) {
- chrome_cookie_policy_ = cookie_policy; // Take a strong reference.
- cookie_policy_ = cookie_policy;
- }
void set_user_script_dir_path(const FilePath& path) {
user_script_dir_path_ = path;
}
@@ -179,6 +145,9 @@ class ChromeURLRequestContext : public net::URLRequestContext {
void OnDefaultCharsetChange(const std::string& default_charset);
protected:
+ virtual ~ChromeURLRequestContext();
+
+ private:
// Path to the directory user scripts are stored in.
FilePath user_script_dir_path_;
@@ -198,7 +167,6 @@ class ChromeURLRequestContext : public net::URLRequestContext {
bool is_off_the_record_;
- private:
DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContext);
};
@@ -256,12 +224,13 @@ class ChromeURLRequestContextGetter : public URLRequestContextGetter,
// Create an instance for use with an OTR profile. This is expected to get
// called on the UI thread.
- static ChromeURLRequestContextGetter* CreateOffTheRecord(Profile* profile);
+ static ChromeURLRequestContextGetter* CreateOffTheRecord(
+ Profile* profile, const ProfileIOData* profile_io_data);
// Create an instance for an OTR profile for extensions. This is expected
// to get called on UI thread.
static ChromeURLRequestContextGetter* CreateOffTheRecordForExtensions(
- Profile* profile);
+ Profile* profile, const ProfileIOData* profile_io_data);
// Clean up UI thread resources. This is expected to get called on the UI
// thread before the instance is deleted on the IO thread.
@@ -308,63 +277,4 @@ class ChromeURLRequestContextGetter : public URLRequestContextGetter,
DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContextGetter);
};
-// Base class for a ChromeURLRequestContext factory. This includes
-// the shared functionality like extracting the default language/charset
-// from a profile.
-//
-// Except for the constructor, all methods of this class must be called from
-// the IO thread.
-class ChromeURLRequestContextFactory {
- public:
- // Extract properties of interested from |profile|, for setting later into
- // a ChromeURLRequestContext using ApplyProfileParametersToContext().
- explicit ChromeURLRequestContextFactory(Profile* profile);
-
- virtual ~ChromeURLRequestContextFactory();
-
- // Called to create a new instance (will only be called once).
- virtual scoped_refptr<ChromeURLRequestContext> Create() = 0;
-
- protected:
- IOThread* io_thread() { return io_thread_; }
-
- // Assigns this factory's properties to |context|.
- void ApplyProfileParametersToContext(ChromeURLRequestContext* context);
-
- // Values extracted from the Profile.
- //
- // NOTE: If you add any parameters here, keep it in sync with
- // ApplyProfileParametersToContext().
- bool is_media_;
- bool is_off_the_record_;
- bool clear_local_state_on_exit_;
- std::string accept_language_;
- std::string accept_charset_;
- std::string referrer_charset_;
-
- // TODO(aa): I think this can go away now as we no longer support standalone
- // user scripts.
- // TODO(willchan): Make these non-refcounted.
- FilePath user_script_dir_path_;
- scoped_refptr<HostContentSettingsMap> host_content_settings_map_;
- scoped_refptr<ChromeAppCacheService> appcache_service_;
- scoped_refptr<webkit_database::DatabaseTracker> database_tracker_;
- scoped_refptr<HostZoomMap> host_zoom_map_;
- scoped_refptr<net::TransportSecurityState> transport_security_state_;
- scoped_refptr<net::SSLConfigService> ssl_config_service_;
- scoped_refptr<net::CookieMonster::Delegate> cookie_monster_delegate_;
- scoped_refptr<ChromeBlobStorageContext> blob_storage_context_;
- scoped_refptr<fileapi::SandboxedFileSystemContext> file_system_context_;
- scoped_refptr<ExtensionInfoMap> extension_info_map_;
- scoped_refptr<ExtensionIOEventRouter> extension_io_event_router_;
- scoped_refptr<PrerenderManager> prerender_manager_;
-
- FilePath profile_dir_path_;
-
- private:
- IOThread* const io_thread_;
-
- DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContextFactory);
-};
-
#endif // CHROME_BROWSER_NET_CHROME_URL_REQUEST_CONTEXT_H_