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_CONNECTION_H_ | 5 #ifndef MOJO_SHELL_PUBLIC_CPP_CONNECTION_H_ |
6 #define MOJO_SHELL_PUBLIC_CPP_CONNECTION_H_ | 6 #define MOJO_SHELL_PUBLIC_CPP_CONNECTION_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 } | 60 } |
61 | 61 |
62 // Binds |ptr| to an implemention of Interface in the remote application. | 62 // Binds |ptr| to an implemention of Interface in the remote application. |
63 // |ptr| can immediately be used to start sending requests to the remote | 63 // |ptr| can immediately be used to start sending requests to the remote |
64 // interface. | 64 // interface. |
65 template <typename Interface> | 65 template <typename Interface> |
66 void GetInterface(InterfacePtr<Interface>* ptr) { | 66 void GetInterface(InterfacePtr<Interface>* ptr) { |
67 mojo::GetInterface(GetRemoteInterfaces(), ptr); | 67 mojo::GetInterface(GetRemoteInterfaces(), ptr); |
68 } | 68 } |
69 | 69 |
70 // Returns the URL that was used by the source application to establish a | 70 // Returns the name that was used by the source application to establish a |
71 // connection to the destination application. | 71 // connection to the destination application. |
72 // | 72 // |
73 // When Connection is representing an incoming connection this can be | |
74 // different than the URL the application was initially loaded from, if the | |
75 // application handles multiple URLs. Note that this is the URL after all | |
76 // URL rewriting and HTTP redirects have been performed. | |
77 // | |
78 // When Connection is representing and outgoing connection, this will be the | 73 // When Connection is representing and outgoing connection, this will be the |
79 // same as the value returned by GetRemoveApplicationURL(). | 74 // same as the value returned by GetRemoveApplicationName(). |
80 virtual const std::string& GetConnectionURL() = 0; | 75 virtual const std::string& GetConnectionName() = 0; |
81 | 76 |
82 // Returns the URL identifying the remote application on this connection. | 77 // Returns the name identifying the remote application on this connection. |
83 virtual const std::string& GetRemoteApplicationURL() = 0; | 78 virtual const std::string& GetRemoteApplicationName() = 0; |
84 | 79 |
85 // Returns the User ID for the remote application. | 80 // Returns the User ID for the remote application. |
86 virtual uint32_t GetRemoteUserID() const = 0; | 81 virtual uint32_t GetRemoteUserID() const = 0; |
87 | 82 |
88 // Register a handler to receive an error notification on the pipe to the | 83 // Register a handler to receive an error notification on the pipe to the |
89 // remote application's InterfaceProvider. | 84 // remote application's InterfaceProvider. |
90 virtual void SetRemoteInterfaceProviderConnectionErrorHandler( | 85 virtual void SetRemoteInterfaceProviderConnectionErrorHandler( |
91 const Closure& handler) = 0; | 86 const Closure& handler) = 0; |
92 | 87 |
93 // Returns the id of the remote application. For Connections created via | 88 // Returns the id of the remote application. For Connections created via |
(...skipping 20 matching lines...) Expand all Loading... |
114 | 109 |
115 protected: | 110 protected: |
116 virtual InterfaceRegistry* GetLocalRegistry() = 0; | 111 virtual InterfaceRegistry* GetLocalRegistry() = 0; |
117 | 112 |
118 virtual base::WeakPtr<Connection> GetWeakPtr() = 0; | 113 virtual base::WeakPtr<Connection> GetWeakPtr() = 0; |
119 }; | 114 }; |
120 | 115 |
121 } // namespace mojo | 116 } // namespace mojo |
122 | 117 |
123 #endif // MOJO_SHELL_PUBLIC_CPP_CONNECTION_H_ | 118 #endif // MOJO_SHELL_PUBLIC_CPP_CONNECTION_H_ |
OLD | NEW |