Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1693)

Unified Diff: chrome/browser/net/chrome_url_request_context.cc

Issue 115204: Add a separate cookie store that's used for extensions.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/net/chrome_url_request_context.cc
===================================================================
--- chrome/browser/net/chrome_url_request_context.cc (revision 15945)
+++ chrome/browser/net/chrome_url_request_context.cc (working copy)
@@ -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 @@
}
// 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 @@
}
// 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 =

Powered by Google App Engine
This is Rietveld 408576698