summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/cocoa')
-rw-r--r--chrome/browser/cocoa/bookmark_bar_controller.h1
-rw-r--r--chrome/browser/cocoa/bookmark_bar_controller.mm12
2 files changed, 13 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/bookmark_bar_controller.h b/chrome/browser/cocoa/bookmark_bar_controller.h
index cecdb3b..1efcc92 100644
--- a/chrome/browser/cocoa/bookmark_bar_controller.h
+++ b/chrome/browser/cocoa/bookmark_bar_controller.h
@@ -104,6 +104,7 @@ class PrefService;
- (IBAction)openBookmarkInNewWindow:(id)sender;
- (IBAction)openBookmarkInIncognitoWindow:(id)sender;
- (IBAction)editBookmark:(id)sender;
+- (IBAction)copyBookmark:(id)sender;
- (IBAction)deleteBookmark:(id)sender;
// From a context menu over the bar, ...
- (IBAction)openAllBookmarks:(id)sender;
diff --git a/chrome/browser/cocoa/bookmark_bar_controller.mm b/chrome/browser/cocoa/bookmark_bar_controller.mm
index 32c718d..da36bc1 100644
--- a/chrome/browser/cocoa/bookmark_bar_controller.mm
+++ b/chrome/browser/cocoa/bookmark_bar_controller.mm
@@ -25,6 +25,7 @@
#include "chrome/common/pref_service.h"
#include "grit/generated_resources.h"
#include "skia/ext/skia_utils_mac.h"
+#import "third_party/mozilla/include/NSPasteboard+Utils.h"
// Specialization of NSButton that responds to middle-clicks. By default,
// NSButton ignores them.
@@ -388,6 +389,17 @@ const CGFloat kBookmarkHorizontalPadding = 1.0;
nil);
}
+- (IBAction)copyBookmark:(id)sender {
+ BookmarkNode* node = [self nodeFromMenuItem:sender];
+ const std::string spec = node->GetURL().spec();
+ NSString* url = base::SysUTF8ToNSString(spec);
+ NSString* title = base::SysWideToNSString(node->GetTitle());
+ NSPasteboard* pasteboard = [NSPasteboard generalPasteboard];
+ [pasteboard declareURLPasteboardWithAdditionalTypes:[NSArray array]
+ owner:nil];
+ [pasteboard setDataForURL:url title:title];
+}
+
- (IBAction)deleteBookmark:(id)sender {
BookmarkNode* node = [self nodeFromMenuItem:sender];
bookmarkModel_->Remove(node->GetParent(),