| Index: apps/app_shim/app_shim_host_manager_mac.mm
|
| diff --git a/apps/app_shim/app_shim_host_manager_mac.mm b/apps/app_shim/app_shim_host_manager_mac.mm
|
| index 799d32d0e979a69cb1051555791ba8da515c42f6..f4f8bfe3b1a81741117fda190f21975e56b5d270 100644
|
| --- a/apps/app_shim/app_shim_host_manager_mac.mm
|
| +++ b/apps/app_shim/app_shim_host_manager_mac.mm
|
| @@ -20,6 +20,7 @@
|
| #include "chrome/browser/browser_process.h"
|
| #include "chrome/common/chrome_paths.h"
|
| #include "chrome/common/chrome_switches.h"
|
| +#include "chrome/common/chrome_version_info.h"
|
| #include "chrome/common/mac/app_mode_common.h"
|
|
|
| using content::BrowserThread;
|
| @@ -41,11 +42,15 @@ base::FilePath GetDirectoryInTmpTemplate(const base::FilePath& user_data_dir) {
|
| }
|
|
|
| void DeleteSocketFiles(const base::FilePath& directory_in_tmp,
|
| - const base::FilePath& symlink_path) {
|
| - if (!directory_in_tmp.empty())
|
| - base::DeleteFile(directory_in_tmp, true);
|
| + const base::FilePath& symlink_path,
|
| + const base::FilePath& version_path) {
|
| + // Delete in reverse order of creation.
|
| + if (!version_path.empty())
|
| + base::DeleteFile(version_path, false);
|
| if (!symlink_path.empty())
|
| base::DeleteFile(symlink_path, false);
|
| + if (!directory_in_tmp.empty())
|
| + base::DeleteFile(directory_in_tmp, true);
|
| }
|
|
|
| } // namespace
|
| @@ -69,13 +74,18 @@ AppShimHostManager::~AppShimHostManager() {
|
| return;
|
|
|
| apps::AppShimHandler::SetDefaultHandler(NULL);
|
| + base::FilePath user_data_dir;
|
| base::FilePath symlink_path;
|
| - if (PathService::Get(chrome::DIR_USER_DATA, &symlink_path))
|
| - symlink_path = symlink_path.Append(app_mode::kAppShimSocketSymlinkName);
|
| + base::FilePath version_path;
|
| + if (PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) {
|
| + symlink_path = user_data_dir.Append(app_mode::kAppShimSocketSymlinkName);
|
| + version_path = user_data_dir.Append(app_mode::kAppShimVersionSymlinkName);
|
| + }
|
| BrowserThread::PostTask(
|
| BrowserThread::FILE,
|
| FROM_HERE,
|
| - base::Bind(&DeleteSocketFiles, directory_in_tmp_, symlink_path));
|
| + base::Bind(
|
| + &DeleteSocketFiles, directory_in_tmp_, symlink_path, version_path));
|
| }
|
|
|
| void AppShimHostManager::InitOnFileThread() {
|
| @@ -118,6 +128,15 @@ void AppShimHostManager::InitOnFileThread() {
|
| base::DeleteFile(symlink_path, false);
|
| base::CreateSymbolicLink(socket_path, symlink_path);
|
|
|
| + // Create a symlink containing the current version string. This allows the
|
| + // shim to load the same framework version as the currently running Chrome
|
| + // process.
|
| + base::FilePath version_path =
|
| + user_data_dir.Append(app_mode::kAppShimVersionSymlinkName);
|
| + base::DeleteFile(version_path, false);
|
| + base::CreateSymbolicLink(base::FilePath(chrome::VersionInfo().Version()),
|
| + version_path);
|
| +
|
| BrowserThread::PostTask(
|
| BrowserThread::IO, FROM_HERE,
|
| base::Bind(&AppShimHostManager::ListenOnIOThread, this));
|
|
|