summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/download_item_button.mm
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-30 06:37:36 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-30 06:37:36 +0000
commitaedec4f0910a973ef0bd13bdb3bcec36b00922c4 (patch)
tree4bb0aa3f522262ed34c0b5ed64b33a02693be622 /chrome/browser/cocoa/download_item_button.mm
parent686e89ddab3da88b913292ff4e8bd97ccb8209d9 (diff)
downloadchromium_src-aedec4f0910a973ef0bd13bdb3bcec36b00922c4.zip
chromium_src-aedec4f0910a973ef0bd13bdb3bcec36b00922c4.tar.gz
chromium_src-aedec4f0910a973ef0bd13bdb3bcec36b00922c4.tar.bz2
Make download items drag sources on OS X.
Extract button dragging out of BookmarkButton into DraggableButton. Make BookmarkButton a subclass of DraggableButton. Create new class DownloadItemButton and make it a subclass of DraggableButton. xib change: Make download item a DownloadItemButton instead of an NSButton. BUG=15776 TEST=Download something, wait for it to complete, then drag it from the download shelf to somewhere. It should now work. Bookmarks should still be draggable in the bookmarks bar. Review URL: http://codereview.chromium.org/180036 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37621 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/download_item_button.mm')
-rw-r--r--chrome/browser/cocoa/download_item_button.mm21
1 files changed, 21 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/download_item_button.mm b/chrome/browser/cocoa/download_item_button.mm
new file mode 100644
index 0000000..41a62c8
--- /dev/null
+++ b/chrome/browser/cocoa/download_item_button.mm
@@ -0,0 +1,21 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import "chrome/browser/cocoa/download_item_button.h"
+
+#include "base/sys_string_conversions.h"
+
+@implementation DownloadItemButton
+
+@synthesize download = downloadPath_;
+
+// Overridden from DraggableButton.
+- (void)beginDrag:(NSEvent*)event {
+ if (!downloadPath_.empty()) {
+ NSString* filename = base::SysUTF8ToNSString(downloadPath_.value());
+ [self dragFile:filename fromRect:[self bounds] slideBack:YES event:event];
+ }
+}
+
+@end