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

Unified Diff: ui/android/dummy_screen_android.cc

Issue 2416403002: Reland of Android: support multiple displays on C++ side (Closed)
Patch Set: Moved SetScreenInstance call to PreMainMessageLoopRun Created 4 years, 1 month 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/android/dummy_screen_android.cc
diff --git a/ui/android/dummy_screen_android.cc b/ui/android/dummy_screen_android.cc
new file mode 100644
index 0000000000000000000000000000000000000000..05568f10c8cbf5e184e794a79acb8b5c69375dc1
--- /dev/null
+++ b/ui/android/dummy_screen_android.cc
@@ -0,0 +1,61 @@
+// Copyright 2016 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/android/screen_android.h"
+#include "ui/display/display.h"
+#include "ui/display/screen.h"
+
+namespace ui {
+
+using display::Display;
+using display::DisplayObserver;
+
+class DummyScreenAndroid : public display::Screen {
+ public:
+ DummyScreenAndroid() {}
+ ~DummyScreenAndroid() override {}
+
+ // Screen interface.
+
+ gfx::Point GetCursorScreenPoint() override { return gfx::Point(); }
+
+ bool IsWindowUnderCursor(gfx::NativeWindow window) override { return false; }
+
+ gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override {
+ return NULL;
+ }
+
+ int GetNumDisplays() const override { return 1; }
+
+ std::vector<Display> GetAllDisplays() const override {
+ return std::vector<Display>(1, GetPrimaryDisplay());
+ }
+
+ Display GetDisplayNearestWindow(gfx::NativeView view) const override {
+ return GetPrimaryDisplay();
+ }
+
+ Display GetDisplayNearestPoint(const gfx::Point& point) const override {
+ return GetPrimaryDisplay();
+ }
+
+ Display GetDisplayMatching(const gfx::Rect& match_rect) const override {
+ return GetPrimaryDisplay();
+ }
+
+ Display GetPrimaryDisplay() const override {
+ const int display_id = 0;
+ const gfx::Rect bounds_in_dip(256, 512);
+ return display::Display(display_id, bounds_in_dip);
+ }
+
+ void AddObserver(DisplayObserver* observer) override {}
+ void RemoveObserver(DisplayObserver* observer) override {}
+};
+
+display::Screen* CreateScreenAndroidForTests() {
+ return new DummyScreenAndroid;
+}
+
+} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698