| 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 "content/browser/web_contents/web_drag_dest_mac.h" | 5 #import "content/browser/web_contents/web_drag_dest_mac.h" |
| 6 | 6 |
| 7 #import <Carbon/Carbon.h> | 7 #import <Carbon/Carbon.h> |
| 8 | 8 |
| 9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
| 10 #include "content/browser/renderer_host/render_view_host_impl.h" | 10 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 11 #include "content/browser/web_contents/web_contents_impl.h" | 11 #include "content/browser/web_contents/web_contents_impl.h" |
| 12 #include "content/public/browser/web_contents_delegate.h" | 12 #include "content/public/browser/web_contents_delegate.h" |
| 13 #include "content/public/browser/web_drag_dest_delegate.h" | 13 #include "content/public/browser/web_drag_dest_delegate.h" |
| 14 #include "content/public/common/drop_data.h" | 14 #include "content/public/common/drop_data.h" |
| 15 #include "third_party/WebKit/public/web/WebInputEvent.h" | 15 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 16 #import "third_party/mozilla/NSPasteboard+Utils.h" | 16 #import "third_party/mozilla/NSPasteboard+Utils.h" |
| 17 #include "ui/base/clipboard/custom_data_helper.h" | 17 #include "ui/base/clipboard/custom_data_helper.h" |
| 18 #include "ui/base/cocoa/cocoa_base_utils.h" |
| 18 #import "ui/base/dragdrop/cocoa_dnd_util.h" | 19 #import "ui/base/dragdrop/cocoa_dnd_util.h" |
| 19 #include "ui/base/window_open_disposition.h" | 20 #include "ui/base/window_open_disposition.h" |
| 20 | 21 |
| 21 using blink::WebDragOperationsMask; | 22 using blink::WebDragOperationsMask; |
| 22 using content::DropData; | 23 using content::DropData; |
| 23 using content::OpenURLParams; | 24 using content::OpenURLParams; |
| 24 using content::Referrer; | 25 using content::Referrer; |
| 25 using content::WebContentsImpl; | 26 using content::WebContentsImpl; |
| 26 | 27 |
| 27 namespace { | 28 namespace { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 NSRect viewFrame = [view frame]; | 92 NSRect viewFrame = [view frame]; |
| 92 viewPoint.y = viewFrame.size.height - viewPoint.y; | 93 viewPoint.y = viewFrame.size.height - viewPoint.y; |
| 93 return viewPoint; | 94 return viewPoint; |
| 94 } | 95 } |
| 95 | 96 |
| 96 // Given a point in window coordinates and a view in that window, return a | 97 // Given a point in window coordinates and a view in that window, return a |
| 97 // flipped point in screen coordinates. | 98 // flipped point in screen coordinates. |
| 98 - (NSPoint)flipWindowPointToScreen:(const NSPoint&)windowPoint | 99 - (NSPoint)flipWindowPointToScreen:(const NSPoint&)windowPoint |
| 99 view:(NSView*)view { | 100 view:(NSView*)view { |
| 100 DCHECK(view); | 101 DCHECK(view); |
| 101 NSPoint screenPoint = [[view window] convertBaseToScreen:windowPoint]; | 102 NSPoint screenPoint = |
| 103 ui::ConvertPointFromWindowToScreen([view window], windowPoint); |
| 102 NSScreen* screen = [[view window] screen]; | 104 NSScreen* screen = [[view window] screen]; |
| 103 NSRect screenFrame = [screen frame]; | 105 NSRect screenFrame = [screen frame]; |
| 104 screenPoint.y = screenFrame.size.height - screenPoint.y; | 106 screenPoint.y = screenFrame.size.height - screenPoint.y; |
| 105 return screenPoint; | 107 return screenPoint; |
| 106 } | 108 } |
| 107 | 109 |
| 108 // Return YES if the drop site only allows drops that would navigate. If this | 110 // Return YES if the drop site only allows drops that would navigate. If this |
| 109 // is the case, we don't want to pass messages to the renderer because there's | 111 // is the case, we don't want to pass messages to the renderer because there's |
| 110 // really no point (i.e., there's nothing that cares about the mouse position or | 112 // really no point (i.e., there's nothing that cares about the mouse position or |
| 111 // entering and exiting). One example is an interstitial page (e.g., safe | 113 // entering and exiting). One example is an interstitial page (e.g., safe |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 // Get custom MIME data. | 323 // Get custom MIME data. |
| 322 if ([types containsObject:ui::kWebCustomDataPboardType]) { | 324 if ([types containsObject:ui::kWebCustomDataPboardType]) { |
| 323 NSData* customData = [pboard dataForType:ui::kWebCustomDataPboardType]; | 325 NSData* customData = [pboard dataForType:ui::kWebCustomDataPboardType]; |
| 324 ui::ReadCustomDataIntoMap([customData bytes], | 326 ui::ReadCustomDataIntoMap([customData bytes], |
| 325 [customData length], | 327 [customData length], |
| 326 &data->custom_data); | 328 &data->custom_data); |
| 327 } | 329 } |
| 328 } | 330 } |
| 329 | 331 |
| 330 @end | 332 @end |
| OLD | NEW |