Index: chrome/browser/cocoa/location_bar_view_mac.mm |
diff --git a/chrome/browser/cocoa/location_bar_view_mac.mm b/chrome/browser/cocoa/location_bar_view_mac.mm |
index 7079471a273a9bc7e90d2ab3457ee5546ed14d88..c2c10ddf912564bf46772e60ba122d4164792da2 100644 |
--- a/chrome/browser/cocoa/location_bar_view_mac.mm |
+++ b/chrome/browser/cocoa/location_bar_view_mac.mm |
@@ -41,6 +41,7 @@ |
#include "grit/generated_resources.h" |
#include "grit/theme_resources.h" |
#include "skia/ext/skia_utils_mac.h" |
+#import "third_party/mozilla/include/NSPasteboard+Utils.h" |
// TODO(shess): This code is mostly copied from the gtk |
@@ -600,6 +601,8 @@ LocationBarViewMac::LocationIconView::LocationIconView( |
LocationBarViewMac::LocationIconView::~LocationIconView() {} |
void LocationBarViewMac::LocationIconView::OnMousePressed(NSRect bounds) { |
+ // TODO(shess): Only allow click if page-info makes sense. |
+ // http://codereview.chromium.org/1594012 |
TabContents* tab = owner_->GetTabContents(); |
NavigationEntry* nav_entry = tab->controller().GetActiveEntry(); |
if (!nav_entry) { |
@@ -609,6 +612,26 @@ void LocationBarViewMac::LocationIconView::OnMousePressed(NSRect bounds) { |
tab->ShowPageInfo(nav_entry->url(), nav_entry->ssl(), true); |
} |
+bool LocationBarViewMac::LocationIconView::IsDraggable() { |
+ // TODO(shess): Only allow drag if there's an URL to drag. |
+ // http://codereview.chromium.org/1594012 |
+ return true; |
+} |
+ |
+NSPasteboard* LocationBarViewMac::LocationIconView::GetDragPasteboard() { |
+ TabContents* tab = owner_->GetTabContents(); |
+ DCHECK(tab); |
viettrungluu
2010/04/08 17:23:18
This seems redundant, since it'll crash on the nex
|
+ |
+ NSString* url = base::SysUTF8ToNSString(tab->GetURL().spec()); |
+ NSString* title = base::SysUTF16ToNSString(tab->GetTitle()); |
+ |
+ NSPasteboard* pboard = [NSPasteboard pasteboardWithName:NSDragPboard]; |
+ [pboard declareURLPasteboardWithAdditionalTypes:[NSArray array] |
+ owner:nil]; |
+ [pboard setDataForURL:url title:title]; |
+ return pboard; |
+} |
+ |
// StarIconView----------------------------------------------------------------- |
LocationBarViewMac::StarIconView::StarIconView(CommandUpdater* command_updater) |