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

Unified Diff: chrome/browser/profiles/profile_io_data.cc

Issue 10836305: Ensure that isolated apps use the right cookies for media requests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix review comments Created 8 years, 4 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/profiles/profile_io_data.cc
diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc
index bc4590c675e1a4fd063c2fdc96308289380b8112..3b59bce89899b363a1d4f5bc26e6d14d5d6d98a2 100644
--- a/chrome/browser/profiles/profile_io_data.cc
+++ b/chrome/browser/profiles/profile_io_data.cc
@@ -225,6 +225,20 @@ void ProfileIOData::InitializeOnUIThread(Profile* profile) {
BrowserContext::EnsureResourceContextInitialized(profile);
}
+ProfileIOData::MediaRequestContext::MediaRequestContext(
+ chrome_browser_net::CacheStats* cache_stats)
+ : ChromeURLRequestContext(ChromeURLRequestContext::CONTEXT_TYPE_MEDIA,
+ cache_stats) {
+}
+
+void ProfileIOData::MediaRequestContext::SetHttpTransactionFactory(
+ net::HttpTransactionFactory* http_factory) {
+ http_factory_.reset(http_factory);
+ set_http_transaction_factory(http_factory);
+}
+
+ProfileIOData::MediaRequestContext::~MediaRequestContext() {}
+
ProfileIOData::AppRequestContext::AppRequestContext(
chrome_browser_net::CacheStats* cache_stats)
: ChromeURLRequestContext(ChromeURLRequestContext::CONTEXT_TYPE_APP,
@@ -272,11 +286,17 @@ ProfileIOData::~ProfileIOData() {
main_request_context_->AssertNoURLRequests();
if (extensions_request_context_.get())
extensions_request_context_->AssertNoURLRequests();
- for (AppRequestContextMap::iterator it = app_request_context_map_.begin();
+ for (URLRequestContextMap::iterator it = app_request_context_map_.begin();
it != app_request_context_map_.end(); ++it) {
it->second->AssertNoURLRequests();
delete it->second;
}
+ for (URLRequestContextMap::iterator it =
+ isolated_media_request_context_map_.begin();
+ it != isolated_media_request_context_map_.end(); ++it) {
+ it->second->AssertNoURLRequests();
+ delete it->second;
+ }
}
// static
@@ -363,6 +383,26 @@ ProfileIOData::GetIsolatedAppRequestContext(
return context;
}
+ChromeURLRequestContext*
+ProfileIOData::GetIsolatedMediaRequestContext(
+ ChromeURLRequestContext* main_context,
+ const std::string& app_id) const {
+ LazyInitialize();
+ ChromeURLRequestContext* context;
awong 2012/08/20 19:46:28 OCD-ness...can we add an = NULL here to make sure
Charlie Reis 2012/08/20 20:21:01 No problem. Done, here and above.
+ if (ContainsKey(isolated_media_request_context_map_, app_id)) {
+ context = isolated_media_request_context_map_[app_id];
+ } else {
+ // Get the app context as the starting point for the media context,
+ // so that it uses the app's cookie store.
+ ChromeURLRequestContext* app_context = GetIsolatedAppRequestContext(
+ main_context, app_id);
+ context = AcquireIsolatedMediaRequestContext(app_context, app_id);
+ isolated_media_request_context_map_[app_id] = context;
+ }
+ DCHECK(context);
+ return context;
+}
+
ExtensionInfoMap* ProfileIOData::GetExtensionInfoMap() const {
DCHECK(extension_info_map_) << "ExtensionSystem not initialized";
return extension_info_map_;

Powered by Google App Engine
This is Rietveld 408576698