Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4273)

Unified Diff: chrome/browser/cocoa/location_bar_view_mac.mm

Issue 1567023: [Mac] Location icon in omnibox as drag source. (Closed)
Patch Set: more nits Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/cocoa/location_bar_view_mac.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « chrome/browser/cocoa/location_bar_view_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698