OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "shell/android/native_viewport_application_loader.h" | 5 #include "shell/android/native_viewport_application_loader.h" |
6 | 6 |
7 #include "mojo/public/cpp/application/application_impl.h" | 7 #include "mojo/public/cpp/application/application_impl.h" |
8 #include "services/gles2/gpu_state.h" | 8 #include "services/gles2/gpu_state.h" |
9 #include "services/native_viewport/native_viewport_impl.h" | 9 #include "services/native_viewport/native_viewport_impl.h" |
10 #include "shell/android/keyboard_impl.h" | 10 #include "shell/android/keyboard_impl.h" |
11 | 11 |
| 12 using mojo::ApplicationConnection; |
| 13 using mojo::InterfaceRequest; |
| 14 |
12 namespace shell { | 15 namespace shell { |
13 | 16 |
14 NativeViewportApplicationLoader::NativeViewportApplicationLoader() { | 17 NativeViewportApplicationLoader::NativeViewportApplicationLoader() { |
15 } | 18 } |
16 | 19 |
17 NativeViewportApplicationLoader::~NativeViewportApplicationLoader() { | 20 NativeViewportApplicationLoader::~NativeViewportApplicationLoader() { |
18 } | 21 } |
19 | 22 |
20 void NativeViewportApplicationLoader::Load( | 23 void NativeViewportApplicationLoader::Load( |
21 const GURL& url, | 24 const GURL& url, |
22 mojo::InterfaceRequest<mojo::Application> application_request) { | 25 InterfaceRequest<mojo::Application> application_request) { |
23 DCHECK(application_request.is_pending()); | 26 DCHECK(application_request.is_pending()); |
24 app_.reset(new mojo::ApplicationImpl(this, application_request.Pass())); | 27 app_.reset(new mojo::ApplicationImpl(this, application_request.Pass())); |
25 } | 28 } |
26 | 29 |
27 bool NativeViewportApplicationLoader::ConfigureIncomingConnection( | 30 bool NativeViewportApplicationLoader::ConfigureIncomingConnection( |
28 mojo::ApplicationConnection* connection) { | 31 ApplicationConnection* connection) { |
29 connection->AddService<mojo::NativeViewport>(this); | 32 connection->AddService<mojo::NativeViewport>(this); |
30 connection->AddService<mojo::Gpu>(this); | 33 connection->AddService<mojo::Gpu>(this); |
31 connection->AddService<mojo::Keyboard>(this); | 34 connection->AddService<mojo::Keyboard>(this); |
32 return true; | 35 return true; |
33 } | 36 } |
34 | 37 |
35 void NativeViewportApplicationLoader::Create( | 38 void NativeViewportApplicationLoader::Create( |
36 mojo::ApplicationConnection* connection, | 39 ApplicationConnection* connection, |
37 mojo::InterfaceRequest<mojo::NativeViewport> request) { | 40 InterfaceRequest<mojo::NativeViewport> request) { |
38 if (!gpu_state_) | 41 if (!gpu_state_) |
39 gpu_state_ = new gles2::GpuState; | 42 gpu_state_ = new gles2::GpuState; |
40 new native_viewport::NativeViewportImpl(false, gpu_state_, request.Pass()); | 43 new native_viewport::NativeViewportImpl(false, gpu_state_, request.Pass()); |
41 } | 44 } |
42 | 45 |
43 void NativeViewportApplicationLoader::Create( | 46 void NativeViewportApplicationLoader::Create( |
44 mojo::ApplicationConnection* connection, | 47 ApplicationConnection* connection, |
45 mojo::InterfaceRequest<mojo::Keyboard> request) { | 48 InterfaceRequest<mojo::Keyboard> request) { |
46 new KeyboardImpl(request.Pass()); | 49 new KeyboardImpl(request.Pass()); |
47 } | 50 } |
48 | 51 |
49 void NativeViewportApplicationLoader::Create( | 52 void NativeViewportApplicationLoader::Create( |
50 mojo::ApplicationConnection* connection, | 53 ApplicationConnection* connection, |
51 mojo::InterfaceRequest<mojo::Gpu> request) { | 54 InterfaceRequest<mojo::Gpu> request) { |
52 if (!gpu_state_) | 55 if (!gpu_state_) |
53 gpu_state_ = new gles2::GpuState; | 56 gpu_state_ = new gles2::GpuState; |
54 new gles2::GpuImpl(request.Pass(), gpu_state_); | 57 new gles2::GpuImpl(request.Pass(), gpu_state_); |
55 } | 58 } |
56 | 59 |
57 } // namespace shell | 60 } // namespace shell |
OLD | NEW |