summaryrefslogtreecommitdiffstats
path: root/ui/gfx/screen_ios.mm
diff options
context:
space:
mode:
authorscottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-12 19:51:17 +0000
committerscottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-12 19:51:17 +0000
commitffabb1ea75e662308da91e916a0ffc922525aa18 (patch)
tree788b1ac84169a936b02d10feda6c94efaee129ea /ui/gfx/screen_ios.mm
parentc856e976800426511cd1a0f74d38c1fa7c883018 (diff)
downloadchromium_src-ffabb1ea75e662308da91e916a0ffc922525aa18.zip
chromium_src-ffabb1ea75e662308da91e916a0ffc922525aa18.tar.gz
chromium_src-ffabb1ea75e662308da91e916a0ffc922525aa18.tar.bz2
Makes gfx::Screen an instance, rather than a collection of static methods.
This is in support of supporting separate Screen implementations on Aura for desktop and metro on Windows. Some callsites are not yet correct, and noted with a reference to the http://crbug.com/133312. As-is those sites will behave the same as before this patch, but may not be correct once desktop/metro can run simultaneously. BUG=133312 Review URL: https://chromiumcodereview.appspot.com/11030017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@161644 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/screen_ios.mm')
-rw-r--r--ui/gfx/screen_ios.mm69
1 files changed, 57 insertions, 12 deletions
diff --git a/ui/gfx/screen_ios.mm b/ui/gfx/screen_ios.mm
index 42b2edd..6357b98 100644
--- a/ui/gfx/screen_ios.mm
+++ b/ui/gfx/screen_ios.mm
@@ -6,25 +6,70 @@
#import <UIKit/UIKit.h>
+#include "base/logging.h"
#include "ui/gfx/display.h"
-namespace gfx {
+namespace {
-// static
-gfx::Display Screen::GetPrimaryDisplay() {
- UIScreen* mainScreen = [[UIScreen screens] objectAtIndex:0];
- gfx::Display display(0, gfx::Rect(mainScreen.bounds));
- return display;
-}
+class ScreenIos : public gfx::Screen {
+ virtual bool IsDIPEnabled() OVERRIDE {
+ return true;
+ }
+
+ virtual gfx::Point GetCursorScreenPoint() OVERRIDE {
+ NOTIMPLEMENTED();
+ return gfx::Point(0, 0);
+ }
-// static
-int Screen::GetNumDisplays() {
+ virtual gfx::NativeWindow GetWindowAtCursorScreenPoint() OVERRIDE {
+ NOTIMPLEMENTED();
+ return gfx::NativeWindow();
+ }
+
+ virtual int GetNumDisplays() OVERRIDE {
#if TARGET_IPHONE_SIMULATOR
- // UIScreen does not reliably return correct results on the simulator.
- return 1;
+ // UIScreen does not reliably return correct results on the simulator.
+ return 1;
#else
- return [[UIScreen screens] count];
+ return [[UIScreen screens] count];
#endif
+ }
+
+ // Returns the display nearest the specified window.
+ virtual gfx::Display GetDisplayNearestWindow(
+ gfx::NativeView view) const OVERRIDE {
+ NOTIMPLEMENTED();
+ return gfx::Display();
+ }
+
+ // Returns the the display nearest the specified point.
+ virtual gfx::Display GetDisplayNearestPoint(
+ const gfx::Point& point) const OVERRIDE {
+ NOTIMPLEMENTED();
+ return gfx::Display();
+ }
+
+ // Returns the display that most closely intersects the provided bounds.
+ virtual gfx::Display GetDisplayMatching(
+ const gfx::Rect& match_rect) const OVERRIDE {
+ NOTIMPLEMENTED();
+ return gfx::Display();
+ }
+
+ // Returns the primary display.
+ virtual gfx::Display GetPrimaryDisplay() const OVERRIDE {
+ UIScreen* mainScreen = [[UIScreen screens] objectAtIndex:0];
+ gfx::Display display(0, gfx::Rect(mainScreen.bounds));
+ return display;
+ }
+};
+
+} // namespace
+
+namespace gfx {
+
+Screen* CreateNativeScreen() {
+ return new ScreenIos;
}
} // namespace gfx