Chromium Code Reviews| 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 825e90814b525e65435f160cdcebf37a96668628..716e1ad1b2dba28cb3487c0cf30d9c47d09b0972 100644 |
| --- a/chrome/browser/web_applications/web_app_mac.mm |
| +++ b/chrome/browser/web_applications/web_app_mac.mm |
| @@ -228,7 +228,6 @@ bool WebAppShortcutCreator::CreateShortcut() { |
| } |
| base::mac::RemoveQuarantineAttribute(app_path); |
| - RevealGeneratedBundleInFinder(app_path); |
| return true; |
| } |
| @@ -371,10 +370,9 @@ NSString* WebAppShortcutCreator::GetBundleIdentifier(NSDictionary* plist) const |
| return bundle_id; |
| } |
| -void WebAppShortcutCreator::RevealGeneratedBundleInFinder( |
| - const base::FilePath& generated_bundle) const { |
| +void WebAppShortcutCreator::RevealAppShimInFinder() const { |
| [[NSWorkspace sharedWorkspace] |
| - selectFile:base::mac::FilePathToNSString(generated_bundle) |
| + selectFile:base::mac::FilePathToNSString(GetShortcutPath()) |
|
benwells
2013/06/13 00:09:07
GetShortcutPath can fail, so this should check it'
jackhou1
2013/06/13 01:47:42
Done.
|
| inFileViewerRootedAtPath:nil]; |
| } |
| @@ -437,27 +435,44 @@ bool CreatePlatformShortcuts( |
| const ShellIntegration::ShortcutInfo& shortcut_info, |
| const ShellIntegration::ShortcutLocations& /*creation_locations*/) { |
| DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); |
| - string16 bundle_id = UTF8ToUTF16(base::mac::BaseBundleID()); |
| - WebAppShortcutCreator shortcut_creator(web_app_path, shortcut_info, |
| - bundle_id); |
| - return shortcut_creator.CreateShortcut(); |
| + WebAppShortcutCreator shortcut_creator( |
| + web_app_path, shortcut_info, UTF8ToUTF16(base::mac::BaseBundleID())); |
| + bool success = shortcut_creator.CreateShortcut(); |
| + if (success) |
| + shortcut_creator.RevealAppShimInFinder(); |
| + |
| + return success; |
| } |
| void DeletePlatformShortcuts( |
| const base::FilePath& web_app_path, |
| - const ShellIntegration::ShortcutInfo& info) { |
| + const ShellIntegration::ShortcutInfo& shortcut_info) { |
| DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); |
| + WebAppShortcutCreator shortcut_creator( |
| + web_app_path, shortcut_info, UTF8ToUTF16(base::mac::BaseBundleID())); |
| + base::FilePath app_path = shortcut_creator.GetShortcutPath(); |
| + if (app_path.empty()) |
| + return; |
| - base::FilePath bundle_path = GetAppBundleByExtensionId(info.extension_id); |
|
benwells
2013/06/13 00:09:07
What is the effect of replacing GetAppBundleByExte
jackhou1
2013/06/13 01:47:42
LSFindApplicationForInfo finds one app bundle that
benwells
2013/06/13 02:19:31
Your alternative sounds pretty good. Any reason no
|
| - file_util::Delete(bundle_path, true); |
| + file_util::Delete(app_path, true); |
| + base::FilePath apps_folder = app_path.DirName(); |
| + if (file_util::IsDirectoryEmpty(apps_folder)) |
| + file_util::Delete(apps_folder, false); |
| } |
| void UpdatePlatformShortcuts( |
| const base::FilePath& web_app_path, |
| const string16& old_app_title, |
| const ShellIntegration::ShortcutInfo& shortcut_info) { |
| - // TODO(benwells): Implement this when shortcuts / weblings are enabled on |
| - // mac. |
| + DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); |
|
benwells
2013/06/13 00:09:07
Make sure you handle the shim created in the web_a
jackhou1
2013/06/13 01:47:42
I'll merge the two CLs since they touch the same f
|
| + WebAppShortcutCreator shortcut_creator( |
| + web_app_path, shortcut_info, UTF8ToUTF16(base::mac::BaseBundleID())); |
| + base::FilePath app_path = shortcut_creator.GetShortcutPath(); |
| + if (app_path.empty()) |
| + return; |
| + |
| + file_util::Delete(app_path, true); |
| + shortcut_creator.CreateShortcut(); |
| } |
| } // namespace internals |