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..bca2965f75dca681e7a3449ff3692cd5cfe8d2f3 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()) |
| inFileViewerRootedAtPath:nil]; |
| } |
| @@ -437,27 +435,37 @@ 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)); |
| - |
| - base::FilePath bundle_path = GetAppBundleByExtensionId(info.extension_id); |
| - file_util::Delete(bundle_path, true); |
| + WebAppShortcutCreator shortcut_creator( |
| + web_app_path, shortcut_info, UTF8ToUTF16(base::mac::BaseBundleID())); |
| + base::FilePath app_path = shortcut_creator.GetShortcutPath(); |
|
tapted
2013/06/12 08:17:52
We should check if this is empty. (say... both App
jackhou1
2013/06/12 08:30:40
Done.
|
| + file_util::Delete(app_path, true); |
| + base::FilePath apps_folder = app_path.BaseName(); |
|
tapted
2013/06/12 08:17:52
... this would become "." ...
jackhou1
2013/06/12 08:30:40
Done.
|
| + if (file_util::IsDirectoryEmpty(apps_folder)) |
| + file_util::Delete(apps_folder, false); |
|
tapted
2013/06/12 08:17:52
... and this could try to delete some random folde
jackhou1
2013/06/12 08:30:40
There's not much we can do if it did not succeed.
|
| } |
| void UpdatePlatformShortcuts( |
| const base::FilePath& web_app_path, |
| - const string16& old_app_title, |
| + const string16& /*old_app_title*/, |
|
tapted
2013/06/12 08:17:52
nit: I like it better without this commented out ;
jackhou1
2013/06/12 08:30:40
Done.
|
| const ShellIntegration::ShortcutInfo& shortcut_info) { |
| - // TODO(benwells): Implement this when shortcuts / weblings are enabled on |
| - // mac. |
| + DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); |
| + WebAppShortcutCreator shortcut_creator( |
| + web_app_path, shortcut_info, UTF8ToUTF16(base::mac::BaseBundleID())); |
| + file_util::Delete(shortcut_creator.GetShortcutPath(), true); |
|
tapted
2013/06/12 08:17:52
Check for empty here too -- passing empty strings
jackhou1
2013/06/12 08:30:40
Done.
|
| + shortcut_creator.CreateShortcut(); |
| } |
| } // namespace internals |