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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 void WebContentsViewMac::GetContainerBounds(gfx::Rect* out) const { | 115 void WebContentsViewMac::GetContainerBounds(gfx::Rect* out) const { |
116 // Convert bounds to window coordinate space. | 116 // Convert bounds to window coordinate space. |
117 NSRect bounds = | 117 NSRect bounds = |
118 [cocoa_view_.get() convertRect:[cocoa_view_.get() bounds] toView:nil]; | 118 [cocoa_view_.get() convertRect:[cocoa_view_.get() bounds] toView:nil]; |
119 | 119 |
120 // Convert bounds to screen coordinate space. | 120 // Convert bounds to screen coordinate space. |
121 NSWindow* window = [cocoa_view_.get() window]; | 121 NSWindow* window = [cocoa_view_.get() window]; |
122 bounds.origin = [window convertBaseToScreen:bounds.origin]; | 122 bounds.origin = [window convertBaseToScreen:bounds.origin]; |
123 | 123 |
124 // Flip y to account for screen flip. | 124 // Flip y to account for screen flip. |
125 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; | 125 NSScreen* screen = [[NSScreen screens] firstObject]; |
126 bounds.origin.y = [screen frame].size.height - bounds.origin.y | 126 bounds.origin.y = [screen frame].size.height - bounds.origin.y |
127 - bounds.size.height; | 127 - bounds.size.height; |
128 *out = gfx::Rect(NSRectToCGRect(bounds)); | 128 *out = gfx::Rect(NSRectToCGRect(bounds)); |
129 } | 129 } |
130 | 130 |
131 void WebContentsViewMac::StartDragging( | 131 void WebContentsViewMac::StartDragging( |
132 const DropData& drop_data, | 132 const DropData& drop_data, |
133 WebDragOperationsMask allowed_operations, | 133 WebDragOperationsMask allowed_operations, |
134 const gfx::ImageSkia& image, | 134 const gfx::ImageSkia& image, |
135 const gfx::Vector2d& image_offset, | 135 const gfx::Vector2d& image_offset, |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 if (window && webContents && !webContents->IsBeingDestroyed()) { | 645 if (window && webContents && !webContents->IsBeingDestroyed()) { |
646 if ([window occlusionState] & NSWindowOcclusionStateVisible) { | 646 if ([window occlusionState] & NSWindowOcclusionStateVisible) { |
647 webContents->WasUnOccluded(); | 647 webContents->WasUnOccluded(); |
648 } else { | 648 } else { |
649 webContents->WasOccluded(); | 649 webContents->WasOccluded(); |
650 } | 650 } |
651 } | 651 } |
652 } | 652 } |
653 | 653 |
654 @end | 654 @end |
OLD | NEW |