| Index: services/shell/public/cpp/lib/connector_impl.cc
|
| diff --git a/services/shell/public/cpp/lib/connector_impl.cc b/services/shell/public/cpp/lib/connector_impl.cc
|
| index a04348bf031ced491da6cf882905532a386ea489..1bd9e68924ceae8ffc2601469b9afb26974e2ee9 100644
|
| --- a/services/shell/public/cpp/lib/connector_impl.cc
|
| +++ b/services/shell/public/cpp/lib/connector_impl.cc
|
| @@ -4,31 +4,36 @@
|
|
|
| #include "services/shell/public/cpp/lib/connector_impl.h"
|
|
|
| +#include "base/memory/ptr_util.h"
|
| #include "services/shell/public/cpp/identity.h"
|
| #include "services/shell/public/cpp/lib/connection_impl.h"
|
|
|
| -namespace mojo {
|
| +namespace shell {
|
|
|
| Connector::ConnectParams::ConnectParams(const Identity& target)
|
| : target_(target) {}
|
| +
|
| Connector::ConnectParams::ConnectParams(const std::string& name)
|
| - : target_(name, shell::mojom::kInheritUserID) {}
|
| + : target_(name, mojom::kInheritUserID) {}
|
| +
|
| Connector::ConnectParams::~ConnectParams() {}
|
|
|
| -ConnectorImpl::ConnectorImpl(shell::mojom::ConnectorPtrInfo unbound_state)
|
| +ConnectorImpl::ConnectorImpl(mojom::ConnectorPtrInfo unbound_state)
|
| : unbound_state_(std::move(unbound_state)) {}
|
| -ConnectorImpl::ConnectorImpl(shell::mojom::ConnectorPtr connector)
|
| +
|
| +ConnectorImpl::ConnectorImpl(mojom::ConnectorPtr connector)
|
| : connector_(std::move(connector)) {
|
| thread_checker_.reset(new base::ThreadChecker);
|
| }
|
| +
|
| ConnectorImpl::~ConnectorImpl() {}
|
|
|
| -scoped_ptr<Connection> ConnectorImpl::Connect(const std::string& name) {
|
| +std::unique_ptr<Connection> ConnectorImpl::Connect(const std::string& name) {
|
| ConnectParams params(name);
|
| return Connect(¶ms);
|
| }
|
|
|
| -scoped_ptr<Connection> ConnectorImpl::Connect(ConnectParams* params) {
|
| +std::unique_ptr<Connection> ConnectorImpl::Connect(ConnectParams* params) {
|
| // Bind this object to the current thread the first time it is used to
|
| // connect.
|
| if (!connector_.is_bound()) {
|
| @@ -48,23 +53,22 @@ scoped_ptr<Connection> ConnectorImpl::Connect(ConnectParams* params) {
|
| // a position to know who we're talking to.
|
| CapabilityRequest request;
|
| request.interfaces.insert("*");
|
| - shell::mojom::InterfaceProviderPtr local_interfaces;
|
| - shell::mojom::InterfaceProviderRequest local_request =
|
| - GetProxy(&local_interfaces);
|
| - shell::mojom::InterfaceProviderPtr remote_interfaces;
|
| - shell::mojom::InterfaceProviderRequest remote_request =
|
| - GetProxy(&remote_interfaces);
|
| - scoped_ptr<internal::ConnectionImpl> registry(new internal::ConnectionImpl(
|
| - params->target().name(), params->target(),
|
| - shell::mojom::kInvalidInstanceID, std::move(remote_interfaces),
|
| - std::move(local_request), request, Connection::State::PENDING));
|
| + mojom::InterfaceProviderPtr local_interfaces;
|
| + mojom::InterfaceProviderRequest local_request = GetProxy(&local_interfaces);
|
| + mojom::InterfaceProviderPtr remote_interfaces;
|
| + mojom::InterfaceProviderRequest remote_request = GetProxy(&remote_interfaces);
|
| + std::unique_ptr<internal::ConnectionImpl> registry(
|
| + new internal::ConnectionImpl(
|
| + params->target().name(), params->target(), mojom::kInvalidInstanceID,
|
| + std::move(remote_interfaces), std::move(local_request), request,
|
| + Connection::State::PENDING));
|
|
|
| - shell::mojom::ShellClientPtr shell_client;
|
| - shell::mojom::PIDReceiverRequest pid_receiver_request;
|
| + mojom::ShellClientPtr shell_client;
|
| + mojom::PIDReceiverRequest pid_receiver_request;
|
| params->TakeClientProcessConnection(&shell_client, &pid_receiver_request);
|
| - shell::mojom::ClientProcessConnectionPtr client_process_connection;
|
| + mojom::ClientProcessConnectionPtr client_process_connection;
|
| if (shell_client.is_bound() && pid_receiver_request.is_pending()) {
|
| - client_process_connection = shell::mojom::ClientProcessConnection::New();
|
| + client_process_connection = mojom::ClientProcessConnection::New();
|
| client_process_connection->shell_client =
|
| shell_client.PassInterface().PassHandle();
|
| client_process_connection->pid_receiver_request =
|
| @@ -74,18 +78,17 @@ scoped_ptr<Connection> ConnectorImpl::Connect(ConnectParams* params) {
|
| << "both must be valid.";
|
| return std::move(registry);
|
| }
|
| - connector_->Connect(
|
| - shell::mojom::Identity::From(params->target()),
|
| - std::move(remote_request), std::move(local_interfaces),
|
| - std::move(client_process_connection), registry->GetConnectCallback());
|
| + connector_->Connect(mojom::Identity::From(params->target()),
|
| + std::move(remote_request), std::move(local_interfaces),
|
| + std::move(client_process_connection),
|
| + registry->GetConnectCallback());
|
| return std::move(registry);
|
| }
|
|
|
| -scoped_ptr<Connector> ConnectorImpl::Clone() {
|
| - shell::mojom::ConnectorPtr connector;
|
| +std::unique_ptr<Connector> ConnectorImpl::Clone() {
|
| + mojom::ConnectorPtr connector;
|
| connector_->Clone(GetProxy(&connector));
|
| - return make_scoped_ptr(
|
| - new ConnectorImpl(connector.PassInterface()));
|
| + return base::WrapUnique(new ConnectorImpl(connector.PassInterface()));
|
| }
|
|
|
| -} // namespace mojo
|
| +} // namespace shell
|
|
|