1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ui/aura/window_tree_host_ozone.h"
7 #include "ui/aura/window_event_dispatcher.h"
8 #include "ui/ozone/public/ozone_platform.h"
9 #include "ui/platform_window/platform_window.h"
13 WindowTreeHostOzone::WindowTreeHostOzone(const gfx::Rect
& bounds
)
14 : widget_(gfx::kNullAcceleratedWidget
) {
16 ui::OzonePlatform::GetInstance()->CreatePlatformWindow(this, bounds
);
19 WindowTreeHostOzone::~WindowTreeHostOzone() {
24 void WindowTreeHostOzone::OnBoundsChanged(const gfx::Rect
& new_bounds
) {
25 // TOOD(spang): Should we determine which parts changed?
26 OnHostResized(new_bounds
.size());
27 OnHostMoved(new_bounds
.origin());
30 void WindowTreeHostOzone::OnDamageRect(const gfx::Rect
& damaged_region
) {
33 void WindowTreeHostOzone::DispatchEvent(ui::Event
* event
) {
34 SendEventToProcessor(event
);
37 void WindowTreeHostOzone::OnCloseRequest() {
38 OnHostCloseRequested();
41 void WindowTreeHostOzone::OnClosed() {
44 void WindowTreeHostOzone::OnWindowStateChanged(
45 ui::PlatformWindowState new_state
) {
48 void WindowTreeHostOzone::OnLostCapture() {
51 void WindowTreeHostOzone::OnAcceleratedWidgetAvailable(
52 gfx::AcceleratedWidget widget
) {
54 CreateCompositor(widget_
);
57 void WindowTreeHostOzone::OnActivationChanged(bool active
) {
60 ui::EventSource
* WindowTreeHostOzone::GetEventSource() {
64 gfx::AcceleratedWidget
WindowTreeHostOzone::GetAcceleratedWidget() {
68 void WindowTreeHostOzone::Show() {
69 platform_window_
->Show();
72 void WindowTreeHostOzone::Hide() {
73 platform_window_
->Hide();
76 gfx::Rect
WindowTreeHostOzone::GetBounds() const {
77 return platform_window_
->GetBounds();
80 void WindowTreeHostOzone::SetBounds(const gfx::Rect
& bounds
) {
81 platform_window_
->SetBounds(bounds
);
84 gfx::Point
WindowTreeHostOzone::GetLocationOnNativeScreen() const {
85 return platform_window_
->GetBounds().origin();
88 void WindowTreeHostOzone::SetCapture() {
89 platform_window_
->SetCapture();
92 void WindowTreeHostOzone::ReleaseCapture() {
93 platform_window_
->ReleaseCapture();
96 void WindowTreeHostOzone::SetCursorNative(gfx::NativeCursor cursor
) {
97 platform_window_
->SetCursor(cursor
.platform());
100 void WindowTreeHostOzone::MoveCursorToNative(const gfx::Point
& location
) {
101 platform_window_
->MoveCursorTo(location
);
104 void WindowTreeHostOzone::OnCursorVisibilityChangedNative(bool show
) {
108 ui::EventProcessor
* WindowTreeHostOzone::GetEventProcessor() {
113 WindowTreeHost
* WindowTreeHost::Create(const gfx::Rect
& bounds
) {
114 return new WindowTreeHostOzone(bounds
);
118 gfx::Size
WindowTreeHost::GetNativeScreenSize() {