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

Unified Diff: ui/aura/window_tree_host_ozone.cc

Issue 375053002: ozone: Port WindowTreeHostOzone on top of PlatformWindow (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase onto sadrul's CL Created 6 years, 5 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: ui/aura/window_tree_host_ozone.cc
diff --git a/ui/aura/window_tree_host_ozone.cc b/ui/aura/window_tree_host_ozone.cc
index ccdce1440eb6090d7ad58111fdce9a69f86ccdc5..c3d85ee23ebb9e5e0eb6ef04e3611cc8935c8373 100644
--- a/ui/aura/window_tree_host_ozone.cc
+++ b/ui/aura/window_tree_host_ozone.cc
@@ -8,19 +8,16 @@
#include "ui/events/platform/platform_event_source.h"
#include "ui/ozone/public/cursor_factory_ozone.h"
#include "ui/ozone/public/event_factory_ozone.h"
-#include "ui/ozone/public/surface_factory_ozone.h"
+#include "ui/ozone/public/ozone_platform.h"
+#include "ui/platform_window/platform_window.h"
namespace aura {
WindowTreeHostOzone::WindowTreeHostOzone(const gfx::Rect& bounds)
- : widget_(0),
- bounds_(bounds) {
- ui::SurfaceFactoryOzone* surface_factory =
- ui::SurfaceFactoryOzone::GetInstance();
- widget_ = surface_factory->GetAcceleratedWidget();
-
+ : widget_(gfx::kNullAcceleratedWidget) {
+ platform_window_ =
+ ui::OzonePlatform::GetInstance()->CreatePlatformWindow(this, bounds);
ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this);
- CreateCompositor(GetAcceleratedWidget());
}
WindowTreeHostOzone::~WindowTreeHostOzone() {
@@ -44,6 +41,39 @@ uint32_t WindowTreeHostOzone::DispatchEvent(const ui::PlatformEvent& ne) {
return ui::POST_DISPATCH_STOP_PROPAGATION;
}
+void WindowTreeHostOzone::OnBoundsChanged(const gfx::Rect& new_bounds) {
+ // TOOD(spang): Should we determine which parts changed?
+ OnHostResized(new_bounds.size());
+ OnHostMoved(new_bounds.origin());
+}
+
+void WindowTreeHostOzone::OnDamageRect(const gfx::Rect& damaged_region) {
+}
+
+void WindowTreeHostOzone::DispatchEvent(ui::Event* event) {
+ SendEventToProcessor(event);
+}
+
+void WindowTreeHostOzone::OnCloseRequest() {
+ OnHostCloseRequested();
+}
+
+void WindowTreeHostOzone::OnClosed() {
+}
+
+void WindowTreeHostOzone::OnWindowStateChanged(
+ ui::PlatformWindowState new_state) {
+}
+
+void WindowTreeHostOzone::OnLostCapture() {
+}
+
+void WindowTreeHostOzone::OnAcceleratedWidgetAvailable(
+ gfx::AcceleratedWidget widget) {
+ widget_ = widget;
+ CreateCompositor(widget_);
+}
+
ui::EventSource* WindowTreeHostOzone::GetEventSource() {
return this;
}
@@ -52,29 +82,33 @@ gfx::AcceleratedWidget WindowTreeHostOzone::GetAcceleratedWidget() {
return widget_;
}
-void WindowTreeHostOzone::Show() { NOTIMPLEMENTED(); }
+void WindowTreeHostOzone::Show() {
+ platform_window_->Show();
+}
-void WindowTreeHostOzone::Hide() { NOTIMPLEMENTED(); }
+void WindowTreeHostOzone::Hide() {
+ platform_window_->Hide();
+}
-gfx::Rect WindowTreeHostOzone::GetBounds() const { return bounds_; }
+gfx::Rect WindowTreeHostOzone::GetBounds() const {
+ return platform_window_->GetBounds();
+}
void WindowTreeHostOzone::SetBounds(const gfx::Rect& bounds) {
- bool origin_changed = bounds_.origin() != bounds.origin();
- bool size_changed = bounds_.size() != bounds.size();
- bounds_ = bounds;
- if (size_changed)
- OnHostResized(bounds_.size());
- if (origin_changed)
- OnHostMoved(bounds_.origin());
+ platform_window_->SetBounds(bounds);
}
gfx::Point WindowTreeHostOzone::GetLocationOnNativeScreen() const {
- return bounds_.origin();
+ return platform_window_->GetBounds().origin();
}
-void WindowTreeHostOzone::SetCapture() { NOTIMPLEMENTED(); }
+void WindowTreeHostOzone::SetCapture() {
+ platform_window_->SetCapture();
+}
-void WindowTreeHostOzone::ReleaseCapture() { NOTIMPLEMENTED(); }
+void WindowTreeHostOzone::ReleaseCapture() {
+ platform_window_->ReleaseCapture();
+}
void WindowTreeHostOzone::PostNativeEvent(
const base::NativeEvent& native_event) {

Powered by Google App Engine
This is Rietveld 408576698