URLFetcherNullWriter for resource requests.
[chromium-blink-merge.git] / ui / aura / window_tree_host_ozone.cc
blob8671e3a682920240d914f1f2ab3ebc475f1e6466
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 "base/trace_event/trace_event.h"
8 #include "ui/aura/window_event_dispatcher.h"
9 #include "ui/ozone/public/ozone_platform.h"
10 #include "ui/platform_window/platform_window.h"
12 namespace aura {
14 WindowTreeHostOzone::WindowTreeHostOzone(const gfx::Rect& bounds)
15 : widget_(gfx::kNullAcceleratedWidget), current_cursor_(ui::kCursorNull) {
16 platform_window_ =
17 ui::OzonePlatform::GetInstance()->CreatePlatformWindow(this, bounds);
20 WindowTreeHostOzone::~WindowTreeHostOzone() {
21 DestroyCompositor();
22 DestroyDispatcher();
25 ui::EventSource* WindowTreeHostOzone::GetEventSource() {
26 return this;
29 gfx::AcceleratedWidget WindowTreeHostOzone::GetAcceleratedWidget() {
30 return widget_;
33 void WindowTreeHostOzone::ShowImpl() {
34 platform_window_->Show();
37 void WindowTreeHostOzone::HideImpl() {
38 platform_window_->Hide();
41 gfx::Rect WindowTreeHostOzone::GetBounds() const {
42 return platform_window_->GetBounds();
45 void WindowTreeHostOzone::SetBounds(const gfx::Rect& bounds) {
46 platform_window_->SetBounds(bounds);
49 gfx::Point WindowTreeHostOzone::GetLocationOnNativeScreen() const {
50 return platform_window_->GetBounds().origin();
53 void WindowTreeHostOzone::SetCapture() {
54 platform_window_->SetCapture();
57 void WindowTreeHostOzone::ReleaseCapture() {
58 platform_window_->ReleaseCapture();
61 void WindowTreeHostOzone::SetCursorNative(gfx::NativeCursor cursor) {
62 if (cursor == current_cursor_)
63 return;
64 current_cursor_ = cursor;
65 platform_window_->SetCursor(cursor.platform());
68 void WindowTreeHostOzone::MoveCursorToNative(const gfx::Point& location) {
69 platform_window_->MoveCursorTo(location);
72 void WindowTreeHostOzone::OnCursorVisibilityChangedNative(bool show) {
75 void WindowTreeHostOzone::OnBoundsChanged(const gfx::Rect& new_bounds) {
76 // TOOD(spang): Should we determine which parts changed?
77 OnHostResized(new_bounds.size());
78 OnHostMoved(new_bounds.origin());
81 void WindowTreeHostOzone::OnDamageRect(const gfx::Rect& damaged_region) {
84 void WindowTreeHostOzone::DispatchEvent(ui::Event* event) {
85 TRACE_EVENT0("input", "WindowTreeHostOzone::DispatchEvent");
86 SendEventToProcessor(event);
89 void WindowTreeHostOzone::OnCloseRequest() {
90 OnHostCloseRequested();
93 void WindowTreeHostOzone::OnClosed() {
96 void WindowTreeHostOzone::OnWindowStateChanged(
97 ui::PlatformWindowState new_state) {
100 void WindowTreeHostOzone::OnLostCapture() {
103 void WindowTreeHostOzone::OnAcceleratedWidgetAvailable(
104 gfx::AcceleratedWidget widget,
105 float device_pixel_ratio) {
106 widget_ = widget;
107 CreateCompositor(widget_);
110 void WindowTreeHostOzone::OnActivationChanged(bool active) {
113 // static
114 WindowTreeHost* WindowTreeHost::Create(const gfx::Rect& bounds) {
115 return new WindowTreeHostOzone(bounds);
118 // static
119 gfx::Size WindowTreeHost::GetNativeScreenSize() {
120 NOTIMPLEMENTED();
121 return gfx::Size();
124 } // namespace aura