| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 } | 119 } |
| 120 | 120 |
| 121 gfx::NativeWindow TabContentsViewMac::GetTopLevelNativeWindow() const { | 121 gfx::NativeWindow TabContentsViewMac::GetTopLevelNativeWindow() const { |
| 122 return [cocoa_view_.get() window]; | 122 return [cocoa_view_.get() window]; |
| 123 } | 123 } |
| 124 | 124 |
| 125 void TabContentsViewMac::GetContainerBounds(gfx::Rect* out) const { | 125 void TabContentsViewMac::GetContainerBounds(gfx::Rect* out) const { |
| 126 *out = [cocoa_view_.get() NSRectToRect:[cocoa_view_.get() bounds]]; | 126 *out = [cocoa_view_.get() NSRectToRect:[cocoa_view_.get() bounds]]; |
| 127 } | 127 } |
| 128 | 128 |
| 129 void TabContentsViewMac::StartDragging(const WebDropData& drop_data, | 129 void TabContentsViewMac::StartDragging( |
| 130 WebDragOperationsMask allowed_operations) { | 130 const WebDropData& drop_data, |
| 131 WebDragOperationsMask allowed_operations, |
| 132 const SkBitmap& image, |
| 133 const gfx::Point& image_offset) { |
| 131 // By allowing nested tasks, the code below also allows Close(), | 134 // By allowing nested tasks, the code below also allows Close(), |
| 132 // which would deallocate |this|. The same problem can occur while | 135 // which would deallocate |this|. The same problem can occur while |
| 133 // processing -sendEvent:, so Close() is deferred in that case. | 136 // processing -sendEvent:, so Close() is deferred in that case. |
| 134 // Drags from web content do not come via -sendEvent:, this sets the | 137 // Drags from web content do not come via -sendEvent:, this sets the |
| 135 // same flag -sendEvent: would. | 138 // same flag -sendEvent: would. |
| 136 chrome_application_mac::ScopedSendingEvent sendingEventScoper; | 139 chrome_application_mac::ScopedSendingEvent sendingEventScoper; |
| 137 | 140 |
| 138 // The drag invokes a nested event loop, arrange to continue | 141 // The drag invokes a nested event loop, arrange to continue |
| 139 // processing events. | 142 // processing events. |
| 140 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); | 143 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); |
| 144 // TODO(estade): make use of |image| and |image_offset|. |
| 141 NSDragOperation mask = static_cast<NSDragOperation>(allowed_operations); | 145 NSDragOperation mask = static_cast<NSDragOperation>(allowed_operations); |
| 142 [cocoa_view_ startDragWithDropData:drop_data | 146 [cocoa_view_ startDragWithDropData:drop_data |
| 143 dragOperationMask:mask]; | 147 dragOperationMask:mask]; |
| 144 } | 148 } |
| 145 | 149 |
| 146 void TabContentsViewMac::RenderViewCreated(RenderViewHost* host) { | 150 void TabContentsViewMac::RenderViewCreated(RenderViewHost* host) { |
| 147 // We want updates whenever the intrinsic width of the webpage | 151 // We want updates whenever the intrinsic width of the webpage |
| 148 // changes. Put the RenderView into that mode. | 152 // changes. Put the RenderView into that mode. |
| 149 int routing_id = host->routing_id(); | 153 int routing_id = host->routing_id(); |
| 150 host->Send(new ViewMsg_EnablePreferredSizeChangedMode(routing_id)); | 154 host->Send(new ViewMsg_EnablePreferredSizeChangedMode(routing_id)); |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 [NSObject cancelPreviousPerformRequestsWithTarget:self | 443 [NSObject cancelPreviousPerformRequestsWithTarget:self |
| 440 selector:aSel | 444 selector:aSel |
| 441 object:nil]; | 445 object:nil]; |
| 442 } | 446 } |
| 443 | 447 |
| 444 - (void)closeTabAfterEvent { | 448 - (void)closeTabAfterEvent { |
| 445 tabContentsView_->CloseTab(); | 449 tabContentsView_->CloseTab(); |
| 446 } | 450 } |
| 447 | 451 |
| 448 @end | 452 @end |
| OLD | NEW |