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

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

Issue 42467: Fix an invalid DCHECK for media request context (Closed)
Patch Set: rvargas & aa's comments Created 11 years, 9 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
« no previous file with comments | « chrome/browser/net/chrome_url_request_context.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/chrome_url_request_context.cc
diff --git a/chrome/browser/net/chrome_url_request_context.cc b/chrome/browser/net/chrome_url_request_context.cc
index 528c0e15504be9191fd50ab3a7baed1ff118e8e6..40050b061d70cea190bb8f7be9ff0097aa4d0824 100644
--- a/chrome/browser/net/chrome_url_request_context.cc
+++ b/chrome/browser/net/chrome_url_request_context.cc
@@ -108,6 +108,41 @@ ChromeURLRequestContext* ChromeURLRequestContext::CreateOriginal(
ChromeURLRequestContext* ChromeURLRequestContext::CreateOriginalForMedia(
Profile* profile, const FilePath& disk_cache_path) {
DCHECK(!profile->IsOffTheRecord());
+ return CreateRequestContextForMedia(profile, disk_cache_path);
+}
+
+// static
+ChromeURLRequestContext* ChromeURLRequestContext::CreateOffTheRecord(
+ Profile* profile) {
+ DCHECK(profile->IsOffTheRecord());
+ ChromeURLRequestContext* context = new ChromeURLRequestContext(profile);
+
+ // Share the same proxy service as the original profile. This proxy
+ // service's lifespan is dependent on the lifespan of the original profile,
+ // which we reference (see above).
+ context->proxy_service_ =
+ profile->GetOriginalProfile()->GetRequestContext()->proxy_service();
+
+ context->http_transaction_factory_ =
+ new net::HttpCache(context->proxy_service_, 0);
+ context->cookie_store_ = new net::CookieMonster;
+
+ return context;
+}
+
+// static
+ChromeURLRequestContext* ChromeURLRequestContext::CreateOffTheRecordForMedia(
+ Profile* profile, const FilePath& disk_cache_path) {
+ // TODO(hclam): since we don't have an implementation of disk cache backend
+ // 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);
+}
+
+// static
+ChromeURLRequestContext* ChromeURLRequestContext::CreateRequestContextForMedia(
+ Profile* profile, const FilePath& disk_cache_path) {
URLRequestContext* original_context =
profile->GetOriginalProfile()->GetRequestContext();
ChromeURLRequestContext* context = new ChromeURLRequestContext(profile);
@@ -130,12 +165,12 @@ ChromeURLRequestContext* ChromeURLRequestContext::CreateOriginalForMedia(
net::HttpNetworkLayer* original_network_layer =
static_cast<net::HttpNetworkLayer*>(original_cache->network_layer());
cache = new net::HttpCache(original_network_layer->GetSession(),
- disk_cache_path.ToWStringHack(), kint32max);
+ disk_cache_path.ToWStringHack(), kint32max);
} else {
// If original HttpCache doesn't exist, simply construct one with a whole
// new set of network stack.
cache = new net::HttpCache(original_context->proxy_service(),
- disk_cache_path.ToWStringHack(), kint32max);
+ disk_cache_path.ToWStringHack(), kint32max);
}
// Set the cache type to media.
cache->set_type(net::HttpCache::MEDIA);
@@ -144,34 +179,6 @@ ChromeURLRequestContext* ChromeURLRequestContext::CreateOriginalForMedia(
return context;
}
-// static
-ChromeURLRequestContext* ChromeURLRequestContext::CreateOffTheRecord(
- Profile* profile) {
- DCHECK(profile->IsOffTheRecord());
- ChromeURLRequestContext* context = new ChromeURLRequestContext(profile);
-
- // Share the same proxy service as the original profile. This proxy
- // service's lifespan is dependent on the lifespan of the original profile,
- // which we reference (see above).
- context->proxy_service_ =
- profile->GetOriginalProfile()->GetRequestContext()->proxy_service();
-
- context->http_transaction_factory_ =
- new net::HttpCache(context->proxy_service_, 0);
- context->cookie_store_ = new net::CookieMonster;
-
- return context;
-}
-
-// static
-ChromeURLRequestContext* ChromeURLRequestContext::CreateOffTheRecordForMedia(
- Profile* profile, const FilePath& disk_cache_path) {
- // TODO(hclam): since we don't have an implementation of disk cache backend
- // for media files in OTR mode, we use the original context first. Change this
- // to the proper backend later.
- return CreateOriginalForMedia(profile, disk_cache_path);
-}
-
ChromeURLRequestContext::ChromeURLRequestContext(Profile* profile)
: prefs_(profile->GetPrefs()),
is_off_the_record_(profile->IsOffTheRecord()) {
« no previous file with comments | « chrome/browser/net/chrome_url_request_context.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698