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

Unified Diff: ui/gfx/screen_ios.mm

Issue 11030017: Add context to gfx::Screen calls in support of simultaneous desktop+ash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix some new gfx::Screen additions Created 8 years, 2 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
Index: ui/gfx/screen_ios.mm
diff --git a/ui/gfx/screen_ios.mm b/ui/gfx/screen_ios.mm
index 42b2edd5ec141b0fa5232aa6438b1e8a01042362..6357b980075267f29dc163f55da18086c077dd5c 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

Powered by Google App Engine
This is Rietveld 408576698