| Index: chrome/browser/extensions/crx_installer.cc
|
| diff --git a/chrome/browser/extensions/crx_installer.cc b/chrome/browser/extensions/crx_installer.cc
|
| index 41b97602f92bb4dbb76244c9b3d403e3f3cda27a..1eff5de5e5eecb783d777cd46c5a3948c122d40a 100644
|
| --- a/chrome/browser/extensions/crx_installer.cc
|
| +++ b/chrome/browser/extensions/crx_installer.cc
|
| @@ -27,8 +27,10 @@
|
| #include "chrome/browser/extensions/extension_error_reporter.h"
|
| #include "chrome/browser/extensions/extension_service.h"
|
| #include "chrome/browser/extensions/permissions_updater.h"
|
| +#include "chrome/browser/profiles/profile.h"
|
| #include "chrome/browser/shell_integration.h"
|
| #include "chrome/browser/web_applications/web_app.h"
|
| +#include "chrome/common/chrome_constants.h"
|
| #include "chrome/common/chrome_notification_types.h"
|
| #include "chrome/common/chrome_paths.h"
|
| #include "chrome/common/extensions/extension_constants.h"
|
| @@ -138,6 +140,7 @@ CrxInstaller::CrxInstaller(base::WeakPtr<ExtensionService> frontend_weak,
|
| create_app_shortcut_(false),
|
| frontend_weak_(frontend_weak),
|
| profile_(frontend_weak->profile()),
|
| + profile_path_(profile_->GetPath()),
|
| client_(client),
|
| apps_require_extension_mime_type_(false),
|
| allow_silent_install_(false),
|
| @@ -488,11 +491,15 @@ void CrxInstaller::CompleteInstall() {
|
| "Extensions.CrxInstallDirPathLength",
|
| install_directory_.value().length(), 0, 500, 100);
|
|
|
| + bool separate_data_dir_required = extension_->is_platform_app() &&
|
| + ExtensionService::PlatformAppRequiresSeparateDataDirectory();
|
| +
|
| FilePath version_dir = extension_file_util::InstallExtension(
|
| unpacked_extension_root_,
|
| extension_->id(),
|
| extension_->VersionString(),
|
| - install_directory_);
|
| + install_directory_,
|
| + !separate_data_dir_required);
|
| if (version_dir.empty()) {
|
| ReportFailureFromFileThread(
|
| l10n_util::GetStringUTF16(
|
| @@ -500,6 +507,22 @@ void CrxInstaller::CompleteInstall() {
|
| return;
|
| }
|
|
|
| + // If the platform app requires its own data directory then we'll need to
|
| + // copy the extension into that data directory too.
|
| + if (separate_data_dir_required) {
|
| + FilePath data_dir = web_app::GetWebAppDataDirectory(
|
| + profile_path_, extension_->id(), GURL(extension_->launch_web_url()));
|
| + FilePath profile_path = data_dir.AppendASCII(chrome::kInitialProfile);
|
| + FilePath extension_path =
|
| + profile_path.AppendASCII(ExtensionService::kInstallDirectoryName);
|
| + extension_file_util::InstallExtension(
|
| + unpacked_extension_root_,
|
| + extension_->id(),
|
| + extension_->VersionString(),
|
| + extension_path,
|
| + true);
|
| + }
|
| +
|
| // This is lame, but we must reload the extension because absolute paths
|
| // inside the content scripts are established inside InitFromValue() and we
|
| // just moved the extension.
|
|
|