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/aura/window_tree_host_mojo.h" | 5 #include "mojo/aura/window_tree_host_mojo.h" |
6 | 6 |
7 #include "mojo/aura/context_factory_mojo.h" | 7 #include "mojo/aura/context_factory_mojo.h" |
8 #include "mojo/public/c/gles2/gles2.h" | 8 #include "mojo/public/c/gles2/gles2.h" |
9 #include "mojo/public/cpp/bindings/allocation_scope.h" | 9 #include "mojo/public/cpp/bindings/allocation_scope.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_event_dispatcher.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 | 21 |
22 // static | 22 // static |
23 mojo::ContextFactoryMojo* WindowTreeHostMojo::context_factory_ = NULL; | 23 mojo::ContextFactoryMojo* WindowTreeHostMojo::context_factory_ = NULL; |
24 | 24 |
25 //////////////////////////////////////////////////////////////////////////////// | 25 //////////////////////////////////////////////////////////////////////////////// |
26 // WindowTreeHostMojo, public: | 26 // WindowTreeHostMojo, public: |
27 | 27 |
28 WindowTreeHostMojo::WindowTreeHostMojo( | 28 WindowTreeHostMojo::WindowTreeHostMojo( |
29 ScopedNativeViewportHandle viewport_handle, | 29 NativeViewportPtr viewport, |
30 const gfx::Rect& bounds, | 30 const gfx::Rect& bounds, |
31 const base::Callback<void()>& compositor_created_callback) | 31 const base::Callback<void()>& compositor_created_callback) |
32 : native_viewport_(viewport_handle.Pass(), this), | 32 : native_viewport_(viewport.Pass()), |
33 compositor_created_callback_(compositor_created_callback), | 33 compositor_created_callback_(compositor_created_callback), |
34 bounds_(bounds) { | 34 bounds_(bounds) { |
| 35 native_viewport_->SetClient(this); |
| 36 |
35 AllocationScope scope; | 37 AllocationScope scope; |
36 native_viewport_->Create(bounds); | 38 native_viewport_->Create(bounds); |
37 | 39 |
38 ScopedMessagePipeHandle gles2_handle, gles2_client_handle; | 40 ScopedMessagePipeHandle gles2_handle, gles2_client_handle; |
39 CreateMessagePipe(&gles2_handle, &gles2_client_handle); | 41 CreateMessagePipe(&gles2_handle, &gles2_client_handle); |
40 | 42 |
41 // The ContextFactory must exist before any Compositors are created. | 43 // The ContextFactory must exist before any Compositors are created. |
42 if (context_factory_) { | 44 if (context_factory_) { |
43 ui::ContextFactory::SetInstance(NULL); | 45 ui::ContextFactory::SetInstance(NULL); |
44 delete context_factory_; | 46 delete context_factory_; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 event.flags(), event.key_data().is_char()); | 171 event.flags(), event.key_data().is_char()); |
170 SendEventToProcessor(&ev); | 172 SendEventToProcessor(&ev); |
171 break; | 173 break; |
172 } | 174 } |
173 // TODO(beng): touch, etc. | 175 // TODO(beng): touch, etc. |
174 } | 176 } |
175 callback.Run(); | 177 callback.Run(); |
176 }; | 178 }; |
177 | 179 |
178 } // namespace mojo | 180 } // namespace mojo |
OLD | NEW |