Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / mojo / application / public / cpp / lib / service_provider_impl.cc
blob3d6ee6ed9708c585a2df7a9520a42d6a7257c5a9
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.
5 #include "mojo/application/public/cpp/service_provider_impl.h"
7 #include "mojo/application/public/cpp/service_connector.h"
8 #include "mojo/public/cpp/environment/logging.h"
10 namespace mojo {
12 ServiceProviderImpl::ServiceProviderImpl() : binding_(this) {
15 ServiceProviderImpl::ServiceProviderImpl(
16 InterfaceRequest<ServiceProvider> request)
17 : binding_(this, request.Pass()) {
20 ServiceProviderImpl::~ServiceProviderImpl() {
23 void ServiceProviderImpl::Bind(InterfaceRequest<ServiceProvider> request) {
24 binding_.Bind(request.Pass());
27 void ServiceProviderImpl::Close() {
28 if (binding_.is_bound())
29 binding_.Close();
32 void ServiceProviderImpl::ConnectToService(
33 const String& service_name,
34 ScopedMessagePipeHandle client_handle) {
35 // TODO(beng): perhaps take app connection thru ctor so that we can pass
36 // ApplicationConnection through?
37 service_connector_registry_.ConnectToService(nullptr, service_name,
38 client_handle.Pass());
41 void ServiceProviderImpl::SetServiceConnectorForName(
42 ServiceConnector* service_connector,
43 const std::string& interface_name) {
44 service_connector_registry_.SetServiceConnectorForName(service_connector,
45 interface_name);
48 } // namespace mojo