| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include "chrome/browser/tab_contents/tab_contents_view_mac.h" | 7 #include "chrome/browser/tab_contents/tab_contents_view_mac.h" |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 *out = [cocoa_view_.get() NSRectToRect:[cocoa_view_.get() bounds]]; | 127 *out = [cocoa_view_.get() NSRectToRect:[cocoa_view_.get() bounds]]; |
| 128 } | 128 } |
| 129 | 129 |
| 130 void TabContentsViewMac::StartDragging(const WebDropData& drop_data, | 130 void TabContentsViewMac::StartDragging(const WebDropData& drop_data, |
| 131 WebDragOperationsMask allowed_operations) { | 131 WebDragOperationsMask allowed_operations) { |
| 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 chrome_application_mac::ScopedSendingEvent sendingEventScoper( | 137 chrome_application_mac::ScopedSendingEvent sendingEventScoper; |
| 138 static_cast<CrApplication*>([CrApplication sharedApplication])); | |
| 139 | 138 |
| 140 // The drag invokes a nested event loop, arrange to continue | 139 // The drag invokes a nested event loop, arrange to continue |
| 141 // processing events. | 140 // processing events. |
| 142 bool old_state = MessageLoop::current()->NestableTasksAllowed(); | 141 bool old_state = MessageLoop::current()->NestableTasksAllowed(); |
| 143 MessageLoop::current()->SetNestableTasksAllowed(true); | 142 MessageLoop::current()->SetNestableTasksAllowed(true); |
| 144 NSDragOperation mask = static_cast<NSDragOperation>(allowed_operations); | 143 NSDragOperation mask = static_cast<NSDragOperation>(allowed_operations); |
| 145 [cocoa_view_ startDragWithDropData:drop_data | 144 [cocoa_view_ startDragWithDropData:drop_data |
| 146 dragOperationMask:mask]; | 145 dragOperationMask:mask]; |
| 147 MessageLoop::current()->SetNestableTasksAllowed(old_state); | 146 MessageLoop::current()->SetNestableTasksAllowed(old_state); |
| 148 } | 147 } |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 } | 531 } |
| 533 | 532 |
| 534 - (void)closeTabAfterEvent { | 533 - (void)closeTabAfterEvent { |
| 535 tabContentsView_->CloseTab(); | 534 tabContentsView_->CloseTab(); |
| 536 } | 535 } |
| 537 | 536 |
| 538 // Tons of stuff goes here, where we grab events going on in Cocoaland and send | 537 // Tons of stuff goes here, where we grab events going on in Cocoaland and send |
| 539 // them into the C++ system. TODO(avi): all that jazz | 538 // them into the C++ system. TODO(avi): all that jazz |
| 540 | 539 |
| 541 @end | 540 @end |
| OLD | NEW |