| Index: chromecast/ui/gfx/screen_cast.cc
|
| diff --git a/ui/gfx/screen_ios.mm b/chromecast/ui/gfx/screen_cast.cc
|
| similarity index 54%
|
| copy from ui/gfx/screen_ios.mm
|
| copy to chromecast/ui/gfx/screen_cast.cc
|
| index a2770298ca8bf03470d9ba66048b9044c0f4d0da..7cda18e6fec9e41a984266c4ad67c0287c849f0d 100644
|
| --- a/ui/gfx/screen_ios.mm
|
| +++ b/chromecast/ui/gfx/screen_cast.cc
|
| @@ -1,87 +1,89 @@
|
| -// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Copyright (c) 2014 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 "base/logging.h"
|
| -#include "ui/gfx/display.h"
|
| +
|
| +namespace gfx {
|
| +class DisplayObserver;
|
| +} // namespace gfx
|
|
|
| namespace {
|
|
|
| -class ScreenIos : public gfx::Screen {
|
| +gfx::Rect NativePrimaryMonitorBounds() {
|
| + NOTIMPLEMENTED();
|
| + return gfx::Rect(0, 0, 1920, 1080);
|
| +}
|
| +
|
| +class ScreenCast : public gfx::Screen {
|
| + public:
|
| + ScreenCast() {
|
| + }
|
| +
|
| + virtual ~ScreenCast() {
|
| + }
|
| +
|
| virtual bool IsDIPEnabled() OVERRIDE {
|
| - return true;
|
| + return false;
|
| }
|
|
|
| virtual gfx::Point GetCursorScreenPoint() OVERRIDE {
|
| - NOTIMPLEMENTED();
|
| - return gfx::Point(0, 0);
|
| + return gfx::Point();
|
| }
|
|
|
| virtual gfx::NativeWindow GetWindowUnderCursor() OVERRIDE {
|
| NOTIMPLEMENTED();
|
| - return gfx::NativeWindow();
|
| + return NULL;
|
| }
|
|
|
| virtual gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point)
|
| OVERRIDE {
|
| NOTIMPLEMENTED();
|
| - return gfx::NativeWindow();
|
| + return NULL;
|
| }
|
|
|
| virtual int GetNumDisplays() const OVERRIDE {
|
| -#if TARGET_IPHONE_SIMULATOR
|
| - // UIScreen does not reliably return correct results on the simulator.
|
| return 1;
|
| -#else
|
| - return [[UIScreen screens] count];
|
| -#endif
|
| }
|
|
|
| virtual std::vector<gfx::Display> GetAllDisplays() const OVERRIDE {
|
| - NOTIMPLEMENTED();
|
| return std::vector<gfx::Display>(1, GetPrimaryDisplay());
|
| }
|
|
|
| - // Returns the display nearest the specified window.
|
| virtual gfx::Display GetDisplayNearestWindow(
|
| gfx::NativeView view) const OVERRIDE {
|
| - NOTIMPLEMENTED();
|
| - return gfx::Display();
|
| + return GetPrimaryDisplay();
|
| }
|
|
|
| - // Returns the the display nearest the specified point.
|
| virtual gfx::Display GetDisplayNearestPoint(
|
| const gfx::Point& point) const OVERRIDE {
|
| - NOTIMPLEMENTED();
|
| - return gfx::Display();
|
| + return GetPrimaryDisplay();
|
| }
|
|
|
| - // 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();
|
| + return GetPrimaryDisplay();
|
| }
|
|
|
| - // Returns the primary display.
|
| virtual gfx::Display GetPrimaryDisplay() const OVERRIDE {
|
| - UIScreen* mainScreen = [[UIScreen screens] objectAtIndex:0];
|
| - gfx::Display display(0, gfx::Rect(mainScreen.bounds));
|
| - display.set_device_scale_factor([mainScreen scale]);
|
| + gfx::Rect bounds = NativePrimaryMonitorBounds();
|
| + // TODO(lcwu): Implement ID and Observer.
|
| + gfx::Display display(0, bounds);
|
| + // Assume that the work area and the monitor size actually match.
|
| + display.set_work_area(bounds);
|
| return display;
|
| }
|
|
|
| virtual void AddObserver(gfx::DisplayObserver* observer) OVERRIDE {
|
| - // no display change on iOS.
|
| }
|
|
|
| virtual void RemoveObserver(gfx::DisplayObserver* observer) OVERRIDE {
|
| - // no display change on iOS.
|
| }
|
| +
|
| + private:
|
| + DISALLOW_COPY_AND_ASSIGN(ScreenCast);
|
| };
|
|
|
| } // namespace
|
| @@ -89,7 +91,7 @@ class ScreenIos : public gfx::Screen {
|
| namespace gfx {
|
|
|
| Screen* CreateNativeScreen() {
|
| - return new ScreenIos;
|
| + return new ScreenCast;
|
| }
|
|
|
| } // namespace gfx
|
|
|