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

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

Issue 1882423004: Move shell service to toplevel shell namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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/shell_client.h ('k') | services/shell/public/cpp/shell_test.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/shell/public/cpp/shell_connection.h
diff --git a/services/shell/public/cpp/shell_connection.h b/services/shell/public/cpp/shell_connection.h
index a92c93038078ccc070bb06e8777db96d3093373a..84aae0daae91e748a1feb3483809eaf28cd3abde 100644
--- a/services/shell/public/cpp/shell_connection.h
+++ b/services/shell/public/cpp/shell_connection.h
@@ -5,6 +5,7 @@
#ifndef SERVICES_SHELL_PUBLIC_CPP_SHELL_CONNECTION_H_
#define SERVICES_SHELL_PUBLIC_CPP_SHELL_CONNECTION_H_
+#include <memory>
#include <utility>
#include <vector>
@@ -18,38 +19,37 @@
#include "services/shell/public/interfaces/connector.mojom.h"
#include "services/shell/public/interfaces/shell_client.mojom.h"
-namespace mojo {
+namespace shell {
class Connector;
// Encapsulates a connection to the Mojo Shell in two parts:
-// - a bound InterfacePtr to mojo::shell::mojom::Shell, the primary mechanism
+// - a bound InterfacePtr to mojom::Shell, the primary mechanism
// by which the instantiating application interacts with other services
// brokered by the Mojo Shell.
-// - a bound InterfaceRequest of mojo::shell::mojom::ShellClient, an interface
+// - a bound InterfaceRequest of mojom::ShellClient, an interface
// used by the Mojo Shell to inform this application of lifecycle events and
// inbound connections brokered by it.
//
// This class should be used in two scenarios:
-// - During early startup to bind the mojo::shell::mojom::ShellClientRequest
-// obtained from the Mojo Shell. This is typically in response to either
-// MojoMain() or main().
-// - In an implementation of mojo::shell::mojom::ContentHandler to bind the
-// mojo::shell::mojom::ShellClientRequest passed via StartApplication. In this
-// scenario there can be many instances of this class per process.
+// - During early startup to bind the mojom::ShellClientRequest obtained from
+// the Mojo Shell, typically in response to either MojoMain() or main().
+// - In an implementation of mojom::ShellClientFactory to bind the
+// mojom::ShellClientRequest passed via StartApplication. In this scenario
+// there can be many instances of this class per process.
//
// Instances of this class are constructed with an implementation of the Shell
-// Client Lib's mojo::ShellClient interface. See documentation in shell_client.h
+// Client Lib's ShellClient interface. See documentation in shell_client.h
// for details.
//
-class ShellConnection : public shell::mojom::ShellClient {
+class ShellConnection : public mojom::ShellClient {
public:
// Creates a new ShellConnection bound to |request|. This connection may be
// used immediately to make outgoing connections via connector(). Does not
// take ownership of |client|, which must remain valid for the lifetime of
// ShellConnection.
- ShellConnection(mojo::ShellClient* client,
- shell::mojom::ShellClientRequest request);
+ ShellConnection(shell::ShellClient* client,
+ mojom::ShellClientRequest request);
~ShellConnection() override;
@@ -59,7 +59,7 @@ class ShellConnection : public shell::mojom::ShellClient {
void set_initialize_handler(const base::Closure& callback);
// TODO(rockot): Remove this once we get rid of app tests.
- void SetAppTestConnectorForTesting(shell::mojom::ConnectorPtr connector);
+ void SetAppTestConnectorForTesting(mojom::ConnectorPtr connector);
// Specify a function to be called when the connection to the shell is lost.
void set_connection_lost_closure(const base::Closure& closure) {
@@ -67,39 +67,38 @@ class ShellConnection : public shell::mojom::ShellClient {
}
private:
- // shell::mojom::ShellClient:
- void Initialize(shell::mojom::IdentityPtr identity,
- uint32_t id,
- const InitializeCallback& callback) override;
- void AcceptConnection(
- shell::mojom::IdentityPtr source,
- uint32_t source_id,
- shell::mojom::InterfaceProviderRequest remote_interfaces,
- shell::mojom::InterfaceProviderPtr local_interfaces,
- shell::mojom::CapabilityRequestPtr allowed_capabilities,
- const String& name) override;
+ // mojom::ShellClient:
+ void Initialize(mojom::IdentityPtr identity,
+ uint32_t id,
+ const InitializeCallback& callback) override;
+ void AcceptConnection(mojom::IdentityPtr source,
+ uint32_t source_id,
+ mojom::InterfaceProviderRequest remote_interfaces,
+ mojom::InterfaceProviderPtr local_interfaces,
+ mojom::CapabilityRequestPtr allowed_capabilities,
+ const mojo::String& name) override;
- void OnConnectionError();
+ void OnConnectionError();
- // A callback called when Initialize() is run.
- base::Closure initialize_handler_;
+ // A callback called when Initialize() is run.
+ base::Closure initialize_handler_;
- // We track the lifetime of incoming connection registries as it more
- // convenient for the client.
- ScopedVector<Connection> incoming_connections_;
+ // We track the lifetime of incoming connection registries as it more
+ // convenient for the client.
+ ScopedVector<Connection> incoming_connections_;
- // A pending Connector request which will eventually be passed to the shell.
- shell::mojom::ConnectorRequest pending_connector_request_;
+ // A pending Connector request which will eventually be passed to the shell.
+ mojom::ConnectorRequest pending_connector_request_;
- mojo::ShellClient* client_;
- Binding<shell::mojom::ShellClient> binding_;
- scoped_ptr<Connector> connector_;
+ shell::ShellClient* client_;
+ mojo::Binding<mojom::ShellClient> binding_;
+ std::unique_ptr<Connector> connector_;
- base::Closure connection_lost_closure_;
+ base::Closure connection_lost_closure_;
- DISALLOW_COPY_AND_ASSIGN(ShellConnection);
+ DISALLOW_COPY_AND_ASSIGN(ShellConnection);
};
-} // namespace mojo
+} // namespace shell
#endif // SERVICES_SHELL_PUBLIC_CPP_SHELL_CONNECTION_H_
« no previous file with comments | « services/shell/public/cpp/shell_client.h ('k') | services/shell/public/cpp/shell_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698