| Index: services/shell/public/cpp/connector.h
|
| diff --git a/services/shell/public/cpp/connector.h b/services/shell/public/cpp/connector.h
|
| deleted file mode 100644
|
| index 30e4aa6b39c3e292f564751e1aae8d0e822c0468..0000000000000000000000000000000000000000
|
| --- a/services/shell/public/cpp/connector.h
|
| +++ /dev/null
|
| @@ -1,113 +0,0 @@
|
| -// Copyright 2016 The Chromium Authors. All rights reserved.
|
| -// Use of this source code is governed by a BSD-style license that can be
|
| -// found in the LICENSE file.
|
| -
|
| -#ifndef SERVICES_SHELL_PUBLIC_CPP_CONNECTOR_H_
|
| -#define SERVICES_SHELL_PUBLIC_CPP_CONNECTOR_H_
|
| -
|
| -#include <memory>
|
| -
|
| -#include "services/shell/public/cpp/connection.h"
|
| -#include "services/shell/public/cpp/identity.h"
|
| -#include "services/shell/public/interfaces/connector.mojom.h"
|
| -#include "services/shell/public/interfaces/service.mojom.h"
|
| -#include "services/shell/public/interfaces/service_manager.mojom.h"
|
| -
|
| -namespace shell {
|
| -
|
| -// An interface that encapsulates the Mojo Shell's broker interface by which
|
| -// connections between applications are established. Once Connect() is called,
|
| -// this class is bound to the thread the call was made on and it cannot be
|
| -// passed to another thread without calling Clone().
|
| -// An instance of this class is created internally by ServiceContext for use
|
| -// on the thread ServiceContext is instantiated on, and this interface is
|
| -// wrapped by the Shell interface.
|
| -// To use this interface on other threads, call Shell::CloneConnector() and
|
| -// pass the result to another thread. To pass to subsequent threads, call
|
| -// Clone() on instances of this object.
|
| -// While instances of this object are owned by the caller, the underlying
|
| -// connection with the shell is bound to the lifetime of the instance that
|
| -// created it, i.e. when the application is terminated the Connector pipe is
|
| -// closed.
|
| -class Connector {
|
| - public:
|
| - virtual ~Connector() {}
|
| -
|
| - class ConnectParams {
|
| - public:
|
| - explicit ConnectParams(const Identity& target);
|
| - explicit ConnectParams(const std::string& name);
|
| - ~ConnectParams();
|
| -
|
| - const Identity& target() { return target_; }
|
| - void set_target(const Identity& target) { target_ = target; }
|
| - void set_client_process_connection(
|
| - mojom::ServicePtr service,
|
| - mojom::PIDReceiverRequest pid_receiver_request) {
|
| - service_ = std::move(service);
|
| - pid_receiver_request_ = std::move(pid_receiver_request);
|
| - }
|
| - void TakeClientProcessConnection(
|
| - mojom::ServicePtr* service,
|
| - mojom::PIDReceiverRequest* pid_receiver_request) {
|
| - *service = std::move(service_);
|
| - *pid_receiver_request = std::move(pid_receiver_request_);
|
| - }
|
| - InterfaceProvider* remote_interfaces() { return remote_interfaces_; }
|
| - void set_remote_interfaces(InterfaceProvider* remote_interfaces) {
|
| - remote_interfaces_ = remote_interfaces;
|
| - }
|
| -
|
| - private:
|
| - Identity target_;
|
| - mojom::ServicePtr service_;
|
| - mojom::PIDReceiverRequest pid_receiver_request_;
|
| - InterfaceProvider* remote_interfaces_ = nullptr;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(ConnectParams);
|
| - };
|
| -
|
| - // Creates a new Connector instance and fills in |*request| with a request
|
| - // for the other end the Connector's interface.
|
| - static std::unique_ptr<Connector> Create(mojom::ConnectorRequest* request);
|
| -
|
| - // Requests a new connection to an application. Returns a pointer to the
|
| - // connection if the connection is permitted by this application's delegate,
|
| - // or nullptr otherwise. Caller takes ownership.
|
| - // Once this method is called, this object is bound to the thread on which the
|
| - // call took place. To pass to another thread, call Clone() and pass the
|
| - // result.
|
| - virtual std::unique_ptr<Connection> Connect(const std::string& name) = 0;
|
| - virtual std::unique_ptr<Connection> Connect(ConnectParams* params) = 0;
|
| -
|
| - // Connect to application identified by |request->name| and connect to the
|
| - // service implementation of the interface identified by |Interface|.
|
| - template <typename Interface>
|
| - void ConnectToInterface(ConnectParams* params,
|
| - mojo::InterfacePtr<Interface>* ptr) {
|
| - std::unique_ptr<Connection> connection = Connect(params);
|
| - if (connection)
|
| - connection->GetInterface(ptr);
|
| - }
|
| - template <typename Interface>
|
| - void ConnectToInterface(const Identity& target,
|
| - mojo::InterfacePtr<Interface>* ptr) {
|
| - ConnectParams params(target);
|
| - return ConnectToInterface(¶ms, ptr);
|
| - }
|
| - template <typename Interface>
|
| - void ConnectToInterface(const std::string& name,
|
| - mojo::InterfacePtr<Interface>* ptr) {
|
| - ConnectParams params(name);
|
| - return ConnectToInterface(¶ms, ptr);
|
| - }
|
| -
|
| - // Creates a new instance of this class which may be passed to another thread.
|
| - // The returned object may be passed multiple times until Connect() is called,
|
| - // at which point this method must be called again to pass again.
|
| - virtual std::unique_ptr<Connector> Clone() = 0;
|
| -};
|
| -
|
| -} // namespace shell
|
| -
|
| -#endif // SERVICES_SHELL_PUBLIC_CPP_CONNECTOR_H_
|
|
|