| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/drag_util.h" | 5 #import "chrome/browser/ui/cocoa/drag_util.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 NSMinY(frame)) | 89 NSMinY(frame)) |
| 90 toPoint:NSMakePoint(NSMaxX(frame), | 90 toPoint:NSMakePoint(NSMaxX(frame), |
| 91 NSMinY(frame)) | 91 NSMinY(frame)) |
| 92 options:NSGradientDrawsBeforeStartingLocation]; | 92 options:NSGradientDrawsBeforeStartingLocation]; |
| 93 CGContextEndTransparencyLayer(context); | 93 CGContextEndTransparencyLayer(context); |
| 94 } | 94 } |
| 95 | 95 |
| 96 } // namespace | 96 } // namespace |
| 97 | 97 |
| 98 GURL GetFileURLFromDropData(id<NSDraggingInfo> info) { | 98 GURL GetFileURLFromDropData(id<NSDraggingInfo> info) { |
| 99 if ([[info draggingPasteboard] containsURLData]) { | 99 if ([[info draggingPasteboard] containsURLDataConvertingTextToURL:YES]) { |
| 100 GURL url; | 100 GURL url; |
| 101 ui::PopulateURLAndTitleFromPasteboard(&url, | 101 ui::PopulateURLAndTitleFromPasteboard(&url, |
| 102 NULL, | 102 NULL, |
| 103 [info draggingPasteboard], | 103 [info draggingPasteboard], |
| 104 YES); | 104 YES); |
| 105 | 105 |
| 106 if (url.SchemeIs(url::kFileScheme)) | 106 if (url.SchemeIs(url::kFileScheme)) |
| 107 return url; | 107 return url; |
| 108 } | 108 } |
| 109 return GURL(); | 109 return GURL(); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 fraction:0.7]; | 160 fraction:0.7]; |
| 161 NSRect target_text_rect = NSMakeRect(text_left, 0, | 161 NSRect target_text_rect = NSMakeRect(text_left, 0, |
| 162 text_size.width, drag_image_size.height); | 162 text_size.width, drag_image_size.height); |
| 163 DrawTruncatedTitle(rich_title, target_text_rect); | 163 DrawTruncatedTitle(rich_title, target_text_rect); |
| 164 [drag_image unlockFocus]; | 164 [drag_image unlockFocus]; |
| 165 | 165 |
| 166 return drag_image; | 166 return drag_image; |
| 167 } | 167 } |
| 168 | 168 |
| 169 } // namespace drag_util | 169 } // namespace drag_util |
| OLD | NEW |