| 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 #include "ui/gfx/screen.h" | 5 #include "ui/gfx/screen.h" |
| 6 | 6 |
| 7 #import <ApplicationServices/ApplicationServices.h> | 7 #import <ApplicationServices/ApplicationServices.h> |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/mac/sdk_forward_declarations.h" |
| 11 #include "ui/gfx/display.h" | 12 #include "ui/gfx/display.h" |
| 12 | 13 |
| 13 #if !defined(MAC_OS_X_VERSION_10_7) || \ | |
| 14 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 | |
| 15 | |
| 16 @interface NSScreen (LionAPI) | |
| 17 - (CGFloat)backingScaleFactor; | |
| 18 @end | |
| 19 | |
| 20 #endif // 10.7 | |
| 21 | |
| 22 namespace { | 14 namespace { |
| 23 | 15 |
| 24 gfx::Rect ConvertCoordinateSystem(NSRect ns_rect) { | 16 gfx::Rect ConvertCoordinateSystem(NSRect ns_rect) { |
| 25 // Primary monitor is defined as the monitor with the menubar, | 17 // Primary monitor is defined as the monitor with the menubar, |
| 26 // which is always at index 0. | 18 // which is always at index 0. |
| 27 NSScreen* primary_screen = [[NSScreen screens] objectAtIndex:0]; | 19 NSScreen* primary_screen = [[NSScreen screens] objectAtIndex:0]; |
| 28 float primary_screen_height = [primary_screen frame].size.height; | 20 float primary_screen_height = [primary_screen frame].size.height; |
| 29 gfx::Rect rect(NSRectToCGRect(ns_rect)); | 21 gfx::Rect rect(NSRectToCGRect(ns_rect)); |
| 30 rect.set_y(primary_screen_height - rect.y() - rect.height()); | 22 rect.set_y(primary_screen_height - rect.y() - rect.height()); |
| 31 return rect; | 23 return rect; |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 | 176 |
| 185 } // namespace | 177 } // namespace |
| 186 | 178 |
| 187 namespace gfx { | 179 namespace gfx { |
| 188 | 180 |
| 189 Screen* CreateNativeScreen() { | 181 Screen* CreateNativeScreen() { |
| 190 return new ScreenMac; | 182 return new ScreenMac; |
| 191 } | 183 } |
| 192 | 184 |
| 193 } | 185 } |
| OLD | NEW |