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/at_exit.h" | 8 #include "base/at_exit.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | 110 |
111 DISALLOW_COPY_AND_ASSIGN(DemoWindowTreeClient); | 111 DISALLOW_COPY_AND_ASSIGN(DemoWindowTreeClient); |
112 }; | 112 }; |
113 | 113 |
114 class AuraDemo : public Application { | 114 class AuraDemo : public Application { |
115 public: | 115 public: |
116 explicit AuraDemo(MojoHandle shell_handle) : Application(shell_handle) { | 116 explicit AuraDemo(MojoHandle shell_handle) : Application(shell_handle) { |
117 screen_.reset(ScreenMojo::Create()); | 117 screen_.reset(ScreenMojo::Create()); |
118 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_.get()); | 118 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_.get()); |
119 | 119 |
120 InterfacePipe<NativeViewport, AnyInterface> pipe; | 120 NativeViewportPtr native_viewport; |
| 121 ConnectTo("mojo:mojo_native_viewport_service", &native_viewport); |
121 | 122 |
122 mojo::AllocationScope scope; | |
123 shell()->Connect("mojo:mojo_native_viewport_service", | |
124 pipe.handle_to_peer.Pass()); | |
125 window_tree_host_.reset(new WindowTreeHostMojo( | 123 window_tree_host_.reset(new WindowTreeHostMojo( |
126 pipe.handle_to_self.Pass(), | 124 native_viewport.Pass(), |
127 gfx::Rect(800, 600), | 125 gfx::Rect(800, 600), |
128 base::Bind(&AuraDemo::HostContextCreated, base::Unretained(this)))); | 126 base::Bind(&AuraDemo::HostContextCreated, base::Unretained(this)))); |
129 } | 127 } |
130 | 128 |
131 private: | 129 private: |
132 void HostContextCreated() { | 130 void HostContextCreated() { |
133 window_tree_host_->InitHost(); | 131 window_tree_host_->InitHost(); |
134 | 132 |
135 window_tree_client_.reset( | 133 window_tree_client_.reset( |
136 new DemoWindowTreeClient(window_tree_host_->window())); | 134 new DemoWindowTreeClient(window_tree_host_->window())); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 | 184 |
187 // TODO(beng): This crashes in a DCHECK on X11 because this thread's | 185 // TODO(beng): This crashes in a DCHECK on X11 because this thread's |
188 // MessageLoop is not of TYPE_UI. I think we need a way to build | 186 // MessageLoop is not of TYPE_UI. I think we need a way to build |
189 // Aura that doesn't define platform-specific stuff. | 187 // Aura that doesn't define platform-specific stuff. |
190 aura::Env::CreateInstance(true); | 188 aura::Env::CreateInstance(true); |
191 mojo::examples::AuraDemo app(shell_handle); | 189 mojo::examples::AuraDemo app(shell_handle); |
192 loop.Run(); | 190 loop.Run(); |
193 | 191 |
194 return MOJO_RESULT_OK; | 192 return MOJO_RESULT_OK; |
195 } | 193 } |
OLD | NEW |