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