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 be02bc52af382199effa6cfb1d79ab4e380be2e1..e0780438a3130bec4eb7181b5a361ba799ca3d10 100644 |
--- a/chrome/browser/web_applications/web_app_mac.mm |
+++ b/chrome/browser/web_applications/web_app_mac.mm |
@@ -10,6 +10,7 @@ |
#include "base/files/scoped_temp_dir.h" |
#include "base/mac/bundle_locations.h" |
#include "base/mac/foundation_util.h" |
+#include "base/mac/mac_logging.h" |
#include "base/mac/mac_util.h" |
#include "base/memory/scoped_nsobject.h" |
#include "base/sys_string_conversions.h" |
@@ -255,6 +256,23 @@ namespace web_app { |
namespace internals { |
+FilePath GetAppBundleByExtensionId(std::string extension_id) { |
+ DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); |
+ FSRef ref; |
+ CFURLRef* kDontWantURL = NULL; |
Avi (use Gerrit)
2013/02/05 00:19:25
This isn't a constant so don't name it as such.
|
+ // This matches APP_MODE_APP_BUNDLE_ID in chrome/chrome.gyp. |
+ std::string bundleID = |
+ base::mac::BaseBundleID() + std::string(".app.") + extension_id; |
Avi (use Gerrit)
2013/02/05 00:19:25
This isn't Objective-C code. This (and other varia
jeremya
2013/02/05 02:38:14
Done.
|
+ CFStringRef bundleIDCF = |
+ CFStringCreateWithCString(NULL, bundleID.c_str(), kCFStringEncodingUTF8); |
Avi (use Gerrit)
2013/02/05 00:19:25
SysUTF8ToCFStringRef. Also, don't leak this string
jeremya
2013/02/05 02:38:14
Done.
|
+ OSStatus status = LSFindApplicationForInfo(kLSUnknownCreator, bundleIDCF, |
+ NULL, &ref, kDontWantURL); |
Avi (use Gerrit)
2013/02/05 00:19:25
I don't understand. Why do you pass NULL for the i
jeremya
2013/02/05 02:38:14
I cargo-culted from chrome_service_application_mac
Avi (use Gerrit)
2013/02/05 04:01:40
Would you be so kind as to fix it there too? :)
jeremya
2013/02/05 04:28:52
I fixed some things there, but it needs an FSRef f
Avi (use Gerrit)
2013/02/05 05:15:49
Yeah, that falls under the "no non-deprecated way
|
+ |
+ if (status != noErr) |
+ return FilePath(); |
+ return FilePath(base::mac::PathFromFSRef(ref)); |
Avi (use Gerrit)
2013/02/05 00:19:25
PathFromFSRef... ew. If we have to deal with APIs
jeremya
2013/02/05 02:38:14
Done.
|
+} |
+ |
bool CreatePlatformShortcuts( |
const FilePath& web_app_path, |
const ShellIntegration::ShortcutInfo& shortcut_info) { |
@@ -267,9 +285,11 @@ bool CreatePlatformShortcuts( |
void DeletePlatformShortcuts( |
const FilePath& web_app_path, |
- const ShellIntegration::ShortcutInfo& shortcut_info) { |
- // TODO(benwells): Implement this when shortcuts / weblings are enabled on |
- // mac. |
+ const ShellIntegration::ShortcutInfo& info) { |
+ DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); |
+ |
+ FilePath bundle_path = GetAppBundleByExtensionId(info.extension_id); |
+ file_util::Delete(bundle_path, true); |
} |
void UpdatePlatformShortcuts( |