Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(492)

Unified Diff: services/shell/public/cpp/connection.h

Issue 2419723002: Move services/shell to services/service_manager (Closed)
Patch Set: rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/shell/public/cpp/connect.h ('k') | services/shell/public/cpp/connector.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/shell/public/cpp/connection.h
diff --git a/services/shell/public/cpp/connection.h b/services/shell/public/cpp/connection.h
deleted file mode 100644
index 7dea805ffce7a449d6a14644542fec7c44833496..0000000000000000000000000000000000000000
--- a/services/shell/public/cpp/connection.h
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright 2014 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_CONNECTION_H_
-#define SERVICES_SHELL_PUBLIC_CPP_CONNECTION_H_
-
-#include "base/memory/weak_ptr.h"
-#include "services/shell/public/cpp/identity.h"
-#include "services/shell/public/cpp/interface_provider.h"
-#include "services/shell/public/interfaces/connector.mojom.h"
-
-namespace shell {
-
-class InterfaceProvider;
-
-// Represents a connection to another application. An implementation of this
-// interface is returned from Connector::Connect().
-class Connection {
- public:
- virtual ~Connection() {}
-
- enum class State {
- // The shell has not yet processed the connection.
- PENDING,
-
- // The shell processed the connection and it was established. GetResult()
- // returns mojom::ConnectionResult::SUCCESS.
- CONNECTED,
-
- // The shell processed the connection and establishment was prevented by
- // an error, call GetResult().
- DISCONNECTED
- };
-
- class TestApi {
- public:
- explicit TestApi(Connection* connection) : connection_(connection) {}
- base::WeakPtr<Connection> GetWeakPtr() {
- return connection_->GetWeakPtr();
- }
-
- private:
- Connection* connection_;
- };
-
- // Binds |ptr| to an implementation of Interface in the remote application.
- // |ptr| can immediately be used to start sending requests to the remote
- // interface.
- template <typename Interface>
- void GetInterface(mojo::InterfacePtr<Interface>* ptr) {
- GetRemoteInterfaces()->GetInterface(ptr);
- }
- template <typename Interface>
- void GetInterface(mojo::InterfaceRequest<Interface> request) {
- GetRemoteInterfaces()->GetInterface(std::move(request));
- }
-
- // Returns the remote identity. While the connection is in the pending state,
- // the user_id() field will be the value passed via Connect(). After the
- // connection is completed, it will change to the value assigned by the shell.
- // Call AddConnectionCompletedClosure() to schedule a closure to be run when
- // the resolved user id is available.
- virtual const Identity& GetRemoteIdentity() const = 0;
-
- // Register a handler to receive an error notification on the pipe to the
- // remote application's InterfaceProvider.
- virtual void SetConnectionLostClosure(const base::Closure& handler) = 0;
-
- // Returns the result of the connection. This function should only be called
- // when the connection state is not pending. Call
- // AddConnectionCompletedClosure() to schedule a closure to be run when the
- // connection is processed by the shell.
- virtual mojom::ConnectResult GetResult() const = 0;
-
- // Returns true if the connection has not yet been processed by the shell.
- virtual bool IsPending() const = 0;
-
- // Register a closure to be run when the connection has been completed by the
- // shell and remote metadata is available. Useful only for connections created
- // via Connector::Connect(). Once the connection is complete, metadata is
- // available immediately.
- virtual void AddConnectionCompletedClosure(const base::Closure& callback) = 0;
-
- // Returns an object encapsulating a remote InterfaceProvider.
- virtual InterfaceProvider* GetRemoteInterfaces() = 0;
-
- protected:
- virtual base::WeakPtr<Connection> GetWeakPtr() = 0;
-};
-
-} // namespace shell
-
-#endif // SERVICES_SHELL_PUBLIC_CPP_CONNECTION_H_
« no previous file with comments | « services/shell/public/cpp/connect.h ('k') | services/shell/public/cpp/connector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698