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 <UIKit/UIKit.h> | 7 #import <UIKit/UIKit.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "ui/gfx/display.h" | 10 #include "ui/gfx/display.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 62 |
63 // Returns the display that most closely intersects the provided bounds. | 63 // Returns the display that most closely intersects the provided bounds. |
64 virtual gfx::Display GetDisplayMatching( | 64 virtual gfx::Display GetDisplayMatching( |
65 const gfx::Rect& match_rect) const OVERRIDE { | 65 const gfx::Rect& match_rect) const OVERRIDE { |
66 NOTIMPLEMENTED(); | 66 NOTIMPLEMENTED(); |
67 return gfx::Display(); | 67 return gfx::Display(); |
68 } | 68 } |
69 | 69 |
70 // Returns the primary display. | 70 // Returns the primary display. |
71 virtual gfx::Display GetPrimaryDisplay() const OVERRIDE { | 71 virtual gfx::Display GetPrimaryDisplay() const OVERRIDE { |
72 UIScreen* mainScreen = [[UIScreen screens] objectAtIndex:0]; | 72 UIScreen* mainScreen = [UIScreen mainScreen]; |
| 73 CHECK(mainScreen); |
73 gfx::Display display(0, gfx::Rect(mainScreen.bounds)); | 74 gfx::Display display(0, gfx::Rect(mainScreen.bounds)); |
74 display.set_device_scale_factor([mainScreen scale]); | 75 display.set_device_scale_factor([mainScreen scale]); |
75 return display; | 76 return display; |
76 } | 77 } |
77 | 78 |
78 virtual void AddObserver(gfx::DisplayObserver* observer) OVERRIDE { | 79 virtual void AddObserver(gfx::DisplayObserver* observer) OVERRIDE { |
79 // no display change on iOS. | 80 // no display change on iOS. |
80 } | 81 } |
81 | 82 |
82 virtual void RemoveObserver(gfx::DisplayObserver* observer) OVERRIDE { | 83 virtual void RemoveObserver(gfx::DisplayObserver* observer) OVERRIDE { |
83 // no display change on iOS. | 84 // no display change on iOS. |
84 } | 85 } |
85 }; | 86 }; |
86 | 87 |
87 } // namespace | 88 } // namespace |
88 | 89 |
89 namespace gfx { | 90 namespace gfx { |
90 | 91 |
91 Screen* CreateNativeScreen() { | 92 Screen* CreateNativeScreen() { |
92 return new ScreenIos; | 93 return new ScreenIos; |
93 } | 94 } |
94 | 95 |
95 } // namespace gfx | 96 } // namespace gfx |
OLD | NEW |