| 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> |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 callback, task_runner); | 83 callback, task_runner); |
| 84 } | 84 } |
| 85 | 85 |
| 86 // Binds |ptr| to an implementation of Interface in the remote application. | 86 // Binds |ptr| to an implementation of Interface in the remote application. |
| 87 // |ptr| can immediately be used to start sending requests to the remote | 87 // |ptr| can immediately be used to start sending requests to the remote |
| 88 // interface. | 88 // interface. |
| 89 template <typename Interface> | 89 template <typename Interface> |
| 90 void GetInterface(mojo::InterfacePtr<Interface>* ptr) { | 90 void GetInterface(mojo::InterfacePtr<Interface>* ptr) { |
| 91 GetRemoteInterfaces()->GetInterface(ptr); | 91 GetRemoteInterfaces()->GetInterface(ptr); |
| 92 } | 92 } |
| 93 template <typename Interface> |
| 94 void GetInterface(mojo::InterfaceRequest<Interface> request) { |
| 95 GetRemoteInterfaces()->GetInterface(std::move(request)); |
| 96 } |
| 93 | 97 |
| 94 // Returns true if the remote application has the specified capability class | 98 // Returns true if the remote application has the specified capability class |
| 95 // specified in its manifest. Only valid for inbound connections. Will return | 99 // specified in its manifest. Only valid for inbound connections. Will return |
| 96 // false for outbound connections. | 100 // false for outbound connections. |
| 97 virtual bool HasCapabilityClass(const std::string& class_name) const = 0; | 101 virtual bool HasCapabilityClass(const std::string& class_name) const = 0; |
| 98 | 102 |
| 99 // Returns the name that was used by the source application to establish a | 103 // Returns the name that was used by the source application to establish a |
| 100 // connection to the destination application. | 104 // connection to the destination application. |
| 101 // | 105 // |
| 102 // When Connection is representing and outgoing connection, this will be the | 106 // When Connection is representing and outgoing connection, this will be the |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 // Returns an object encapsulating a remote InterfaceProvider. | 154 // Returns an object encapsulating a remote InterfaceProvider. |
| 151 virtual InterfaceProvider* GetRemoteInterfaces() = 0; | 155 virtual InterfaceProvider* GetRemoteInterfaces() = 0; |
| 152 | 156 |
| 153 protected: | 157 protected: |
| 154 virtual base::WeakPtr<Connection> GetWeakPtr() = 0; | 158 virtual base::WeakPtr<Connection> GetWeakPtr() = 0; |
| 155 }; | 159 }; |
| 156 | 160 |
| 157 } // namespace shell | 161 } // namespace shell |
| 158 | 162 |
| 159 #endif // SERVICES_SHELL_PUBLIC_CPP_CONNECTION_H_ | 163 #endif // SERVICES_SHELL_PUBLIC_CPP_CONNECTION_H_ |
| OLD | NEW |