diff options
author | blundell@chromium.org <blundell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-31 16:31:30 +0000 |
---|---|---|
committer | blundell@chromium.org <blundell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-31 16:31:30 +0000 |
commit | bc455b80dc4112b4423ff7316f906d70cee7130c (patch) | |
tree | fc112f3193cfcde9d7438eace052c8c829181145 /ui | |
parent | dc22637d6d783940cd178b29f1ecabe4711a912b (diff) | |
download | chromium_src-bc455b80dc4112b4423ff7316f906d70cee7130c.zip chromium_src-bc455b80dc4112b4423ff7316f906d70cee7130c.tar.gz chromium_src-bc455b80dc4112b4423ff7316f906d70cee7130c.tar.bz2 |
Provide iOS implementation of screen.h.
BUG=None
Review URL: https://chromiumcodereview.appspot.com/10872042
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@154442 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/gfx/screen_ios.mm | 30 | ||||
-rw-r--r-- | ui/ui.gyp | 15 |
2 files changed, 38 insertions, 7 deletions
diff --git a/ui/gfx/screen_ios.mm b/ui/gfx/screen_ios.mm new file mode 100644 index 0000000..42b2edd --- /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 @@ -53,6 +53,14 @@ 'gfx/rect_base_impl.h', 'gfx/scoped_ui_graphics_push_context_ios.h', 'gfx/scoped_ui_graphics_push_context_ios.mm', + 'gfx/screen.h', + 'gfx/screen_android.cc', + 'gfx/screen_aura.cc', + 'gfx/screen_gtk.cc', + 'gfx/screen_impl.h', + 'gfx/screen_ios.mm', + 'gfx/screen_mac.mm', + 'gfx/screen_win.cc', 'gfx/size.cc', 'gfx/size.h', 'gfx/size_base.h', @@ -441,13 +449,6 @@ 'gfx/render_text_linux.h', 'gfx/render_text_win.cc', 'gfx/render_text_win.h', - 'gfx/screen.h', - 'gfx/screen_android.cc', - 'gfx/screen_aura.cc', - 'gfx/screen_gtk.cc', - 'gfx/screen_impl.h', - 'gfx/screen_mac.mm', - 'gfx/screen_win.cc', 'gfx/scoped_cg_context_save_gstate_mac.h', 'gfx/scoped_ns_graphics_context_save_gstate_mac.h', 'gfx/scoped_ns_graphics_context_save_gstate_mac.mm', |