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/service_provider_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 | 10 |
11 using mojo::ConnectionContext; | 11 using mojo::ConnectionContext; |
12 using mojo::InterfaceRequest; | 12 using mojo::InterfaceRequest; |
13 | 13 |
14 namespace shell { | 14 namespace shell { |
15 | 15 |
16 NativeViewportApplicationLoader::NativeViewportApplicationLoader() { | 16 NativeViewportApplicationLoader::NativeViewportApplicationLoader() {} |
17 } | |
18 | 17 |
19 NativeViewportApplicationLoader::~NativeViewportApplicationLoader() { | 18 NativeViewportApplicationLoader::~NativeViewportApplicationLoader() {} |
20 } | |
21 | 19 |
22 void NativeViewportApplicationLoader::Load( | 20 void NativeViewportApplicationLoader::Load( |
23 const GURL& url, | 21 const GURL& url, |
24 InterfaceRequest<mojo::Application> application_request) { | 22 InterfaceRequest<mojo::Application> application_request) { |
25 DCHECK(application_request.is_pending()); | 23 DCHECK(application_request.is_pending()); |
26 app_.reset(new mojo::ApplicationImpl(this, application_request.Pass())); | 24 Bind(application_request.Pass()); |
27 } | 25 } |
28 | 26 |
29 bool NativeViewportApplicationLoader::ConfigureIncomingConnection( | 27 bool NativeViewportApplicationLoader::OnAcceptConnection( |
30 mojo::ServiceProviderImpl* service_provider_impl) { | 28 mojo::ServiceProviderImpl* service_provider_impl) { |
31 service_provider_impl->AddService<mojo::NativeViewport>( | 29 service_provider_impl->AddService<mojo::NativeViewport>( |
32 [this](const ConnectionContext& connection_context, | 30 [this](const ConnectionContext& connection_context, |
33 InterfaceRequest<mojo::NativeViewport> native_viewport_request) { | 31 InterfaceRequest<mojo::NativeViewport> native_viewport_request) { |
34 if (!gpu_state_) | 32 if (!gpu_state_) |
35 gpu_state_ = new gles2::GpuState(); | 33 gpu_state_ = new gles2::GpuState(); |
36 new native_viewport::NativeViewportImpl( | 34 new native_viewport::NativeViewportImpl(shell(), false, gpu_state_, |
37 app_->shell(), false, gpu_state_, native_viewport_request.Pass()); | 35 native_viewport_request.Pass()); |
38 }); | 36 }); |
39 service_provider_impl->AddService<mojo::Gpu>( | 37 service_provider_impl->AddService<mojo::Gpu>( |
40 [this](const ConnectionContext& connection_context, | 38 [this](const ConnectionContext& connection_context, |
41 InterfaceRequest<mojo::Gpu> gpu_request) { | 39 InterfaceRequest<mojo::Gpu> gpu_request) { |
42 if (!gpu_state_) | 40 if (!gpu_state_) |
43 gpu_state_ = new gles2::GpuState(); | 41 gpu_state_ = new gles2::GpuState(); |
44 new gles2::GpuImpl(gpu_request.Pass(), gpu_state_); | 42 new gles2::GpuImpl(gpu_request.Pass(), gpu_state_); |
45 }); | 43 }); |
46 return true; | 44 return true; |
47 } | 45 } |
48 | 46 |
49 } // namespace shell | 47 } // namespace shell |
OLD | NEW |