Chromium Code Reviews| 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..56bd101689281a40750e533724a86fff92992ad8 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, |
| + /*should_delete=*/true); |
|
Aaron Boodman
2012/02/10 20:09:46
In Chrome code, I usually see the format:
true);
Robert Sesek
2012/02/10 20:16:02
We do /*var=*/ a lot: http://code.google.com/codes
sail
2012/02/11 23:15:11
Done.
Switched to enum.
|
| + } |
| + |
| // 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. |