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

Unified Diff: chrome/common/mac/app_mode_chrome_locator.mm

Issue 265163006: [Mac] Rebuild app shims when they fail to dyload Chrome Framework. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile on android Created 6 years, 6 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
« no previous file with comments | « chrome/common/mac/app_mode_chrome_locator.h ('k') | chrome/common/mac/app_mode_chrome_locator_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/mac/app_mode_chrome_locator.mm
diff --git a/chrome/common/mac/app_mode_chrome_locator.mm b/chrome/common/mac/app_mode_chrome_locator.mm
index ac62380cf2fce635039fb9b463e0024a94e2c369..3cd5302cc46cf9b1b8679c84026230719484aa94 100644
--- a/chrome/common/mac/app_mode_chrome_locator.mm
+++ b/chrome/common/mac/app_mode_chrome_locator.mm
@@ -25,6 +25,7 @@ bool FindBundleById(NSString* bundle_id, base::FilePath* out_bundle) {
}
bool GetChromeBundleInfo(const base::FilePath& chrome_bundle,
+ base::FilePath* executable_path,
base::string16* raw_version_str,
base::FilePath* version_path,
base::FilePath* framework_shlib_path) {
@@ -57,19 +58,25 @@ bool GetChromeBundleInfo(const base::FilePath& chrome_bundle,
NSString* cr_bundle_exe =
ObjCCast<NSString>(
[cr_bundle objectForInfoDictionaryKey:@"CFBundleExecutable"]);
+ // Essentially we want chrome::kFrameworkName which looks like
+ // "$PRODUCT_STRING Framework.framework". The library itself is at
+ // "$PRODUCT_STRING Framework.framework/$PRODUCT_STRING Framework". Note that
+ // $PRODUCT_STRING is not |cr_bundle_exe| because in Canary the framework is
+ // still called "Google Chrome Framework".
+ // However, we want the shims to be agnostic to distribution and operate based
+ // on the data in their plist, so encode the framework names here.
+ NSDictionary* framework_for_exe = @{
+ @"Chromium": @"Chromium",
+ @"Google Chrome": @"Google Chrome",
+ @"Google Chrome Canary": @"Google Chrome",
+ };
+ NSString* framework_name = [framework_for_exe objectForKey:cr_bundle_exe];
NSString* cr_framework_shlib_path =
[cr_versioned_path stringByAppendingPathComponent:
- base::SysUTF8ToNSString(chrome::kFrameworkName)];
- // chrome::kFrameworkName looks like "$PRODUCT_STRING Framework.framework".
- // The library itself is at
- // "$PRODUCT_STRING Framework.framework/$PRODUCT_STRING Framework", so we cut
- // off the .framework extension here and append it to the path.
- // It's important to build the path to the framework this way because
- // in Canary the framework is still called "Google Chrome Framework".
+ [framework_name stringByAppendingString:@" Framework.framework"]];
cr_framework_shlib_path =
[cr_framework_shlib_path stringByAppendingPathComponent:
- [base::SysUTF8ToNSString(chrome::kFrameworkName)
- stringByDeletingPathExtension]];
+ [framework_name stringByAppendingString:@" Framework"]];
if (!cr_bundle_exe || !cr_framework_shlib_path)
return false;
@@ -82,6 +89,7 @@ bool GetChromeBundleInfo(const base::FilePath& chrome_bundle,
return false;
// Everything OK, copy output parameters.
+ *executable_path = base::mac::NSStringToFilePath([cr_bundle executablePath]);
*raw_version_str = base::SysNSStringToUTF16(cr_version);
*version_path = base::mac::NSStringToFilePath(cr_versioned_path);
*framework_shlib_path =
« no previous file with comments | « chrome/common/mac/app_mode_chrome_locator.h ('k') | chrome/common/mac/app_mode_chrome_locator_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698