OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ui/gfx/screen.h" |
| 6 |
| 7 #import <UIKit/UIKit.h> |
| 8 |
| 9 #include "ui/gfx/display.h" |
| 10 |
| 11 namespace gfx { |
| 12 |
| 13 // static |
| 14 gfx::Display Screen::GetPrimaryDisplay() { |
| 15 UIScreen* mainScreen = [[UIScreen screens] objectAtIndex:0]; |
| 16 gfx::Display display(0, gfx::Rect(mainScreen.bounds)); |
| 17 return display; |
| 18 } |
| 19 |
| 20 // static |
| 21 int Screen::GetNumDisplays() { |
| 22 #if TARGET_IPHONE_SIMULATOR |
| 23 // UIScreen does not reliably return correct results on the simulator. |
| 24 return 1; |
| 25 #else |
| 26 return [[UIScreen screens] count]; |
| 27 #endif |
| 28 } |
| 29 |
| 30 } // namespace gfx |
OLD | NEW |