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

Unified Diff: chromecast/ui/gfx/screen_cast.cc

Issue 223143003: Initial checkin of chromecast content embedder (cast_shell) and related build scripts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add an additional function in gl_surface_cast.cc Created 6 years, 9 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: 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

Powered by Google App Engine
This is Rietveld 408576698