| 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/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 namespace examples { | 21 namespace examples { |
| 22 | 22 |
| 23 // static | 23 // static |
| 24 ui::ContextFactory* WindowTreeHostMojo::context_factory_ = NULL; | 24 ui::ContextFactory* WindowTreeHostMojo::context_factory_ = NULL; |
| 25 | 25 |
| 26 //////////////////////////////////////////////////////////////////////////////// | 26 //////////////////////////////////////////////////////////////////////////////// |
| 27 // WindowTreeHostMojo, public: | 27 // WindowTreeHostMojo, public: |
| 28 | 28 |
| 29 WindowTreeHostMojo::WindowTreeHostMojo( | 29 WindowTreeHostMojo::WindowTreeHostMojo( |
| 30 ScopedNativeViewportHandle viewport_handle, | 30 NativeViewportPtr viewport, |
| 31 const gfx::Rect& bounds, | 31 const gfx::Rect& bounds, |
| 32 const base::Callback<void()>& compositor_created_callback) | 32 const base::Callback<void()>& compositor_created_callback) |
| 33 : native_viewport_(viewport_handle.Pass(), this), | 33 : native_viewport_(viewport.Pass()), |
| 34 compositor_created_callback_(compositor_created_callback), | 34 compositor_created_callback_(compositor_created_callback), |
| 35 bounds_(bounds) { | 35 bounds_(bounds) { |
| 36 native_viewport_->SetClient(this); |
| 37 |
| 36 AllocationScope scope; | 38 AllocationScope scope; |
| 37 native_viewport_->Create(bounds); | 39 native_viewport_->Create(bounds); |
| 38 | 40 |
| 39 ScopedMessagePipeHandle gles2_client_handle; | 41 ScopedMessagePipeHandle gles2_client_handle; |
| 40 CreateMessagePipe(&gles2_handle_, &gles2_client_handle); | 42 CreateMessagePipe(&gles2_handle_, &gles2_client_handle); |
| 41 | 43 |
| 42 // The ContextFactory must exist before any Compositors are created. | 44 // The ContextFactory must exist before any Compositors are created. |
| 43 if (!context_factory_) { | 45 if (!context_factory_) { |
| 44 scoped_ptr<DemoContextFactory> cf(new DemoContextFactory(this)); | 46 scoped_ptr<DemoContextFactory> cf(new DemoContextFactory(this)); |
| 45 if (cf->Initialize()) | 47 if (cf->Initialize()) |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 SendEventToProcessor(&ev); | 169 SendEventToProcessor(&ev); |
| 168 break; | 170 break; |
| 169 } | 171 } |
| 170 // TODO(beng): touch, etc. | 172 // TODO(beng): touch, etc. |
| 171 } | 173 } |
| 172 callback.Run(); | 174 callback.Run(); |
| 173 }; | 175 }; |
| 174 | 176 |
| 175 } // namespace examples | 177 } // namespace examples |
| 176 } // namespace mojo | 178 } // namespace mojo |
| OLD | NEW |