| 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 #include "chrome/browser/tab_contents/tab_contents_view_mac.h" | 5 #include "chrome/browser/tab_contents/tab_contents_view_mac.h" |
| 6 | 6 |
| 7 #include "base/sys_string_conversions.h" | 7 #include "base/sys_string_conversions.h" |
| 8 #include "chrome/browser/browser.h" // TODO(beng): this dependency is awful. | 8 #include "chrome/browser/browser.h" // TODO(beng): this dependency is awful. |
| 9 #include "chrome/browser/cocoa/nsimage_cache.h" | 9 #include "chrome/browser/cocoa/nsimage_cache.h" |
| 10 #include "chrome/browser/cocoa/sad_tab_view.h" | 10 #include "chrome/browser/cocoa/sad_tab_view.h" |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 } | 178 } |
| 179 | 179 |
| 180 // Create an image to use for the drag. | 180 // Create an image to use for the drag. |
| 181 // TODO(pinkerton): Generate the proper image. This one will do in a pinch. | 181 // TODO(pinkerton): Generate the proper image. This one will do in a pinch. |
| 182 NSImage* dragImage = nsimage_cache::ImageNamed(@"nav.pdf"); | 182 NSImage* dragImage = nsimage_cache::ImageNamed(@"nav.pdf"); |
| 183 | 183 |
| 184 NSPasteboard* pasteboard = FillDragData(drop_data); | 184 NSPasteboard* pasteboard = FillDragData(drop_data); |
| 185 | 185 |
| 186 // Tell the view to start a drag using |cocoa_view_| as the drag source. The | 186 // Tell the view to start a drag using |cocoa_view_| as the drag source. The |
| 187 // source will get notified when the drag completes (success or failure) so | 187 // source will get notified when the drag completes (success or failure) so |
| 188 // it can tell the render view host the drag is done. Windows does this with | 188 // it can tell the render view host the drag is done. The drag invokes a |
| 189 // a nested event loop, we get called back. | 189 // nested event loop, but we need to continue processing events. |
| 190 NSPoint mousePoint = [currentEvent locationInWindow]; | 190 NSPoint mousePoint = [currentEvent locationInWindow]; |
| 191 mousePoint = [cocoa_view_ convertPoint:mousePoint fromView:nil]; | 191 mousePoint = [cocoa_view_ convertPoint:mousePoint fromView:nil]; |
| 192 MessageLoop::current()->SetNestableTasksAllowed(true); |
| 192 [cocoa_view_ dragImage:dragImage | 193 [cocoa_view_ dragImage:dragImage |
| 193 at:mousePoint | 194 at:mousePoint |
| 194 offset:NSZeroSize | 195 offset:NSZeroSize |
| 195 event:currentEvent | 196 event:currentEvent |
| 196 pasteboard:pasteboard | 197 pasteboard:pasteboard |
| 197 source:cocoa_view_ | 198 source:cocoa_view_ |
| 198 slideBack:YES]; | 199 slideBack:YES]; |
| 200 MessageLoop::current()->SetNestableTasksAllowed(false); |
| 199 } | 201 } |
| 200 | 202 |
| 201 void TabContentsViewMac::OnContentsDestroy() { | 203 void TabContentsViewMac::OnContentsDestroy() { |
| 202 } | 204 } |
| 203 | 205 |
| 204 void TabContentsViewMac::RenderViewCreated(RenderViewHost* host) { | 206 void TabContentsViewMac::RenderViewCreated(RenderViewHost* host) { |
| 205 // We want updates whenever the intrinsic width of the webpage | 207 // We want updates whenever the intrinsic width of the webpage |
| 206 // changes. Put the RenderView into that mode. | 208 // changes. Put the RenderView into that mode. |
| 207 int routing_id = host->routing_id(); | 209 int routing_id = host->routing_id(); |
| 208 host->Send(new ViewMsg_EnableIntrinsicWidthChangedMode(routing_id)); | 210 host->Send(new ViewMsg_EnableIntrinsicWidthChangedMode(routing_id)); |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 } | 493 } |
| 492 | 494 |
| 493 - (BOOL)performDragOperation:(id<NSDraggingInfo>)sender { | 495 - (BOOL)performDragOperation:(id<NSDraggingInfo>)sender { |
| 494 return [dropTarget_ performDragOperation:sender view:self]; | 496 return [dropTarget_ performDragOperation:sender view:self]; |
| 495 } | 497 } |
| 496 | 498 |
| 497 // Tons of stuff goes here, where we grab events going on in Cocoaland and send | 499 // Tons of stuff goes here, where we grab events going on in Cocoaland and send |
| 498 // them into the C++ system. TODO(avi): all that jazz | 500 // them into the C++ system. TODO(avi): all that jazz |
| 499 | 501 |
| 500 @end | 502 @end |
| OLD | NEW |