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

Unified Diff: chrome/browser/net/chrome_url_request_context.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: Initial version 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/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 ee067c84dcb628a18b5695919a1870aede476fc9..680f0cd128892a710237b9bc0a6e3027fbfbb8eb 100644
--- a/chrome/browser/net/chrome_url_request_context.cc
+++ b/chrome/browser/net/chrome_url_request_context.cc
@@ -94,6 +94,33 @@ class FactoryForIsolatedApp : public ChromeURLRequestContextFactory {
main_request_context_getter_;
};
+// Factory that creates the media ChromeURLRequestContext for a given isolated
+// app. The media context is based on the corresponding isolated app's context.
+// Takes the |main_context| so that it can create the isolated app's context
+// if necessary.
+class FactoryForIsolatedMedia : public ChromeURLRequestContextFactory {
+ public:
+ FactoryForIsolatedMedia(const ProfileIOData* profile_io_data,
+ const std::string& app_id,
+ ChromeURLRequestContextGetter* main_context)
+ : profile_io_data_(profile_io_data),
+ app_id_(app_id),
+ main_request_context_getter_(main_context) {}
+
+ virtual ChromeURLRequestContext* Create() OVERRIDE {
+ // We will copy most of the state from the corresopnding app's
+ // request context, which we obtain using the main context.
+ return profile_io_data_->GetIsolatedMediaRequestContext(
+ main_request_context_getter_->GetIOContext(), app_id_);
+ }
+
+ private:
+ const ProfileIOData* const profile_io_data_;
+ const std::string app_id_;
+ scoped_refptr<ChromeURLRequestContextGetter>
+ main_request_context_getter_;
+};
+
// Factory that creates the ChromeURLRequestContext for media.
class FactoryForMedia : public ChromeURLRequestContextFactory {
public:
@@ -198,6 +225,20 @@ ChromeURLRequestContextGetter::CreateOriginalForIsolatedApp(
// static
ChromeURLRequestContextGetter*
+ChromeURLRequestContextGetter::CreateOriginalForIsolatedMedia(
+ Profile* profile,
+ const ProfileIOData* profile_io_data,
+ const std::string& app_id) {
+ DCHECK(!profile->IsOffTheRecord());
+ ChromeURLRequestContextGetter* main_context =
+ static_cast<ChromeURLRequestContextGetter*>(profile->GetRequestContext());
+ return new ChromeURLRequestContextGetter(
+ profile,
+ new FactoryForIsolatedMedia(profile_io_data, app_id, main_context));
+}
+
+// static
+ChromeURLRequestContextGetter*
ChromeURLRequestContextGetter::CreateOffTheRecord(
Profile* profile, const ProfileIOData* profile_io_data) {
DCHECK(profile->IsOffTheRecord());

Powered by Google App Engine
This is Rietveld 408576698