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

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 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
« no previous file with comments | « ui/aura/window_tree_host_ozone.h ('k') | ui/ozone/DEPS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..010f633167d07cdd953c99a19a4c12bbd38fb7d0 100644
--- a/ui/aura/window_tree_host_ozone.cc
+++ b/ui/aura/window_tree_host_ozone.cc
@@ -5,43 +5,55 @@
#include "ui/aura/window_tree_host_ozone.h"
#include "ui/aura/window_event_dispatcher.h"
-#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();
-
- ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this);
- CreateCompositor(GetAcceleratedWidget());
+ : widget_(gfx::kNullAcceleratedWidget) {
+ platform_window_ =
+ ui::OzonePlatform::GetInstance()->CreatePlatformWindow(this, bounds);
}
WindowTreeHostOzone::~WindowTreeHostOzone() {
- ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this);
DestroyCompositor();
DestroyDispatcher();
}
-bool WindowTreeHostOzone::CanDispatchEvent(const ui::PlatformEvent& ne) {
- CHECK(ne);
- ui::Event* event = static_cast<ui::Event*>(ne);
- if (event->IsMouseEvent() || event->IsScrollEvent())
- return ui::CursorFactoryOzone::GetInstance()->GetCursorWindow() == widget_;
+void WindowTreeHostOzone::OnBoundsChanged(const gfx::Rect& new_bounds) {
+ // TOOD(spang): Should we determine which parts changed?
+ OnHostResized(new_bounds.size());
+ OnHostMoved(new_bounds.origin());
+}
- return true;
+void WindowTreeHostOzone::OnDamageRect(const gfx::Rect& damaged_region) {
}
-uint32_t WindowTreeHostOzone::DispatchEvent(const ui::PlatformEvent& ne) {
- ui::Event* event = static_cast<ui::Event*>(ne);
- ui::EventDispatchDetails details ALLOW_UNUSED = SendEventToProcessor(event);
- return ui::POST_DISPATCH_STOP_PROPAGATION;
+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() {
@@ -52,29 +64,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) {
« no previous file with comments | « ui/aura/window_tree_host_ozone.h ('k') | ui/ozone/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698