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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 } | 109 } |
110 | 110 |
111 private: | 111 private: |
112 aura::Window* window_; | 112 aura::Window* window_; |
113 | 113 |
114 scoped_ptr<aura::client::DefaultCaptureClient> capture_client_; | 114 scoped_ptr<aura::client::DefaultCaptureClient> capture_client_; |
115 | 115 |
116 DISALLOW_COPY_AND_ASSIGN(DemoWindowTreeClient); | 116 DISALLOW_COPY_AND_ASSIGN(DemoWindowTreeClient); |
117 }; | 117 }; |
118 | 118 |
119 class AuraDemo : public ShellClientStub { | 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()) { | 122 : shell_(shell_handle.Pass(), this) { |
123 shell_.SetPeer(this); | |
124 | |
125 screen_.reset(DemoScreen::Create()); | 123 screen_.reset(DemoScreen::Create()); |
126 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_.get()); | 124 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_.get()); |
127 | 125 |
128 mojo::ScopedMessagePipeHandle client_handle, native_viewport_handle; | 126 mojo::ScopedMessagePipeHandle client_handle, native_viewport_handle; |
129 CreateMessagePipe(&client_handle, &native_viewport_handle); | 127 CreateMessagePipe(&client_handle, &native_viewport_handle); |
130 root_window_host_.reset(new RootWindowHostMojo( | 128 root_window_host_.reset(new RootWindowHostMojo( |
131 native_viewport_handle.Pass(), | 129 native_viewport_handle.Pass(), |
132 base::Bind(&AuraDemo::HostContextCreated, base::Unretained(this)))); | 130 base::Bind(&AuraDemo::HostContextCreated, base::Unretained(this)))); |
133 mojo::AllocationScope scope; | 131 mojo::AllocationScope scope; |
134 shell_->Connect("mojo:mojo_native_viewport_service", client_handle.Pass()); | 132 shell_->Connect("mojo:mojo_native_viewport_service", client_handle.Pass()); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 // Aura that doesn't define platform-specific stuff. | 202 // Aura that doesn't define platform-specific stuff. |
205 aura::Env::CreateInstance(); | 203 aura::Env::CreateInstance(); |
206 mojo::examples::AuraDemo app( | 204 mojo::examples::AuraDemo app( |
207 mojo::MakeScopedHandle(mojo::MessagePipeHandle(shell_handle)).Pass()); | 205 mojo::MakeScopedHandle(mojo::MessagePipeHandle(shell_handle)).Pass()); |
208 loop.Run(); | 206 loop.Run(); |
209 | 207 |
210 MojoGLES2Terminate(); | 208 MojoGLES2Terminate(); |
211 mojo::BindingsSupport::Set(NULL); | 209 mojo::BindingsSupport::Set(NULL); |
212 return MOJO_RESULT_OK; | 210 return MOJO_RESULT_OK; |
213 } | 211 } |
OLD | NEW |