| 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 <stdio.h> | 5 #include <stdio.h> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "mojo/common/bindings_support_impl.h" | 9 #include "mojo/common/bindings_support_impl.h" |
| 10 #include "mojo/examples/aura_demo/demo_screen.h" | 10 #include "mojo/examples/aura_demo/demo_screen.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 118 |
| 119 class AuraDemo : public ShellClient { | 119 class AuraDemo : public ShellClient { |
| 120 public: | 120 public: |
| 121 explicit AuraDemo(ScopedMessagePipeHandle shell_handle) | 121 explicit AuraDemo(ScopedMessagePipeHandle shell_handle) |
| 122 : shell_(shell_handle.Pass(), this) { | 122 : shell_(shell_handle.Pass(), this) { |
| 123 screen_.reset(DemoScreen::Create()); | 123 screen_.reset(DemoScreen::Create()); |
| 124 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_.get()); | 124 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_.get()); |
| 125 | 125 |
| 126 mojo::ScopedMessagePipeHandle client_handle, native_viewport_handle; | 126 mojo::ScopedMessagePipeHandle client_handle, native_viewport_handle; |
| 127 CreateMessagePipe(&client_handle, &native_viewport_handle); | 127 CreateMessagePipe(&client_handle, &native_viewport_handle); |
| 128 root_window_host_.reset(new RootWindowHostMojo( | 128 root_window_host_.reset(new WindowTreeHostMojo( |
| 129 native_viewport_handle.Pass(), | 129 native_viewport_handle.Pass(), |
| 130 base::Bind(&AuraDemo::HostContextCreated, base::Unretained(this)))); | 130 base::Bind(&AuraDemo::HostContextCreated, base::Unretained(this)))); |
| 131 mojo::AllocationScope scope; | 131 mojo::AllocationScope scope; |
| 132 shell_->Connect("mojo:mojo_native_viewport_service", client_handle.Pass()); | 132 shell_->Connect("mojo:mojo_native_viewport_service", client_handle.Pass()); |
| 133 } | 133 } |
| 134 | 134 |
| 135 virtual void AcceptConnection(ScopedMessagePipeHandle handle) MOJO_OVERRIDE { | 135 virtual void AcceptConnection(ScopedMessagePipeHandle handle) MOJO_OVERRIDE { |
| 136 NOTREACHED() << "AuraDemo can't be connected to."; | 136 NOTREACHED() << "AuraDemo can't be connected to."; |
| 137 } | 137 } |
| 138 | 138 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 | 176 |
| 177 scoped_ptr<DemoWindowDelegate> delegate1_; | 177 scoped_ptr<DemoWindowDelegate> delegate1_; |
| 178 scoped_ptr<DemoWindowDelegate> delegate2_; | 178 scoped_ptr<DemoWindowDelegate> delegate2_; |
| 179 scoped_ptr<DemoWindowDelegate> delegate21_; | 179 scoped_ptr<DemoWindowDelegate> delegate21_; |
| 180 | 180 |
| 181 aura::Window* window1_; | 181 aura::Window* window1_; |
| 182 aura::Window* window2_; | 182 aura::Window* window2_; |
| 183 aura::Window* window21_; | 183 aura::Window* window21_; |
| 184 | 184 |
| 185 mojo::RemotePtr<Shell> shell_; | 185 mojo::RemotePtr<Shell> shell_; |
| 186 scoped_ptr<RootWindowHostMojo> root_window_host_; | 186 scoped_ptr<WindowTreeHostMojo> root_window_host_; |
| 187 scoped_ptr<aura::RootWindow> root_window_; | 187 scoped_ptr<aura::RootWindow> root_window_; |
| 188 }; | 188 }; |
| 189 | 189 |
| 190 } // namespace examples | 190 } // namespace examples |
| 191 } // namespace mojo | 191 } // namespace mojo |
| 192 | 192 |
| 193 extern "C" AURA_DEMO_EXPORT MojoResult CDECL MojoMain( | 193 extern "C" AURA_DEMO_EXPORT MojoResult CDECL MojoMain( |
| 194 MojoHandle shell_handle) { | 194 MojoHandle shell_handle) { |
| 195 base::MessageLoop loop; | 195 base::MessageLoop loop; |
| 196 mojo::common::BindingsSupportImpl bindings_support_impl; | 196 mojo::common::BindingsSupportImpl bindings_support_impl; |
| 197 mojo::BindingsSupport::Set(&bindings_support_impl); | 197 mojo::BindingsSupport::Set(&bindings_support_impl); |
| 198 MojoGLES2Initialize(); | 198 MojoGLES2Initialize(); |
| 199 | 199 |
| 200 // TODO(beng): This crashes in a DCHECK on X11 because this thread's | 200 // TODO(beng): This crashes in a DCHECK on X11 because this thread's |
| 201 // MessageLoop is not of TYPE_UI. I think we need a way to build | 201 // MessageLoop is not of TYPE_UI. I think we need a way to build |
| 202 // Aura that doesn't define platform-specific stuff. | 202 // Aura that doesn't define platform-specific stuff. |
| 203 aura::Env::CreateInstance(); | 203 aura::Env::CreateInstance(); |
| 204 mojo::examples::AuraDemo app( | 204 mojo::examples::AuraDemo app( |
| 205 mojo::MakeScopedHandle(mojo::MessagePipeHandle(shell_handle)).Pass()); | 205 mojo::MakeScopedHandle(mojo::MessagePipeHandle(shell_handle)).Pass()); |
| 206 loop.Run(); | 206 loop.Run(); |
| 207 | 207 |
| 208 MojoGLES2Terminate(); | 208 MojoGLES2Terminate(); |
| 209 mojo::BindingsSupport::Set(NULL); | 209 mojo::BindingsSupport::Set(NULL); |
| 210 return MOJO_RESULT_OK; | 210 return MOJO_RESULT_OK; |
| 211 } | 211 } |
| OLD | NEW |