summaryrefslogtreecommitdiffstats
path: root/chrome/browser/net
diff options
context:
space:
mode:
authorrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-25 23:44:20 +0000
committerrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-25 23:44:20 +0000
commit6192f73a9dd17c950ef1ca97db086e8bc4eaf05e (patch)
tree7af372f9670e74b144d17f1f7c009a9eb13a74a2 /chrome/browser/net
parent1ba590018ad58ea18ec3079f089feb64fd951d87 (diff)
downloadchromium_src-6192f73a9dd17c950ef1ca97db086e8bc4eaf05e.zip
chromium_src-6192f73a9dd17c950ef1ca97db086e8bc4eaf05e.tar.gz
chromium_src-6192f73a9dd17c950ef1ca97db086e8bc4eaf05e.tar.bz2
Disk cache: First pass to make it possible to have
multiple instances of BackendImpl. We need multiple objects to be able to support media files on the cache. After this change, histograms will be the only thing that get messed up by multiple disk caches. Review URL: http://codereview.chromium.org/49027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12520 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net')
-rw-r--r--chrome/browser/net/chrome_url_request_context.cc13
-rw-r--r--chrome/browser/net/chrome_url_request_context.h2
2 files changed, 10 insertions, 5 deletions
diff --git a/chrome/browser/net/chrome_url_request_context.cc b/chrome/browser/net/chrome_url_request_context.cc
index 40050b0..81af0d4 100644
--- a/chrome/browser/net/chrome_url_request_context.cc
+++ b/chrome/browser/net/chrome_url_request_context.cc
@@ -108,7 +108,7 @@ ChromeURLRequestContext* ChromeURLRequestContext::CreateOriginal(
ChromeURLRequestContext* ChromeURLRequestContext::CreateOriginalForMedia(
Profile* profile, const FilePath& disk_cache_path) {
DCHECK(!profile->IsOffTheRecord());
- return CreateRequestContextForMedia(profile, disk_cache_path);
+ return CreateRequestContextForMedia(profile, disk_cache_path, false);
}
// static
@@ -137,12 +137,12 @@ ChromeURLRequestContext* ChromeURLRequestContext::CreateOffTheRecordForMedia(
// for media files in OTR mode, we create a request context just like the
// original one.
DCHECK(profile->IsOffTheRecord());
- return CreateRequestContextForMedia(profile, disk_cache_path);
+ return CreateRequestContextForMedia(profile, disk_cache_path, true);
}
// static
ChromeURLRequestContext* ChromeURLRequestContext::CreateRequestContextForMedia(
- Profile* profile, const FilePath& disk_cache_path) {
+ Profile* profile, const FilePath& disk_cache_path, bool off_the_record) {
URLRequestContext* original_context =
profile->GetOriginalProfile()->GetRequestContext();
ChromeURLRequestContext* context = new ChromeURLRequestContext(profile);
@@ -172,8 +172,13 @@ ChromeURLRequestContext* ChromeURLRequestContext::CreateRequestContextForMedia(
cache = new net::HttpCache(original_context->proxy_service(),
disk_cache_path.ToWStringHack(), kint32max);
}
+
// Set the cache type to media.
- cache->set_type(net::HttpCache::MEDIA);
+ if (off_the_record) {
+ cache->set_type(net::TEMP_MEDIA_CACHE);
+ } else {
+ cache->set_type(net::MEDIA_CACHE);
+ }
context->http_transaction_factory_ = cache;
return context;
diff --git a/chrome/browser/net/chrome_url_request_context.h b/chrome/browser/net/chrome_url_request_context.h
index 2215199..7f31ef2 100644
--- a/chrome/browser/net/chrome_url_request_context.h
+++ b/chrome/browser/net/chrome_url_request_context.h
@@ -65,7 +65,7 @@ class ChromeURLRequestContext : public URLRequestContext,
// context. This helper method is called from CreateOriginalForMedia and
// CreateOffTheRecordForMedia.
static ChromeURLRequestContext* CreateRequestContextForMedia(Profile* profile,
- const FilePath& disk_cache_path);
+ const FilePath& disk_cache_path, bool off_the_record);
// NotificationObserver implementation.
virtual void Observe(NotificationType type,