diff options
author | mpcomplete@google.com <mpcomplete@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-14 18:46:21 +0000 |
---|---|---|
committer | mpcomplete@google.com <mpcomplete@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-14 18:46:21 +0000 |
commit | 47accfd64443e175562abc65769457ffef5d3322 (patch) | |
tree | 27d646d32565934449f56cb77982f7283851aca8 /chrome/browser/net/chrome_url_request_context.cc | |
parent | 351e70b561dfbf40350cf7607e6af0403e43e64c (diff) | |
download | chromium_src-47accfd64443e175562abc65769457ffef5d3322.zip chromium_src-47accfd64443e175562abc65769457ffef5d3322.tar.gz chromium_src-47accfd64443e175562abc65769457ffef5d3322.tar.bz2 |
Add a separate cookie store that's used for extensions.
Modify CookieMonster to support overriding the "cookieable schemes".
Review URL: http://codereview.chromium.org/115204
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16083 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net/chrome_url_request_context.cc')
-rw-r--r-- | chrome/browser/net/chrome_url_request_context.cc | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/chrome/browser/net/chrome_url_request_context.cc b/chrome/browser/net/chrome_url_request_context.cc index 85a33c9..1c18ed4 100644 --- a/chrome/browser/net/chrome_url_request_context.cc +++ b/chrome/browser/net/chrome_url_request_context.cc @@ -16,6 +16,7 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/notification_service.h" #include "chrome/common/pref_names.h" +#include "chrome/common/url_constants.h" #include "net/ftp/ftp_network_layer.h" #include "net/http/http_cache.h" #include "net/http/http_network_layer.h" @@ -155,6 +156,26 @@ ChromeURLRequestContext* ChromeURLRequestContext::CreateOriginalForMedia( } // static +ChromeURLRequestContext* ChromeURLRequestContext::CreateOriginalForExtensions( + Profile* profile, const FilePath& cookie_store_path) { + DCHECK(!profile->IsOffTheRecord()); + ChromeURLRequestContext* context = new ChromeURLRequestContext(profile); + + // All we care about for extensions is the cookie store. + DCHECK(!cookie_store_path.empty()); + context->cookie_db_.reset(new SQLitePersistentCookieStore( + cookie_store_path.ToWStringHack(), + g_browser_process->db_thread()->message_loop())); + context->cookie_store_ = new net::CookieMonster(context->cookie_db_.get()); + + // Enable cookies for extension URLs only. + const char* schemes[] = {chrome::kExtensionScheme}; + context->cookie_store_->SetCookieableSchemes(schemes, 1); + + return context; +} + +// static ChromeURLRequestContext* ChromeURLRequestContext::CreateOffTheRecord( Profile* profile) { DCHECK(profile->IsOffTheRecord()); @@ -184,6 +205,20 @@ ChromeURLRequestContext* ChromeURLRequestContext::CreateOffTheRecordForMedia( } // static +ChromeURLRequestContext* +ChromeURLRequestContext::CreateOffTheRecordForExtensions(Profile* profile) { + DCHECK(profile->IsOffTheRecord()); + ChromeURLRequestContext* context = new ChromeURLRequestContext(profile); + context->cookie_store_ = new net::CookieMonster; + + // Enable cookies for extension URLs only. + const char* schemes[] = {chrome::kExtensionScheme}; + context->cookie_store_->SetCookieableSchemes(schemes, 1); + + return context; +} + +// static ChromeURLRequestContext* ChromeURLRequestContext::CreateRequestContextForMedia( Profile* profile, const FilePath& disk_cache_path, bool off_the_record) { URLRequestContext* original_context = |