summaryrefslogtreecommitdiffstats
path: root/ui/platform_window
diff options
context:
space:
mode:
authorsadrul <sadrul@chromium.org>2015-07-01 22:06:54 -0700
committerCommit bot <commit-bot@chromium.org>2015-07-02 05:07:30 +0000
commit446a048244b00414e716e461b23178278cba124d (patch)
treedc33e828d6c34845d338c995450ca91f678f9c14 /ui/platform_window
parent32558576aeb6e7704bd9c669435a6249893b65a5 (diff)
downloadchromium_src-446a048244b00414e716e461b23178278cba124d.zip
chromium_src-446a048244b00414e716e461b23178278cba124d.tar.gz
chromium_src-446a048244b00414e716e461b23178278cba124d.tar.bz2
view_manager: Add a stub impl for PlatformWindow, and remove PlatformViewportHeadless.
After this change, only a single implementation of PlatformViewport remains. A follow-up CL will remove PlatformViewport entirely, and directly use PlatformWindow from DisplayManager instead. BUG=487881 Committed earlier in https://crrev.com/337068, but reverted in https://crrev.com/337153 because it broke mac-gn builds. Also includes the fix from https://crrev.com/337115 Review URL: https://codereview.chromium.org/1214373004 Cr-Commit-Position: refs/heads/master@{#337176}
Diffstat (limited to 'ui/platform_window')
-rw-r--r--ui/platform_window/BUILD.gn13
-rw-r--r--ui/platform_window/stub/BUILD.gn20
-rw-r--r--ui/platform_window/stub/stub_window.cc66
-rw-r--r--ui/platform_window/stub/stub_window.h44
-rw-r--r--ui/platform_window/stub/stub_window_export.h29
5 files changed, 165 insertions, 7 deletions
diff --git a/ui/platform_window/BUILD.gn b/ui/platform_window/BUILD.gn
index feb3176..3dfdc9a 100644
--- a/ui/platform_window/BUILD.gn
+++ b/ui/platform_window/BUILD.gn
@@ -18,18 +18,17 @@ source_set("platform_window") {
}
group("platform_impls") {
+ deps = [
+ "//ui/platform_window/stub",
+ ]
if (is_android) {
- deps = [
+ deps += [
"//ui/platform_window/android",
"//ui/platform_window/android:jni_headers",
]
} else if (use_x11) {
- deps = [
- "//ui/platform_window/x11",
- ]
+ deps += [ "//ui/platform_window/x11" ]
} else if (is_win) {
- deps = [
- "//ui/platform_window/win",
- ]
+ deps += [ "//ui/platform_window/win" ]
}
}
diff --git a/ui/platform_window/stub/BUILD.gn b/ui/platform_window/stub/BUILD.gn
new file mode 100644
index 0000000..4a3a42c
--- /dev/null
+++ b/ui/platform_window/stub/BUILD.gn
@@ -0,0 +1,20 @@
+# Copyright 2015 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.
+
+component("stub") {
+ output_name = "stub_window"
+
+ deps = [
+ "//ui/gfx",
+ "//ui/platform_window",
+ ]
+
+ defines = [ "STUB_WINDOW_IMPLEMENTATION" ]
+
+ sources = [
+ "stub_window.cc",
+ "stub_window.h",
+ "stub_window_export.h",
+ ]
+}
diff --git a/ui/platform_window/stub/stub_window.cc b/ui/platform_window/stub/stub_window.cc
new file mode 100644
index 0000000..cace198
--- /dev/null
+++ b/ui/platform_window/stub/stub_window.cc
@@ -0,0 +1,66 @@
+// Copyright 2015 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/platform_window/stub/stub_window.h"
+
+#include "ui/platform_window/platform_window_delegate.h"
+
+namespace ui {
+
+StubWindow::StubWindow(PlatformWindowDelegate* delegate) : delegate_(delegate) {
+ delegate_->OnAcceleratedWidgetAvailable(gfx::kNullAcceleratedWidget, 1.f);
+}
+
+StubWindow::~StubWindow() {
+}
+
+void StubWindow::Show() {
+}
+
+void StubWindow::Hide() {
+}
+
+void StubWindow::Close() {
+ delegate_->OnClosed();
+}
+
+void StubWindow::SetBounds(const gfx::Rect& bounds) {
+ if (bounds_ == bounds)
+ return;
+ bounds_ = bounds;
+ delegate_->OnBoundsChanged(bounds);
+}
+
+gfx::Rect StubWindow::GetBounds() {
+ return bounds_;
+}
+
+void StubWindow::SetCapture() {
+}
+
+void StubWindow::ReleaseCapture() {
+}
+
+void StubWindow::ToggleFullscreen() {
+}
+
+void StubWindow::Maximize() {
+}
+
+void StubWindow::Minimize() {
+}
+
+void StubWindow::Restore() {
+}
+
+void StubWindow::SetCursor(PlatformCursor cursor) {
+}
+
+void StubWindow::MoveCursorTo(const gfx::Point& location) {
+}
+
+void StubWindow::ConfineCursorToBounds(const gfx::Rect& bounds) {
+}
+
+} // namespace ui
diff --git a/ui/platform_window/stub/stub_window.h b/ui/platform_window/stub/stub_window.h
new file mode 100644
index 0000000..7c68cd6
--- /dev/null
+++ b/ui/platform_window/stub/stub_window.h
@@ -0,0 +1,44 @@
+// Copyright 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.
+
+#ifndef UI_PLATFORM_WINDOW_STUB_STUB_WINDOW_H_
+#define UI_PLATFORM_WINDOW_STUB_STUB_WINDOW_H_
+
+#include "ui/gfx/geometry/rect.h"
+#include "ui/platform_window/platform_window.h"
+#include "ui/platform_window/stub/stub_window_export.h"
+
+namespace ui {
+
+class STUB_WINDOW_EXPORT StubWindow : public PlatformWindow {
+ public:
+ explicit StubWindow(PlatformWindowDelegate* delegate);
+ ~StubWindow() override;
+
+ private:
+ // PlatformWindow:
+ void Show() override;
+ void Hide() override;
+ void Close() override;
+ void SetBounds(const gfx::Rect& bounds) override;
+ gfx::Rect GetBounds() override;
+ void SetCapture() override;
+ void ReleaseCapture() override;
+ void ToggleFullscreen() override;
+ void Maximize() override;
+ void Minimize() override;
+ void Restore() override;
+ void SetCursor(PlatformCursor cursor) override;
+ void MoveCursorTo(const gfx::Point& location) override;
+ void ConfineCursorToBounds(const gfx::Rect& bounds) override;
+
+ PlatformWindowDelegate* delegate_;
+ gfx::Rect bounds_;
+
+ DISALLOW_COPY_AND_ASSIGN(StubWindow);
+};
+
+} // namespace ui
+
+#endif // UI_PLATFORM_WINDOW_STUB_STUB_WINDOW_H_
diff --git a/ui/platform_window/stub/stub_window_export.h b/ui/platform_window/stub/stub_window_export.h
new file mode 100644
index 0000000..2d983ed
--- /dev/null
+++ b/ui/platform_window/stub/stub_window_export.h
@@ -0,0 +1,29 @@
+// Copyright 2015 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.
+
+#ifndef UI_PLATFORM_WINDOW_STUB_STUB_WINDOW_EXPORT_H_
+#define UI_PLATFORM_WINDOW_STUB_STUB_WINDOW_EXPORT_H_
+
+#if defined(COMPONENT_BUILD)
+#if defined(WIN32)
+
+#if defined(STUB_WINDOW_IMPLEMENTATION)
+#define STUB_WINDOW_EXPORT __declspec(dllexport)
+#else
+#define STUB_WINDOW_EXPORT __declspec(dllimport)
+#endif // defined(STUB_WINDOW_IMPLEMENTATION)
+
+#else // defined(WIN32)
+#if defined(STUB_WINDOW_IMPLEMENTATION)
+#define STUB_WINDOW_EXPORT __attribute__((visibility("default")))
+#else
+#define STUB_WINDOW_EXPORT
+#endif
+#endif
+
+#else // defined(COMPONENT_BUILD)
+#define STUB_WINDOW_EXPORT
+#endif
+
+#endif // UI_PLATFORM_WINDOW_STUB_STUB_WINDOW_EXPORT_H