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_source_mac.h" | 5 #import "content/browser/web_contents/web_drag_source_mac.h" |
6 | 6 |
7 #include <sys/param.h> | 7 #include <sys/param.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 NSRect screenFrame = [[[contentsView_ window] screen] frame]; | 278 NSRect screenFrame = [[[contentsView_ window] screen] frame]; |
279 screenPoint.y = screenFrame.size.height - screenPoint.y; | 279 screenPoint.y = screenFrame.size.height - screenPoint.y; |
280 | 280 |
281 // If AppKit returns a copy and move operation, mask off the move bit | 281 // If AppKit returns a copy and move operation, mask off the move bit |
282 // because WebCore does not understand what it means to do both, which | 282 // because WebCore does not understand what it means to do both, which |
283 // results in an assertion failure/renderer crash. | 283 // results in an assertion failure/renderer crash. |
284 if (operation == (NSDragOperationMove | NSDragOperationCopy)) | 284 if (operation == (NSDragOperationMove | NSDragOperationCopy)) |
285 operation &= ~NSDragOperationMove; | 285 operation &= ~NSDragOperationMove; |
286 | 286 |
287 contents_->DragSourceEndedAt(localPoint.x, localPoint.y, screenPoint.x, | 287 contents_->DragSourceEndedAt(localPoint.x, localPoint.y, screenPoint.x, |
288 screenPoint.y, static_cast<WebKit::WebDragOperation>(operation)); | 288 screenPoint.y, static_cast<blink::WebDragOperation>(operation)); |
289 } | 289 } |
290 | 290 |
291 // Make sure the pasteboard owner isn't us. | 291 // Make sure the pasteboard owner isn't us. |
292 [pasteboard_ declareTypes:[NSArray array] owner:nil]; | 292 [pasteboard_ declareTypes:[NSArray array] owner:nil]; |
293 } | 293 } |
294 | 294 |
295 - (void)moveDragTo:(NSPoint)screenPoint { | 295 - (void)moveDragTo:(NSPoint)screenPoint { |
296 if (!contents_) | 296 if (!contents_) |
297 return; | 297 return; |
298 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( | 298 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 - (NSImage*)dragImage { | 480 - (NSImage*)dragImage { |
481 if (dragImage_) | 481 if (dragImage_) |
482 return dragImage_; | 482 return dragImage_; |
483 | 483 |
484 // Default to returning a generic image. | 484 // Default to returning a generic image. |
485 return content::GetContentClient()->GetNativeImageNamed( | 485 return content::GetContentClient()->GetNativeImageNamed( |
486 IDR_DEFAULT_FAVICON).ToNSImage(); | 486 IDR_DEFAULT_FAVICON).ToNSImage(); |
487 } | 487 } |
488 | 488 |
489 @end // @implementation WebDragSource (Private) | 489 @end // @implementation WebDragSource (Private) |
OLD | NEW |