| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef SERVICES_SHELL_PUBLIC_CPP_CONNECTION_H_ | 5 #ifndef SERVICES_SHELL_PUBLIC_CPP_CONNECTION_H_ |
| 6 #define SERVICES_SHELL_PUBLIC_CPP_CONNECTION_H_ | 6 #define SERVICES_SHELL_PUBLIC_CPP_CONNECTION_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 #include <utility> | 11 #include <utility> |
| 12 | 12 |
| 13 #include "base/callback_forward.h" |
| 13 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 14 #include "services/shell/public/cpp/connect.h" | 15 #include "services/shell/public/cpp/connect.h" |
| 15 #include "services/shell/public/cpp/identity.h" | 16 #include "services/shell/public/cpp/identity.h" |
| 16 #include "services/shell/public/cpp/interface_registry.h" | 17 #include "services/shell/public/cpp/interface_registry.h" |
| 17 #include "services/shell/public/cpp/remote_interface_registry.h" | 18 #include "services/shell/public/cpp/remote_interface_registry.h" |
| 18 #include "services/shell/public/interfaces/connector.mojom.h" | 19 #include "services/shell/public/interfaces/connector.mojom.h" |
| 19 #include "services/shell/public/interfaces/interface_provider.mojom.h" | 20 #include "services/shell/public/interfaces/interface_provider.mojom.h" |
| 20 | 21 |
| 21 namespace shell { | 22 namespace shell { |
| 22 | 23 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 // time this function is called. When IsPending() returns true, this function | 128 // time this function is called. When IsPending() returns true, this function |
| 128 // will return mojom::kInvalidInstanceID. Use | 129 // will return mojom::kInvalidInstanceID. Use |
| 129 // AddConnectionCompletedClosure() to schedule a closure to be run when the | 130 // AddConnectionCompletedClosure() to schedule a closure to be run when the |
| 130 // connection is processed by the shell and remote id is available. | 131 // connection is processed by the shell and remote id is available. |
| 131 virtual uint32_t GetRemoteInstanceID() const = 0; | 132 virtual uint32_t GetRemoteInstanceID() const = 0; |
| 132 | 133 |
| 133 // Register a closure to be run when the connection has been completed by the | 134 // Register a closure to be run when the connection has been completed by the |
| 134 // shell and remote metadata is available. Useful only for connections created | 135 // shell and remote metadata is available. Useful only for connections created |
| 135 // via Connector::Connect(). Once the connection is complete, metadata is | 136 // via Connector::Connect(). Once the connection is complete, metadata is |
| 136 // available immediately. | 137 // available immediately. |
| 137 virtual void AddConnectionCompletedClosure(const mojo::Closure& callback) = 0; | 138 virtual void AddConnectionCompletedClosure(const base::Closure& callback) = 0; |
| 138 | 139 |
| 139 // Returns true if the Shell allows |interface_name| to be exposed to the | 140 // Returns true if the Shell allows |interface_name| to be exposed to the |
| 140 // remote application. | 141 // remote application. |
| 141 virtual bool AllowsInterface(const std::string& interface_name) const = 0; | 142 virtual bool AllowsInterface(const std::string& interface_name) const = 0; |
| 142 | 143 |
| 143 // Returns a raw pointer to the InterfaceProvider at the remote end. | 144 // Returns a raw pointer to the InterfaceProvider at the remote end. |
| 144 virtual mojom::InterfaceProvider* GetRemoteInterfaceProvider() = 0; | 145 virtual mojom::InterfaceProvider* GetRemoteInterfaceProvider() = 0; |
| 145 | 146 |
| 146 protected: | 147 protected: |
| 147 // Returns the InterfaceRegistry that implements the mojom::InterfaceProvider | 148 // Returns the InterfaceRegistry that implements the mojom::InterfaceProvider |
| 148 // exposed to the remote application. | 149 // exposed to the remote application. |
| 149 virtual InterfaceRegistry* GetInterfaceRegistry() = 0; | 150 virtual InterfaceRegistry* GetInterfaceRegistry() = 0; |
| 150 | 151 |
| 151 // Returns an object encapsulating a remote InterfaceProvider. | 152 // Returns an object encapsulating a remote InterfaceProvider. |
| 152 virtual RemoteInterfaceRegistry* GetRemoteInterfaceRegistry() = 0; | 153 virtual RemoteInterfaceRegistry* GetRemoteInterfaceRegistry() = 0; |
| 153 | 154 |
| 154 virtual base::WeakPtr<Connection> GetWeakPtr() = 0; | 155 virtual base::WeakPtr<Connection> GetWeakPtr() = 0; |
| 155 }; | 156 }; |
| 156 | 157 |
| 157 } // namespace shell | 158 } // namespace shell |
| 158 | 159 |
| 159 #endif // SERVICES_SHELL_PUBLIC_CPP_CONNECTION_H_ | 160 #endif // SERVICES_SHELL_PUBLIC_CPP_CONNECTION_H_ |
| OLD | NEW |