Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1899)

Unified Diff: apps/app_shim/app_shim_host_manager_mac.mm

Issue 501303002: [Mac] Make app shims load the same framework version as the running Chrome process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make ChromeLocatorTest a browser test. Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..97664424be0405249612ef9543fba62cc8880ee1 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,19 @@ 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::kRunningChromeVersionSymlinkName);
+ }
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 +129,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::kRunningChromeVersionSymlinkName);
+ 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));

Powered by Google App Engine
This is Rietveld 408576698