| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "chrome/browser/ui/cocoa/download/download_item_button.h" | 5 #import "chrome/browser/ui/cocoa/download/download_item_button.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
| 9 #import "chrome/browser/ui/cocoa/download/download_item_cell.h" | 9 #import "chrome/browser/ui/cocoa/download/download_item_cell.h" |
| 10 #import "chrome/browser/ui/cocoa/download/download_item_controller.h" | 10 #import "chrome/browser/ui/cocoa/download/download_item_controller.h" |
| 11 #import "chrome/browser/ui/cocoa/download/download_shelf_context_menu_controller
.h" | 11 #import "chrome/browser/ui/cocoa/download/download_shelf_context_menu_controller
.h" |
| 12 #import "chrome/browser/ui/cocoa/nsview_additions.h" |
| 13 #import "chrome/browser/ui/cocoa/view_id_util.h" |
| 12 | 14 |
| 13 @implementation DownloadItemButton | 15 @implementation DownloadItemButton |
| 14 | 16 |
| 15 @synthesize download = downloadPath_; | 17 @synthesize download = downloadPath_; |
| 16 @synthesize controller = controller_; | 18 @synthesize controller = controller_; |
| 17 | 19 |
| 18 // Overridden from DraggableButton. | 20 // Overridden from DraggableButton. |
| 19 - (void)beginDrag:(NSEvent*)event { | 21 - (void)beginDrag:(NSEvent*)event { |
| 20 if (!downloadPath_.empty()) { | 22 if (!downloadPath_.empty()) { |
| 21 NSString* filename = base::SysUTF8ToNSString(downloadPath_.value()); | 23 NSString* filename = base::SysUTF8ToNSString(downloadPath_.value()); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 } | 55 } |
| 54 | 56 |
| 55 - (void)menuDidClose:(NSMenu*)menu { | 57 - (void)menuDidClose:(NSMenu*)menu { |
| 56 [[self cell] setHighlighted:NO]; | 58 [[self cell] setHighlighted:NO]; |
| 57 } | 59 } |
| 58 | 60 |
| 59 - (BOOL)shouldDelayWindowOrderingForEvent:(NSEvent*)event { | 61 - (BOOL)shouldDelayWindowOrderingForEvent:(NSEvent*)event { |
| 60 return YES; | 62 return YES; |
| 61 } | 63 } |
| 62 | 64 |
| 65 - (BOOL)isOpaque { |
| 66 // Make this control opaque so that sub-pixel anti-aliasing works when |
| 67 // CoreAnimation is enabled. |
| 68 return YES; |
| 69 } |
| 70 |
| 71 - (void)drawRect:(NSRect)rect { |
| 72 NSView* downloadShelfView = [self ancestorWithViewID:VIEW_ID_DOWNLOAD_SHELF]; |
| 73 [self cr_drawUsingAncestor:downloadShelfView inRect:rect]; |
| 74 [super drawRect:rect]; |
| 75 } |
| 76 |
| 63 @end | 77 @end |
| OLD | NEW |