Index: chrome/browser/profiles/profile_impl.cc |
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc |
index 3c05a6ab491da611587bf1e3756ca233de67b896..c3c0677a4ecb49a31fdcbc2c3b0bb3a440385b06 100644 |
--- a/chrome/browser/profiles/profile_impl.cc |
+++ b/chrome/browser/profiles/profile_impl.cc |
@@ -815,6 +815,17 @@ URLRequestContextGetter* ProfileImpl::GetRequestContext() { |
return request_context; |
} |
+URLRequestContextGetter* ProfileImpl::GetRequestContextForPossibleApp( |
+ const Extension* app) { |
+ if (CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kEnableExperimentalAppManifests) && |
+ app != NULL && |
+ app->is_storage_isolated()) |
+ return GetRequestContextForIsolatedApp(app); |
+ |
+ return GetRequestContext(); |
+} |
+ |
URLRequestContextGetter* ProfileImpl::GetRequestContextForMedia() { |
return io_data_.GetMediaRequestContextGetter(); |
} |
@@ -832,6 +843,35 @@ URLRequestContextGetter* ProfileImpl::GetRequestContextForExtensions() { |
return io_data_.GetExtensionsRequestContextGetter(); |
} |
+URLRequestContextGetter* ProfileImpl::GetRequestContextForIsolatedApp( |
+ const Extension* installed_app) { |
+ // Create a request context specific to this app on demand. |
+ FilePath app_path = GetPath().Append(chrome::kIsolatedAppStateDirname); |
+ app_path = app_path.AppendASCII(installed_app->id()); |
+ FilePath cookie_path = app_path.Append(chrome::kCookieFilename); |
+ FilePath cache_path = app_path.Append(chrome::kCacheDirname); |
+ |
+ // Create the paths if they don't yet exist. |
+ BrowserThread::PostTask( |
+ BrowserThread::FILE, FROM_HERE, |
+ NewRunnableFunction(&ProfileImpl::CreateIsolatedAppPaths, |
+ app_path, |
+ cache_path)); |
+ |
+ // Initialize the app context IO data on demand. |
+ // TODO(creis): Determine the correct cache path and size. |
+ io_data_.InitIsolatedApp(installed_app, cookie_path, cache_path, 0); |
+ |
+ return io_data_.GetIsolatedAppRequestContextGetter(installed_app); |
+} |
+ |
+void ProfileImpl::CreateIsolatedAppPaths(const FilePath& app_path, |
+ const FilePath& cache_path) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
+ file_util::CreateDirectory(app_path); |
+ file_util::CreateDirectory(cache_path); |
+} |
+ |
void ProfileImpl::RegisterExtensionWithRequestContexts( |
const Extension* extension) { |
// AddRef to ensure the data lives until the other thread gets it. Balanced in |