OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "mojo/examples/aura_demo/window_tree_host_mojo.h" | 5 #include "mojo/examples/aura_demo/window_tree_host_mojo.h" |
6 | 6 |
7 #include "mojo/examples/aura_demo/demo_context_factory.h" | 7 #include "mojo/examples/aura_demo/demo_context_factory.h" |
8 #include "mojo/public/bindings/allocation_scope.h" | 8 #include "mojo/public/bindings/allocation_scope.h" |
9 #include "mojo/public/gles2/gles2.h" | 9 #include "mojo/public/gles2/gles2.h" |
10 #include "mojo/services/native_viewport/geometry_conversions.h" | 10 #include "mojo/services/native_viewport/geometry_conversions.h" |
11 #include "ui/aura/env.h" | 11 #include "ui/aura/env.h" |
12 #include "ui/aura/window.h" | 12 #include "ui/aura/window.h" |
13 #include "ui/aura/window_tree_host_delegate.h" | 13 #include "ui/aura/window_event_dispatcher.h" |
14 #include "ui/compositor/compositor.h" | 14 #include "ui/compositor/compositor.h" |
15 #include "ui/events/event.h" | 15 #include "ui/events/event.h" |
16 #include "ui/events/event_constants.h" | 16 #include "ui/events/event_constants.h" |
17 #include "ui/gfx/geometry/insets.h" | 17 #include "ui/gfx/geometry/insets.h" |
18 #include "ui/gfx/geometry/rect.h" | 18 #include "ui/gfx/geometry/rect.h" |
19 | 19 |
20 namespace mojo { | 20 namespace mojo { |
21 namespace examples { | 21 namespace examples { |
22 | 22 |
23 // static | 23 // static |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 } | 141 } |
142 | 142 |
143 void WindowTreeHostMojo::OnCursorVisibilityChangedNative(bool show) { | 143 void WindowTreeHostMojo::OnCursorVisibilityChangedNative(bool show) { |
144 NOTIMPLEMENTED(); | 144 NOTIMPLEMENTED(); |
145 } | 145 } |
146 | 146 |
147 //////////////////////////////////////////////////////////////////////////////// | 147 //////////////////////////////////////////////////////////////////////////////// |
148 // WindowTreeHostMojo, ui::EventSource implementation: | 148 // WindowTreeHostMojo, ui::EventSource implementation: |
149 | 149 |
150 ui::EventProcessor* WindowTreeHostMojo::GetEventProcessor() { | 150 ui::EventProcessor* WindowTreeHostMojo::GetEventProcessor() { |
151 return delegate_->GetEventProcessor(); | 151 return dispatcher(); |
152 } | 152 } |
153 | 153 |
154 //////////////////////////////////////////////////////////////////////////////// | 154 //////////////////////////////////////////////////////////////////////////////// |
155 // WindowTreeHostMojo, NativeViewportClient implementation: | 155 // WindowTreeHostMojo, NativeViewportClient implementation: |
156 | 156 |
157 void WindowTreeHostMojo::OnCreated() { | 157 void WindowTreeHostMojo::OnCreated() { |
158 CreateCompositor(GetAcceleratedWidget()); | 158 CreateCompositor(GetAcceleratedWidget()); |
159 compositor_created_callback_.Run(); | 159 compositor_created_callback_.Run(); |
160 } | 160 } |
161 | 161 |
162 void WindowTreeHostMojo::OnBoundsChanged(const Rect& bounds) { | 162 void WindowTreeHostMojo::OnBoundsChanged(const Rect& bounds) { |
163 bounds_ = gfx::Rect(bounds.position().x(), bounds.position().y(), | 163 bounds_ = gfx::Rect(bounds.position().x(), bounds.position().y(), |
164 bounds.size().width(), bounds.size().height()); | 164 bounds.size().width(), bounds.size().height()); |
165 if (delegate_) | 165 window()->SetBounds(gfx::Rect(bounds_.size())); |
166 window()->SetBounds(gfx::Rect(bounds_.size())); | |
167 OnHostResized(bounds_.size()); | 166 OnHostResized(bounds_.size()); |
168 } | 167 } |
169 | 168 |
170 void WindowTreeHostMojo::OnDestroyed() { | 169 void WindowTreeHostMojo::OnDestroyed() { |
171 base::MessageLoop::current()->Quit(); | 170 base::MessageLoop::current()->Quit(); |
172 } | 171 } |
173 | 172 |
174 void WindowTreeHostMojo::OnEvent(const Event& event) { | 173 void WindowTreeHostMojo::OnEvent(const Event& event) { |
175 if (!event.location().is_null()) | 174 if (!event.location().is_null()) |
176 native_viewport_->AckEvent(event); | 175 native_viewport_->AckEvent(event); |
(...skipping 19 matching lines...) Expand all Loading... |
196 event.flags(), event.key_data().is_char()); | 195 event.flags(), event.key_data().is_char()); |
197 SendEventToProcessor(&ev); | 196 SendEventToProcessor(&ev); |
198 break; | 197 break; |
199 } | 198 } |
200 // TODO(beng): touch, etc. | 199 // TODO(beng): touch, etc. |
201 } | 200 } |
202 }; | 201 }; |
203 | 202 |
204 } // namespace examples | 203 } // namespace examples |
205 } // namespace mojo | 204 } // namespace mojo |
OLD | NEW |