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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "ui/gfx/display.h" 10 #include "ui/gfx/display.h"
10 11
12 namespace {
13
14 class ScreenIos : public gfx::Screen {
15 virtual bool IsDIPEnabled() OVERRIDE {
16 return true;
17 }
18
19 virtual gfx::Point GetCursorScreenPoint() OVERRIDE {
20 NOTIMPLEMENTED();
21 return gfx::Point(0, 0);
22 }
23
24 virtual gfx::NativeWindow GetWindowAtCursorScreenPoint() OVERRIDE {
25 NOTIMPLEMENTED();
26 return gfx::NativeWindow();
27 }
28
29 virtual int GetNumDisplays() OVERRIDE {
30 #if TARGET_IPHONE_SIMULATOR
31 // UIScreen does not reliably return correct results on the simulator.
32 return 1;
33 #else
34 return [[UIScreen screens] count];
35 #endif
36 }
37
38 // Returns the display nearest the specified window.
39 virtual gfx::Display GetDisplayNearestWindow(
40 gfx::NativeView view) const OVERRIDE {
41 NOTIMPLEMENTED();
42 return gfx::Display();
43 }
44
45 // Returns the the display nearest the specified point.
46 virtual gfx::Display GetDisplayNearestPoint(
47 const gfx::Point& point) const OVERRIDE {
48 NOTIMPLEMENTED();
49 return gfx::Display();
50 }
51
52 // Returns the display that most closely intersects the provided bounds.
53 virtual gfx::Display GetDisplayMatching(
54 const gfx::Rect& match_rect) const OVERRIDE {
55 NOTIMPLEMENTED();
56 return gfx::Display();
57 }
58
59 // Returns the primary display.
60 virtual gfx::Display GetPrimaryDisplay() const OVERRIDE {
61 UIScreen* mainScreen = [[UIScreen screens] objectAtIndex:0];
62 gfx::Display display(0, gfx::Rect(mainScreen.bounds));
63 return display;
64 }
65 };
66
67 } // namespace
68
11 namespace gfx { 69 namespace gfx {
12 70
13 // static 71 Screen* CreateNativeScreen() {
14 gfx::Display Screen::GetPrimaryDisplay() { 72 return new ScreenIos;
15 UIScreen* mainScreen = [[UIScreen screens] objectAtIndex:0];
16 gfx::Display display(0, gfx::Rect(mainScreen.bounds));
17 return display;
18 }
19
20 // static
21 int Screen::GetNumDisplays() {
22 #if TARGET_IPHONE_SIMULATOR
23 // UIScreen does not reliably return correct results on the simulator.
24 return 1;
25 #else
26 return [[UIScreen screens] count];
27 #endif
28 } 73 }
29 74
30 } // namespace gfx 75 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698