| Index: chrome/browser/profiles/profile.cc
|
| diff --git a/chrome/browser/profiles/profile.cc b/chrome/browser/profiles/profile.cc
|
| index 6705e3b7ae1f0974faea9bb5e678ce3c131e11f0..5c06182d3bff6d3702310ec484e297974aede399 100644
|
| --- a/chrome/browser/profiles/profile.cc
|
| +++ b/chrome/browser/profiles/profile.cc
|
| @@ -31,6 +31,8 @@
|
| #include "chrome/browser/ui/find_bar/find_bar_state.h"
|
| #include "chrome/common/chrome_constants.h"
|
| #include "chrome/common/chrome_paths.h"
|
| +#include "chrome/common/chrome_switches.h"
|
| +#include "chrome/common/extensions/extension.h"
|
| #include "chrome/common/json_pref_store.h"
|
| #include "chrome/common/notification_service.h"
|
| #include "chrome/common/pref_names.h"
|
| @@ -153,6 +155,14 @@ class OffTheRecordProfileImpl : public Profile,
|
| CleanupRequestContext(request_context_);
|
| CleanupRequestContext(extensions_request_context_);
|
|
|
| + // Clean up all isolated app request contexts.
|
| + for (ChromeURLRequestContextGetterMap::iterator iter =
|
| + app_request_context_map_.begin();
|
| + iter != app_request_context_map_.end();
|
| + iter++) {
|
| + CleanupRequestContext(iter->second);
|
| + }
|
| +
|
| // Clean up all DB files/directories
|
| BrowserThread::PostTask(
|
| BrowserThread::FILE, FROM_HERE,
|
| @@ -377,6 +387,16 @@ class OffTheRecordProfileImpl : public Profile,
|
| return request_context_;
|
| }
|
|
|
| + virtual URLRequestContextGetter* GetRequestContext(const Extension* app) {
|
| + if (CommandLine::ForCurrentProcess()->HasSwitch(
|
| + switches::kEnableExperimentalAppManifests)
|
| + && app != NULL
|
| + && app->is_storage_isolated())
|
| + return GetRequestContextForIsolatedApp(app);
|
| +
|
| + return GetRequestContext();
|
| + }
|
| +
|
| virtual URLRequestContextGetter* GetRequestContextForMedia() {
|
| // In OTR mode, media request context is the same as the original one.
|
| return request_context_;
|
| @@ -391,6 +411,26 @@ class OffTheRecordProfileImpl : public Profile,
|
| return extensions_request_context_;
|
| }
|
|
|
| + URLRequestContextGetter* GetRequestContextForIsolatedApp(
|
| + const Extension* installed_app) {
|
| + CHECK(installed_app);
|
| + std::string id = installed_app->id();
|
| +
|
| + // Keep a map of request contexts, one per requested app ID. Once created,
|
| + // the context will exist for the lifetime of the profile.
|
| + ChromeURLRequestContextGetterMap::iterator iter =
|
| + app_request_context_map_.find(id);
|
| + if (iter != app_request_context_map_.end())
|
| + return iter->second;
|
| +
|
| + ChromeURLRequestContextGetter* context =
|
| + ChromeURLRequestContextGetter::CreateOffTheRecordForIsolatedApp(this,
|
| + installed_app);
|
| + app_request_context_map_[id] = context;
|
| +
|
| + return context;
|
| + }
|
| +
|
| virtual net::SSLConfigService* GetSSLConfigService() {
|
| return profile_->GetSSLConfigService();
|
| }
|
| @@ -628,6 +668,12 @@ class OffTheRecordProfileImpl : public Profile,
|
| // The context to use for requests made by an extension while in OTR mode.
|
| scoped_refptr<ChromeURLRequestContextGetter> extensions_request_context_;
|
|
|
| + // A map of request contexts, one per isolated app while in OTR mode.
|
| + typedef base::hash_map<std::string,
|
| + scoped_refptr<ChromeURLRequestContextGetter> >
|
| + ChromeURLRequestContextGetterMap;
|
| + ChromeURLRequestContextGetterMap app_request_context_map_;
|
| +
|
| // The download manager that only stores downloaded items in memory.
|
| scoped_refptr<DownloadManager> download_manager_;
|
|
|
|
|