Adds more logging for audio input issues.
[chromium-blink-merge.git] / ui / aura / window_tree_host_ozone.cc
blob0a01e426d787afd0929684d0d8d20434e1b9a791
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/base/cursor/ozone/cursor_factory_ozone.h"
9 #include "ui/events/ozone/event_factory_ozone.h"
10 #include "ui/events/platform/platform_event_source.h"
11 #include "ui/gfx/ozone/surface_factory_ozone.h"
12 #include "ui/ozone/ozone_platform.h"
14 namespace aura {
16 WindowTreeHostOzone::WindowTreeHostOzone(const gfx::Rect& bounds)
17 : widget_(0),
18 bounds_(bounds) {
19 ui::OzonePlatform::Initialize();
21 // EventFactoryOzone creates converters that obtain input events from the
22 // underlying input system and dispatch them as |ui::Event| instances into
23 // Aura.
24 ui::EventFactoryOzone::GetInstance()->StartProcessingEvents();
26 gfx::SurfaceFactoryOzone* surface_factory =
27 gfx::SurfaceFactoryOzone::GetInstance();
28 widget_ = surface_factory->GetAcceleratedWidget();
30 ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this);
31 CreateCompositor(GetAcceleratedWidget());
34 WindowTreeHostOzone::~WindowTreeHostOzone() {
35 ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this);
36 DestroyCompositor();
37 DestroyDispatcher();
40 bool WindowTreeHostOzone::CanDispatchEvent(const ui::PlatformEvent& ne) {
41 CHECK(ne);
42 ui::Event* event = static_cast<ui::Event*>(ne);
43 if (event->IsMouseEvent() || event->IsScrollEvent() || event->IsTouchEvent())
44 return bounds_.Contains(static_cast<ui::LocatedEvent*>(event)->location());
45 return true;
48 uint32_t WindowTreeHostOzone::DispatchEvent(const ui::PlatformEvent& ne) {
49 ui::Event* event = static_cast<ui::Event*>(ne);
50 ui::EventDispatchDetails details ALLOW_UNUSED = SendEventToProcessor(event);
51 return ui::POST_DISPATCH_STOP_PROPAGATION;
54 gfx::AcceleratedWidget WindowTreeHostOzone::GetAcceleratedWidget() {
55 return widget_;
58 void WindowTreeHostOzone::Show() { NOTIMPLEMENTED(); }
60 void WindowTreeHostOzone::Hide() { NOTIMPLEMENTED(); }
62 void WindowTreeHostOzone::ToggleFullScreen() { NOTIMPLEMENTED(); }
64 gfx::Rect WindowTreeHostOzone::GetBounds() const { return bounds_; }
66 void WindowTreeHostOzone::SetBounds(const gfx::Rect& bounds) {
67 NOTIMPLEMENTED();
70 gfx::Insets WindowTreeHostOzone::GetInsets() const { return gfx::Insets(); }
72 void WindowTreeHostOzone::SetInsets(const gfx::Insets& insets) {
73 NOTIMPLEMENTED();
76 gfx::Point WindowTreeHostOzone::GetLocationOnNativeScreen() const {
77 return bounds_.origin();
80 void WindowTreeHostOzone::SetCapture() { NOTIMPLEMENTED(); }
82 void WindowTreeHostOzone::ReleaseCapture() { NOTIMPLEMENTED(); }
84 bool WindowTreeHostOzone::QueryMouseLocation(gfx::Point* location_return) {
85 NOTIMPLEMENTED();
86 return false;
89 bool WindowTreeHostOzone::ConfineCursorToRootWindow() {
90 NOTIMPLEMENTED();
91 return false;
94 void WindowTreeHostOzone::UnConfineCursor() { NOTIMPLEMENTED(); }
96 void WindowTreeHostOzone::PostNativeEvent(
97 const base::NativeEvent& native_event) {
98 NOTIMPLEMENTED();
101 void WindowTreeHostOzone::OnDeviceScaleFactorChanged(
102 float device_scale_factor) {
103 NOTIMPLEMENTED();
106 void WindowTreeHostOzone::SetCursorNative(gfx::NativeCursor cursor) {
107 ui::CursorFactoryOzone::GetInstance()->SetCursor(GetAcceleratedWidget(),
108 cursor.platform());
111 void WindowTreeHostOzone::MoveCursorToNative(const gfx::Point& location) {
112 ui::EventFactoryOzone::GetInstance()->WarpCursorTo(GetAcceleratedWidget(),
113 location);
116 void WindowTreeHostOzone::OnCursorVisibilityChangedNative(bool show) {
117 NOTIMPLEMENTED();
120 ui::EventProcessor* WindowTreeHostOzone::GetEventProcessor() {
121 return dispatcher();
124 // static
125 WindowTreeHost* WindowTreeHost::Create(const gfx::Rect& bounds) {
126 return new WindowTreeHostOzone(bounds);
129 // static
130 gfx::Size WindowTreeHost::GetNativeScreenSize() {
131 NOTIMPLEMENTED();
132 return gfx::Size();
135 } // namespace aura