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 MOJO_SHELL_PUBLIC_CPP_APPLICATION_CONNECTION_H_ | 5 #ifndef MOJO_SHELL_PUBLIC_CPP_APPLICATION_CONNECTION_H_ |
6 #define MOJO_SHELL_PUBLIC_CPP_APPLICATION_CONNECTION_H_ | 6 #define MOJO_SHELL_PUBLIC_CPP_APPLICATION_CONNECTION_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 112 |
113 // Returns the local application's ServiceProvider interface. The return | 113 // Returns the local application's ServiceProvider interface. The return |
114 // value is owned by this connection. | 114 // value is owned by this connection. |
115 virtual ServiceProvider* GetLocalServiceProvider() = 0; | 115 virtual ServiceProvider* GetLocalServiceProvider() = 0; |
116 | 116 |
117 // Register a handler to receive an error notification on the pipe to the | 117 // Register a handler to receive an error notification on the pipe to the |
118 // remote application's service provider. | 118 // remote application's service provider. |
119 virtual void SetRemoteServiceProviderConnectionErrorHandler( | 119 virtual void SetRemoteServiceProviderConnectionErrorHandler( |
120 const Closure& handler) = 0; | 120 const Closure& handler) = 0; |
121 | 121 |
| 122 // Returns the id of the remote application. For ApplicationConnections |
| 123 // created via ApplicationImpl::ConnectToApplication(), this will not be |
| 124 // determined until ConnectToApplication()'s callback is run, and this |
| 125 // function will return false. Use AddRemoteIDCallback() to schedule a |
| 126 // callback to be run when the remote application id is available. A value of |
| 127 // Shell::kInvalidApplicationID indicates no remote application connection |
| 128 // has been established. |
| 129 virtual bool GetRemoteApplicationID(uint32_t* remote_id) const = 0; |
| 130 |
122 // Returns the id of the deepest content handler used in connecting to | 131 // Returns the id of the deepest content handler used in connecting to |
123 // the application. If the content handler id has not yet been determined | 132 // the application. See GetRemoteApplicationID() for details about the return |
124 // this returns false, use AddContentHandlerIDCallback() to schedule a | 133 // value. A |content_handler_id| value of Shell::kInvalidApplicationID |
125 // callback when the content handler is has been obtained. A value of 0 | |
126 // indicates no content handler was used in connecting to the application. | 134 // indicates no content handler was used in connecting to the application. |
127 virtual bool GetContentHandlerID(uint32_t* content_handler_id) = 0; | 135 virtual bool GetRemoteContentHandlerID( |
| 136 uint32_t* content_handler_id) const = 0; |
128 | 137 |
129 // See description in GetTargetID(). If the id of the content handler has | 138 // See description in GetRemoteApplicationID()/GetRemoteContentHandlerID(). If |
130 // been obtained |callback| is run immediately. | 139 // the ids are available, |callback| is run immediately. |
131 virtual void AddContentHandlerIDCallback(const Closure& callback) = 0; | 140 virtual void AddRemoteIDCallback(const Closure& callback) = 0; |
132 | 141 |
133 protected: | 142 protected: |
134 // Returns true if the connector was set, false if it was not set (e.g. by | 143 // Returns true if the connector was set, false if it was not set (e.g. by |
135 // some filtering policy preventing this interface from being exposed). | 144 // some filtering policy preventing this interface from being exposed). |
136 virtual bool SetServiceConnectorForName(ServiceConnector* service_connector, | 145 virtual bool SetServiceConnectorForName(ServiceConnector* service_connector, |
137 const std::string& name) = 0; | 146 const std::string& name) = 0; |
138 | 147 |
139 virtual base::WeakPtr<ApplicationConnection> GetWeakPtr() = 0; | 148 virtual base::WeakPtr<ApplicationConnection> GetWeakPtr() = 0; |
140 }; | 149 }; |
141 | 150 |
142 } // namespace mojo | 151 } // namespace mojo |
143 | 152 |
144 #endif // MOJO_SHELL_PUBLIC_CPP_APPLICATION_CONNECTION_H_ | 153 #endif // MOJO_SHELL_PUBLIC_CPP_APPLICATION_CONNECTION_H_ |
OLD | NEW |