| Index: chrome/browser/web_applications/web_app_mac.mm
|
| diff --git a/chrome/browser/web_applications/web_app_mac.mm b/chrome/browser/web_applications/web_app_mac.mm
|
| index 52ef072abeee2c60678ad702b3faf2f0f7df1758..dac3d96edcb45700dc4f0c359ca18c3aea79583f 100644
|
| --- a/chrome/browser/web_applications/web_app_mac.mm
|
| +++ b/chrome/browser/web_applications/web_app_mac.mm
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "chrome/browser/web_applications/web_app_mac.h"
|
| +#import "chrome/browser/web_applications/web_app_mac.h"
|
|
|
| #import <Cocoa/Cocoa.h>
|
|
|
| @@ -11,7 +11,9 @@
|
| #include "base/mac/foundation_util.h"
|
| #include "base/scoped_temp_dir.h"
|
| #include "base/sys_string_conversions.h"
|
| +#include "base/utf_string_conversions.h"
|
| #include "chrome/browser/web_applications/web_app.h"
|
| +#include "chrome/common/chrome_paths_internal.h"
|
| #include "chrome/common/mac/app_mode_common.h"
|
| #include "content/public/browser/browser_thread.h"
|
| #include "grit/chromium_strings.h"
|
| @@ -20,8 +22,10 @@
|
| namespace web_app {
|
|
|
| WebAppShortcutCreator::WebAppShortcutCreator(
|
| - const ShellIntegration::ShortcutInfo& shortcut_info)
|
| - : info_(shortcut_info) {
|
| + const ShellIntegration::ShortcutInfo& shortcut_info,
|
| + const string16& chrome_bundle_id)
|
| + : info_(shortcut_info),
|
| + chrome_bundle_id_(chrome_bundle_id) {
|
| }
|
|
|
| WebAppShortcutCreator::~WebAppShortcutCreator() {
|
| @@ -62,10 +66,8 @@ bool WebAppShortcutCreator::CreateShortcut() {
|
| }
|
|
|
| FilePath WebAppShortcutCreator::GetAppLoaderPath() const {
|
| - NSString* app_loader = [l10n_util::GetNSString(IDS_PRODUCT_NAME)
|
| - stringByAppendingString:@" App Mode Loader.app"];
|
| return base::mac::PathForFrameworkBundleResource(
|
| - base::mac::NSToCFCast(app_loader));
|
| + base::mac::NSToCFCast(@"app_mode_loader.app"));
|
| }
|
|
|
| FilePath WebAppShortcutCreator::GetDestinationPath(
|
| @@ -88,12 +90,16 @@ bool WebAppShortcutCreator::UpdatePlist(const FilePath& app_path) const {
|
| NSMutableDictionary* dict =
|
| [NSMutableDictionary dictionaryWithContentsOfFile:plist_path];
|
|
|
| + [dict setObject:GetBundleIdentifier(dict)
|
| + forKey:base::mac::CFToNSCast(kCFBundleIdentifierKey)];
|
| [dict setObject:base::SysUTF8ToNSString(info_.extension_id)
|
| forKey:app_mode::kCrAppModeShortcutIDKey];
|
| [dict setObject:base::SysUTF16ToNSString(info_.title)
|
| forKey:app_mode::kCrAppModeShortcutNameKey];
|
| [dict setObject:base::SysUTF8ToNSString(info_.url.spec())
|
| forKey:app_mode::kCrAppModeShortcutURLKey];
|
| + [dict setObject:base::SysUTF16ToNSString(chrome_bundle_id_)
|
| + forKey:app_mode::kBrowserBundleIDKey];
|
| return [dict writeToFile:plist_path atomically:YES];
|
| }
|
|
|
| @@ -102,6 +108,19 @@ bool WebAppShortcutCreator::UpdateIcon(const FilePath& app_path) const {
|
| return true;
|
| }
|
|
|
| +NSString* WebAppShortcutCreator::GetBundleIdentifier(NSDictionary* plist) const
|
| +{
|
| + NSString* bundle_id_template =
|
| + base::mac::ObjCCast<NSString>(
|
| + [plist objectForKey:base::mac::CFToNSCast(kCFBundleIdentifierKey)]);
|
| + NSString* extension_id = base::SysUTF8ToNSString(info_.extension_id);
|
| + NSString* bundle_id =
|
| + [bundle_id_template
|
| + stringByReplacingOccurrencesOfString:app_mode::kShortcutIdPlaceholder
|
| + withString:extension_id];
|
| + return bundle_id;
|
| +}
|
| +
|
| } // namespace
|
|
|
| namespace web_app {
|
| @@ -111,7 +130,8 @@ void CreateShortcutTask(const FilePath& web_app_path,
|
| const FilePath& profile_path,
|
| const ShellIntegration::ShortcutInfo& shortcut_info) {
|
| DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE));
|
| - WebAppShortcutCreator shortcut_creator(shortcut_info);
|
| + string16 bundle_id = UTF8ToUTF16(base::mac::BaseBundleID());
|
| + WebAppShortcutCreator shortcut_creator(shortcut_info, bundle_id);
|
| shortcut_creator.CreateShortcut();
|
| }
|
|
|
|
|