Chromium Code Reviews| 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 |
|
willchan no longer on Chromium
2012/08/20 23:04:51
Do you think we should rename this to isolated_mai
Charlie Reis
2012/08/20 23:49:44
No, I actually mean the main context for the profi
|
| +// 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()); |