| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "services/shell/public/cpp/lib/connector_impl.h" | 5 #include "services/shell/public/cpp/lib/connector_impl.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "services/shell/public/cpp/identity.h" | 8 #include "services/shell/public/cpp/identity.h" |
| 9 #include "services/shell/public/cpp/lib/connection_impl.h" | 9 #include "services/shell/public/cpp/lib/connection_impl.h" |
| 10 | 10 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 return Connect(¶ms); | 41 return Connect(¶ms); |
| 42 } | 42 } |
| 43 | 43 |
| 44 std::unique_ptr<Connection> ConnectorImpl::Connect(ConnectParams* params) { | 44 std::unique_ptr<Connection> ConnectorImpl::Connect(ConnectParams* params) { |
| 45 if (!BindIfNecessary()) | 45 if (!BindIfNecessary()) |
| 46 return nullptr; | 46 return nullptr; |
| 47 | 47 |
| 48 DCHECK(thread_checker_.CalledOnValidThread()); | 48 DCHECK(thread_checker_.CalledOnValidThread()); |
| 49 DCHECK(params); | 49 DCHECK(params); |
| 50 | 50 |
| 51 // We allow all interfaces on outgoing connections since we are presumably in | |
| 52 // a position to know who we're talking to. | |
| 53 CapabilityRequest request; | |
| 54 request.interfaces.insert("*"); | |
| 55 mojom::InterfaceProviderPtr remote_interfaces; | 51 mojom::InterfaceProviderPtr remote_interfaces; |
| 56 mojom::InterfaceProviderRequest remote_request = GetProxy(&remote_interfaces); | 52 mojom::InterfaceProviderRequest remote_request = GetProxy(&remote_interfaces); |
| 57 std::unique_ptr<internal::ConnectionImpl> connection( | 53 std::unique_ptr<internal::ConnectionImpl> connection( |
| 58 new internal::ConnectionImpl(params->target(), request, | 54 new internal::ConnectionImpl(params->target(), |
| 59 Connection::State::PENDING)); | 55 Connection::State::PENDING)); |
| 60 if (params->remote_interfaces()) { | 56 if (params->remote_interfaces()) { |
| 61 params->remote_interfaces()->Bind(std::move(remote_interfaces)); | 57 params->remote_interfaces()->Bind(std::move(remote_interfaces)); |
| 62 connection->set_remote_interfaces(params->remote_interfaces()); | 58 connection->set_remote_interfaces(params->remote_interfaces()); |
| 63 } else { | 59 } else { |
| 64 std::unique_ptr<InterfaceProvider> remote_interface_provider( | 60 std::unique_ptr<InterfaceProvider> remote_interface_provider( |
| 65 new InterfaceProvider); | 61 new InterfaceProvider); |
| 66 remote_interface_provider->Bind(std::move(remote_interfaces)); | 62 remote_interface_provider->Bind(std::move(remote_interfaces)); |
| 67 connection->SetRemoteInterfaces(std::move(remote_interface_provider)); | 63 connection->SetRemoteInterfaces(std::move(remote_interface_provider)); |
| 68 } | 64 } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 return true; | 117 return true; |
| 122 } | 118 } |
| 123 | 119 |
| 124 std::unique_ptr<Connector> Connector::Create(mojom::ConnectorRequest* request) { | 120 std::unique_ptr<Connector> Connector::Create(mojom::ConnectorRequest* request) { |
| 125 mojom::ConnectorPtr proxy; | 121 mojom::ConnectorPtr proxy; |
| 126 *request = mojo::GetProxy(&proxy); | 122 *request = mojo::GetProxy(&proxy); |
| 127 return base::MakeUnique<ConnectorImpl>(proxy.PassInterface()); | 123 return base::MakeUnique<ConnectorImpl>(proxy.PassInterface()); |
| 128 } | 124 } |
| 129 | 125 |
| 130 } // namespace shell | 126 } // namespace shell |
| OLD | NEW |