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