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 <Carbon/Carbon.h> | 5 #import <Carbon/Carbon.h> |
6 | 6 |
7 #import "content/browser/web_contents/web_contents_view_mac.h" | 7 #import "content/browser/web_contents/web_contents_view_mac.h" |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 const DragEventSourceInfo& event_info) { | 131 const DragEventSourceInfo& event_info) { |
132 // By allowing nested tasks, the code below also allows Close(), | 132 // By allowing nested tasks, the code below also allows Close(), |
133 // which would deallocate |this|. The same problem can occur while | 133 // which would deallocate |this|. The same problem can occur while |
134 // processing -sendEvent:, so Close() is deferred in that case. | 134 // processing -sendEvent:, so Close() is deferred in that case. |
135 // Drags from web content do not come via -sendEvent:, this sets the | 135 // Drags from web content do not come via -sendEvent:, this sets the |
136 // same flag -sendEvent: would. | 136 // same flag -sendEvent: would. |
137 base::mac::ScopedSendingEvent sending_event_scoper; | 137 base::mac::ScopedSendingEvent sending_event_scoper; |
138 | 138 |
139 // The drag invokes a nested event loop, arrange to continue | 139 // The drag invokes a nested event loop, arrange to continue |
140 // processing events. | 140 // processing events. |
141 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); | 141 base::MessageLoop::ScopedNestableTaskAllower allow( |
| 142 base::MessageLoop::current()); |
142 NSDragOperation mask = static_cast<NSDragOperation>(allowed_operations); | 143 NSDragOperation mask = static_cast<NSDragOperation>(allowed_operations); |
143 NSPoint offset = NSPointFromCGPoint( | 144 NSPoint offset = NSPointFromCGPoint( |
144 gfx::PointAtOffsetFromOrigin(image_offset).ToCGPoint()); | 145 gfx::PointAtOffsetFromOrigin(image_offset).ToCGPoint()); |
145 [cocoa_view_ startDragWithDropData:drop_data | 146 [cocoa_view_ startDragWithDropData:drop_data |
146 dragOperationMask:mask | 147 dragOperationMask:mask |
147 image:gfx::NSImageFromImageSkia(image) | 148 image:gfx::NSImageFromImageSkia(image) |
148 offset:offset]; | 149 offset:offset]; |
149 } | 150 } |
150 | 151 |
151 void WebContentsViewMac::OnTabCrashed(base::TerminationStatus /* status */, | 152 void WebContentsViewMac::OnTabCrashed(base::TerminationStatus /* status */, |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 [[[notification userInfo] objectForKey:kSelectionDirection] | 563 [[[notification userInfo] objectForKey:kSelectionDirection] |
563 unsignedIntegerValue]; | 564 unsignedIntegerValue]; |
564 if (direction == NSDirectSelection) | 565 if (direction == NSDirectSelection) |
565 return; | 566 return; |
566 | 567 |
567 [self webContents]-> | 568 [self webContents]-> |
568 FocusThroughTabTraversal(direction == NSSelectingPrevious); | 569 FocusThroughTabTraversal(direction == NSSelectingPrevious); |
569 } | 570 } |
570 | 571 |
571 @end | 572 @end |
OLD | NEW |