OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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 "components/core_services/core_services_application_delegate.h" |
| 6 |
| 7 #include "components/clipboard/clipboard_standalone_impl.h" |
| 8 #include "third_party/mojo/src/mojo/public/cpp/application/application_connectio
n.h" |
| 9 |
| 10 namespace core_services { |
| 11 |
| 12 CoreServicesApplicationDelegate::CoreServicesApplicationDelegate() {} |
| 13 |
| 14 CoreServicesApplicationDelegate::~CoreServicesApplicationDelegate() {} |
| 15 |
| 16 bool CoreServicesApplicationDelegate::ConfigureIncomingConnection( |
| 17 mojo::ApplicationConnection* connection) { |
| 18 // TODO(erg): For version one, we'll just say that all incoming connections |
| 19 // get access to the same objects, which imply that there will be one |
| 20 // instance of the service in its own process. However, in the long run, |
| 21 // we'll want this to be more configurable. Some services are singletons, |
| 22 // while we'll want to spawn a new process with multiple instances for other |
| 23 // services. |
| 24 connection->AddService<mojo::ServiceProvider>(this); |
| 25 return true; |
| 26 } |
| 27 |
| 28 void CoreServicesApplicationDelegate::Create( |
| 29 mojo::ApplicationConnection* connection, |
| 30 mojo::InterfaceRequest<ServiceProvider> request) { |
| 31 provider_bindings_.AddBinding(this, request.Pass()); |
| 32 } |
| 33 |
| 34 void CoreServicesApplicationDelegate::ConnectToService( |
| 35 const mojo::String& service_name, |
| 36 mojo::ScopedMessagePipeHandle client_handle) { |
| 37 if (service_name == mojo::Clipboard::Name_) { |
| 38 // TODO(erg): So what we do here probably doesn't look like the |
| 39 // InProcessNativeRunner / NativeApplicationSupport. |
| 40 // native_application_support.cc does the whole SetThunks() stuff. This has |
| 41 // already happened since Core Services is a mojo application. So we want |
| 42 // some sort of lightweight runner here. |
| 43 // |
| 44 // But...the actual child process stuff is its own mojom! (Also, it's |
| 45 // entangled with mojo::Shell::ChildProcessMain().) All concept of app |
| 46 // paths are the things which are used to execute the application in |
| 47 // child_process.cc. |
| 48 |
| 49 // TODO(erg): The lifetime of ClipboardStandaloneImpl is wrong. Right now, |
| 50 // a new object is made for each request, but we obviously want there to be |
| 51 // one clipboard across all callers. |
| 52 new clipboard::ClipboardStandaloneImpl( |
| 53 mojo::MakeRequest<mojo::Clipboard>(client_handle.Pass())); |
| 54 } |
| 55 } |
| 56 |
| 57 } // namespace core_services |
OLD | NEW |