diff options
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 = |