| 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 14 matching lines...) Expand all Loading... |
| 25 #include "content/public/browser/web_contents_delegate.h" | 25 #include "content/public/browser/web_contents_delegate.h" |
| 26 #include "content/public/browser/web_contents_view_delegate.h" | 26 #include "content/public/browser/web_contents_view_delegate.h" |
| 27 #include "content/public/common/content_switches.h" | 27 #include "content/public/common/content_switches.h" |
| 28 #include "skia/ext/skia_utils_mac.h" | 28 #include "skia/ext/skia_utils_mac.h" |
| 29 #import "third_party/mozilla/NSPasteboard+Utils.h" | 29 #import "third_party/mozilla/NSPasteboard+Utils.h" |
| 30 #include "ui/base/clipboard/custom_data_helper.h" | 30 #include "ui/base/clipboard/custom_data_helper.h" |
| 31 #import "ui/base/cocoa/focus_tracker.h" | 31 #import "ui/base/cocoa/focus_tracker.h" |
| 32 #include "ui/base/dragdrop/cocoa_dnd_util.h" | 32 #include "ui/base/dragdrop/cocoa_dnd_util.h" |
| 33 #include "ui/display/screen.h" | 33 #include "ui/display/screen.h" |
| 34 #include "ui/gfx/image/image_skia_util_mac.h" | 34 #include "ui/gfx/image/image_skia_util_mac.h" |
| 35 #include "ui/gfx/mac/coordinate_conversion.h" |
| 35 | 36 |
| 36 using blink::WebDragOperation; | 37 using blink::WebDragOperation; |
| 37 using blink::WebDragOperationsMask; | 38 using blink::WebDragOperationsMask; |
| 38 using content::DropData; | 39 using content::DropData; |
| 39 using content::PopupMenuHelper; | 40 using content::PopupMenuHelper; |
| 40 using content::RenderViewHostFactory; | 41 using content::RenderViewHostFactory; |
| 41 using content::RenderWidgetHostView; | 42 using content::RenderWidgetHostView; |
| 42 using content::RenderWidgetHostViewMac; | 43 using content::RenderWidgetHostViewMac; |
| 43 using content::ScreenInfo; | 44 using content::ScreenInfo; |
| 44 using content::WebContents; | 45 using content::WebContents; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 NSWindow* window = [cocoa_view_.get() window]; | 157 NSWindow* window = [cocoa_view_.get() window]; |
| 157 NSRect bounds = [cocoa_view_.get() bounds]; | 158 NSRect bounds = [cocoa_view_.get() bounds]; |
| 158 if (window) { | 159 if (window) { |
| 159 // Convert bounds to window coordinate space. | 160 // Convert bounds to window coordinate space. |
| 160 bounds = [cocoa_view_.get() convertRect:bounds toView:nil]; | 161 bounds = [cocoa_view_.get() convertRect:bounds toView:nil]; |
| 161 | 162 |
| 162 // Convert bounds to screen coordinate space. | 163 // Convert bounds to screen coordinate space. |
| 163 bounds = [window convertRectToScreen:bounds]; | 164 bounds = [window convertRectToScreen:bounds]; |
| 164 } | 165 } |
| 165 | 166 |
| 166 // Flip y to account for screen flip. | 167 *out = gfx::ScreenRectFromNSRect(bounds); |
| 167 NSScreen* screen = [[NSScreen screens] firstObject]; | |
| 168 bounds.origin.y = [screen frame].size.height - bounds.origin.y | |
| 169 - bounds.size.height; | |
| 170 *out = gfx::Rect(NSRectToCGRect(bounds)); | |
| 171 } | 168 } |
| 172 | 169 |
| 173 void WebContentsViewMac::StartDragging( | 170 void WebContentsViewMac::StartDragging( |
| 174 const DropData& drop_data, | 171 const DropData& drop_data, |
| 175 WebDragOperationsMask allowed_operations, | 172 WebDragOperationsMask allowed_operations, |
| 176 const gfx::ImageSkia& image, | 173 const gfx::ImageSkia& image, |
| 177 const gfx::Vector2d& image_offset, | 174 const gfx::Vector2d& image_offset, |
| 178 const DragEventSourceInfo& event_info, | 175 const DragEventSourceInfo& event_info, |
| 179 RenderWidgetHostImpl* source_rwh) { | 176 RenderWidgetHostImpl* source_rwh) { |
| 180 // By allowing nested tasks, the code below also allows Close(), | 177 // By allowing nested tasks, the code below also allows Close(), |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 | 721 |
| 725 - (void)viewDidHide { | 722 - (void)viewDidHide { |
| 726 [self updateWebContentsVisibility]; | 723 [self updateWebContentsVisibility]; |
| 727 } | 724 } |
| 728 | 725 |
| 729 - (void)viewDidUnhide { | 726 - (void)viewDidUnhide { |
| 730 [self updateWebContentsVisibility]; | 727 [self updateWebContentsVisibility]; |
| 731 } | 728 } |
| 732 | 729 |
| 733 @end | 730 @end |
| OLD | NEW |