| Index: chrome/app/app_mode_loader_mac.mm
|
| diff --git a/chrome/app/app_mode_loader_mac.mm b/chrome/app/app_mode_loader_mac.mm
|
| index 7a489ebea0ca0b02663cf2e75a989be7a6b9f357..4e47ef9388bdd00fab80fd094bb3421b3be6524b 100644
|
| --- a/chrome/app/app_mode_loader_mac.mm
|
| +++ b/chrome/app/app_mode_loader_mac.mm
|
| @@ -22,6 +22,7 @@
|
| #include "base/mac/scoped_nsautorelease_pool.h"
|
| #include "base/process/launch.h"
|
| #include "base/strings/sys_string_conversions.h"
|
| +#include "chrome/common/chrome_constants.h"
|
| #include "chrome/common/chrome_switches.h"
|
| #import "chrome/common/mac/app_mode_chrome_locator.h"
|
| #include "chrome/common/mac/app_mode_common.h"
|
| @@ -68,14 +69,27 @@ int LoadFrameworkAndStart(app_mode::ChromeAppModeInfo* info) {
|
| }
|
| }
|
|
|
| - // ** 2: Read information from the Chrome bundle.
|
| + // ** 2: Read the running Chrome version.
|
| + // The user_data_dir for shims actually contains the app_data_path.
|
| + // I.e. <user_data_dir>/<profile_dir>/Web Applications/_crx_extensionid/
|
| + base::FilePath user_data_dir =
|
| + info->user_data_dir.DirName().DirName().DirName();
|
| + CHECK(!user_data_dir.empty());
|
| +
|
| + // If this file does not exist, |cr_version_str| will be empty and
|
| + // app_mode::GetChromeBundleInfo will default to the latest version.
|
| + base::FilePath cr_version_str;
|
| + base::ReadSymbolicLink(
|
| + user_data_dir.Append(app_mode::kRunningChromeVersionSymlinkName),
|
| + &cr_version_str);
|
| +
|
| + // ** 3: Read information from the Chrome bundle.
|
| base::FilePath executable_path;
|
| - base::string16 raw_version_str;
|
| base::FilePath version_path;
|
| base::FilePath framework_shlib_path;
|
| if (!app_mode::GetChromeBundleInfo(cr_bundle_path,
|
| + cr_version_str.value(),
|
| &executable_path,
|
| - &raw_version_str,
|
| &version_path,
|
| &framework_shlib_path)) {
|
| LOG(FATAL) << "Couldn't ready Chrome bundle info";
|
| @@ -83,7 +97,7 @@ int LoadFrameworkAndStart(app_mode::ChromeAppModeInfo* info) {
|
| base::FilePath app_mode_bundle_path =
|
| base::mac::NSStringToFilePath([app_bundle bundlePath]);
|
|
|
| - // ** 3: Fill in ChromeAppModeInfo.
|
| + // ** 4: Fill in ChromeAppModeInfo.
|
| info->chrome_outer_bundle_path = cr_bundle_path;
|
| info->chrome_versioned_path = version_path;
|
| info->app_mode_bundle_path = app_mode_bundle_path;
|
| @@ -109,7 +123,7 @@ int LoadFrameworkAndStart(app_mode::ChromeAppModeInfo* info) {
|
| info->profile_dir = base::mac::NSStringToFilePath(
|
| [info_plist objectForKey:app_mode::kCrAppModeProfileDirKey]);
|
|
|
| - // Open the framework.
|
| + // ** 5: Open the framework.
|
| StartFun ChromeAppModeStart = NULL;
|
| void* cr_dylib = dlopen(framework_shlib_path.value().c_str(), RTLD_LAZY);
|
| if (cr_dylib) {
|
|
|