OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/aura/window_tree_host_ozone.h" | 5 #include "ui/aura/window_tree_host_ozone.h" |
6 | 6 |
7 #include "ui/aura/window_event_dispatcher.h" | 7 #include "ui/aura/window_event_dispatcher.h" |
8 #include "ui/base/cursor/ozone/cursor_factory_ozone.h" | 8 #include "ui/base/cursor/ozone/cursor_factory_ozone.h" |
9 #include "ui/events/ozone/event_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" | 10 #include "ui/gfx/ozone/surface_factory_ozone.h" |
12 | 11 |
13 namespace aura { | 12 namespace aura { |
14 | 13 |
15 WindowTreeHostOzone::WindowTreeHostOzone(const gfx::Rect& bounds) | 14 WindowTreeHostOzone::WindowTreeHostOzone(const gfx::Rect& bounds) |
16 : widget_(0), | 15 : widget_(0), |
17 bounds_(bounds) { | 16 bounds_(bounds) { |
18 gfx::SurfaceFactoryOzone* surface_factory = | 17 gfx::SurfaceFactoryOzone* surface_factory = |
19 gfx::SurfaceFactoryOzone::GetInstance(); | 18 gfx::SurfaceFactoryOzone::GetInstance(); |
20 widget_ = surface_factory->GetAcceleratedWidget(); | 19 widget_ = surface_factory->CreatePlatformWindow(this); |
21 | 20 |
22 ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this); | |
23 CreateCompositor(GetAcceleratedWidget()); | 21 CreateCompositor(GetAcceleratedWidget()); |
24 } | 22 } |
25 | 23 |
26 WindowTreeHostOzone::~WindowTreeHostOzone() { | 24 WindowTreeHostOzone::~WindowTreeHostOzone() { |
27 ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this); | |
28 DestroyCompositor(); | 25 DestroyCompositor(); |
29 DestroyDispatcher(); | 26 DestroyDispatcher(); |
30 } | 27 } |
31 | 28 |
32 bool WindowTreeHostOzone::CanDispatchEvent(const ui::PlatformEvent& ne) { | |
33 CHECK(ne); | |
34 ui::Event* event = static_cast<ui::Event*>(ne); | |
35 if (event->IsMouseEvent() || event->IsScrollEvent()) | |
36 return ui::CursorFactoryOzone::GetInstance()->GetCursorWindow() == widget_; | |
37 | |
38 return true; | |
39 } | |
40 | |
41 uint32_t WindowTreeHostOzone::DispatchEvent(const ui::PlatformEvent& ne) { | |
42 ui::Event* event = static_cast<ui::Event*>(ne); | |
43 ui::EventDispatchDetails details ALLOW_UNUSED = SendEventToProcessor(event); | |
44 return ui::POST_DISPATCH_STOP_PROPAGATION; | |
45 } | |
46 | |
47 ui::EventSource* WindowTreeHostOzone::GetEventSource() { | 29 ui::EventSource* WindowTreeHostOzone::GetEventSource() { |
48 return this; | 30 return this; |
49 } | 31 } |
50 | 32 |
51 gfx::AcceleratedWidget WindowTreeHostOzone::GetAcceleratedWidget() { | 33 gfx::AcceleratedWidget WindowTreeHostOzone::GetAcceleratedWidget() { |
52 return widget_; | 34 return widget_; |
53 } | 35 } |
54 | 36 |
55 void WindowTreeHostOzone::Show() { NOTIMPLEMENTED(); } | 37 void WindowTreeHostOzone::Show() { NOTIMPLEMENTED(); } |
56 | 38 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 } | 79 } |
98 | 80 |
99 void WindowTreeHostOzone::OnCursorVisibilityChangedNative(bool show) { | 81 void WindowTreeHostOzone::OnCursorVisibilityChangedNative(bool show) { |
100 NOTIMPLEMENTED(); | 82 NOTIMPLEMENTED(); |
101 } | 83 } |
102 | 84 |
103 ui::EventProcessor* WindowTreeHostOzone::GetEventProcessor() { | 85 ui::EventProcessor* WindowTreeHostOzone::GetEventProcessor() { |
104 return dispatcher(); | 86 return dispatcher(); |
105 } | 87 } |
106 | 88 |
| 89 void WindowTreeHostOzone::OnBoundsChanged(const gfx::Rect& new_bounds) { |
| 90 } |
| 91 |
| 92 void WindowTreeHostOzone::OnDamageRect(const gfx::Rect& damaged_region) { |
| 93 } |
| 94 |
| 95 void WindowTreeHostOzone::DispatchEvent(ui::Event* event) { |
| 96 ignore_result(SendEventToProcessor(event)); |
| 97 } |
| 98 |
| 99 void WindowTreeHostOzone::OnCloseRequest() { |
| 100 } |
| 101 |
| 102 void WindowTreeHostOzone::OnClosed() { |
| 103 } |
| 104 |
| 105 void WindowTreeHostOzone::OnWindowStateChanged( |
| 106 ui::PlatformWindowState new_state) { |
| 107 } |
| 108 |
| 109 void WindowTreeHostOzone::OnLostCapture() { |
| 110 } |
| 111 |
107 // static | 112 // static |
108 WindowTreeHost* WindowTreeHost::Create(const gfx::Rect& bounds) { | 113 WindowTreeHost* WindowTreeHost::Create(const gfx::Rect& bounds) { |
109 return new WindowTreeHostOzone(bounds); | 114 return new WindowTreeHostOzone(bounds); |
110 } | 115 } |
111 | 116 |
112 // static | 117 // static |
113 gfx::Size WindowTreeHost::GetNativeScreenSize() { | 118 gfx::Size WindowTreeHost::GetNativeScreenSize() { |
114 NOTIMPLEMENTED(); | 119 NOTIMPLEMENTED(); |
115 return gfx::Size(); | 120 return gfx::Size(); |
116 } | 121 } |
117 | 122 |
118 } // namespace aura | 123 } // namespace aura |
OLD | NEW |