Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(404)

Unified Diff: ui/gfx/screen_ios.mm

Issue 10872042: Provide iOS implementation of screen.h. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Response to reviews Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/ui.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/screen_ios.mm
diff --git a/ui/gfx/screen_ios.mm b/ui/gfx/screen_ios.mm
new file mode 100644
index 0000000000000000000000000000000000000000..42b2edd5ec141b0fa5232aa6438b1e8a01042362
--- /dev/null
+++ b/ui/gfx/screen_ios.mm
@@ -0,0 +1,30 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/gfx/screen.h"
+
+#import <UIKit/UIKit.h>
+
+#include "ui/gfx/display.h"
+
+namespace gfx {
+
+// static
+gfx::Display Screen::GetPrimaryDisplay() {
+ UIScreen* mainScreen = [[UIScreen screens] objectAtIndex:0];
+ gfx::Display display(0, gfx::Rect(mainScreen.bounds));
+ return display;
+}
+
+// static
+int Screen::GetNumDisplays() {
+#if TARGET_IPHONE_SIMULATOR
+ // UIScreen does not reliably return correct results on the simulator.
+ return 1;
+#else
+ return [[UIScreen screens] count];
+#endif
+}
+
+} // namespace gfx
« no previous file with comments | « no previous file | ui/ui.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698