OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // This implements the JavaScript class entrypoint for the plugin instance. | 5 // This implements the JavaScript class entrypoint for the plugin instance. |
6 // The Javascript API is defined as follows. | 6 // The Javascript API is defined as follows. |
7 // | 7 // |
8 // interface ChromotingScriptableObject { | 8 // interface ChromotingScriptableObject { |
9 // | 9 // |
10 // // Dimension of the desktop area. | 10 // // Dimension of the desktop area. |
11 // readonly attribute int desktopWidth; | 11 // readonly attribute int desktopWidth; |
12 // readonly attribute int desktopHeight; | 12 // readonly attribute int desktopHeight; |
13 // | 13 // |
14 // // Connection status. | 14 // // Connection status. |
15 // readonly attribute unsigned short status; | 15 // readonly attribute unsigned short status; |
16 // | 16 // |
17 // // Sandbox enabled. | |
18 // // TODO(garykac): Remove this once we no longer need non-sandbox for | |
19 // // debugging. | |
20 // readonly attribute bool sandboxed; | |
Jamie
2011/05/20 22:07:58
I don't think I like this. An attribute would make
Wez
2011/05/20 22:38:59
The aim was to have the attribute control whether
garykac
2011/05/23 16:58:06
I agree with Jamie here. Having a separate signatu
| |
21 // | |
17 // // Statistics. | 22 // // Statistics. |
18 // // Video Bandwidth in bytes per second. | 23 // // Video Bandwidth in bytes per second. |
19 // readonly attribute float videoBandwidth; | 24 // readonly attribute float videoBandwidth; |
20 // // Latency for capturing in milliseconds. | 25 // // Latency for capturing in milliseconds. |
21 // readonly attribute int videoCaptureLatency; | 26 // readonly attribute int videoCaptureLatency; |
22 // // Latency for video encoding in milliseconds. | 27 // // Latency for video encoding in milliseconds. |
23 // readonly attribute int videoEncodeLatency; | 28 // readonly attribute int videoEncodeLatency; |
24 // // Latency for video decoding in milliseconds. | 29 // // Latency for video decoding in milliseconds. |
25 // readonly attribute int videoDecodeLatency; | 30 // readonly attribute int videoDecodeLatency; |
26 // // Latency for rendering in milliseconds. | 31 // // Latency for rendering in milliseconds. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
67 // // User of this object should respond with calling submitLoginInfo() when | 72 // // User of this object should respond with calling submitLoginInfo() when |
68 // // username and password is available. | 73 // // username and password is available. |
69 // // | 74 // // |
70 // // This function will be called multiple times until login was successful | 75 // // This function will be called multiple times until login was successful |
71 // // or the maximum number of login attempts has been reached. In the | 76 // // or the maximum number of login attempts has been reached. In the |
72 // // later case |connection_status| is changed to STATUS_FAILED. | 77 // // later case |connection_status| is changed to STATUS_FAILED. |
73 // attribute Function loginChallenge; | 78 // attribute Function loginChallenge; |
74 // | 79 // |
75 // // Methods for establishing a Chromoting connection. | 80 // // Methods for establishing a Chromoting connection. |
76 // // | 81 // // |
77 // // Either use connect() or connectSandboxed(), not both. If using | 82 // // When using the sandboxed versions, sendIq must be set and responses to |
78 // // connectSandboxed(), sendIq must be set, and responses to calls on | 83 // // calls on sendIq must be piped back into onIq(). |
79 // // sendIq must be piped back into onIq(). | 84 // // TODO(garykac): Remove the non-sandboxed versions once we no longer |
80 // void connect(string username, string host_jid, string auth_token, | 85 // // need them for debugging/testing. |
81 // string nonce); | 86 // // |
82 // void connectSandboxed(string your_jid, string host_jid, string nonce); | 87 // // Sandboxed. auth_type="AUTHENTICATE" (me2me) |
88 // void connect(string host_jid, string auth_type, string client_jid); | |
89 // // Sandboxed. auth_type="ACCESS_CODE" (me2mom) | |
90 // void connect(string host_jid, string auth_type, string client_jid, | |
91 // string access_code); | |
92 // // Not-sandboxed. auth_type="AUTHENTICATE" (me2me) | |
93 // void connect(string host_jid, string auth_type, string username, | |
94 // string xmpp_token); | |
95 // // Not-sandboxed. auth_type="ACCESS_CODE" (me2mom) | |
96 // void connect(string host_jid, string auth_type, string username, | |
97 // string xmpp_token, string access_code); | |
98 // | |
Jamie
2011/05/20 22:07:58
From what I can see, the only difference between m
Wez
2011/05/20 22:38:59
I'd prefer a single connect() API with "name=value
Jamie
2011/05/23 16:50:18
I think we should make the sandboxed API look the
garykac
2011/05/23 16:58:06
I agree with this.
| |
99 // // Terminating a Chromoting connection. | |
83 // void disconnect(); | 100 // void disconnect(); |
84 // | 101 // |
85 // // Method for submitting login information. | 102 // // Method for submitting login information. |
86 // void submitLoginInfo(string username, string password); | 103 // void submitLoginInfo(string username, string password); |
87 // | 104 // |
88 // // Method for setting scale-to-fit. | 105 // // Method for setting scale-to-fit. |
89 // void setScaleToFit(bool scale_to_fit); | 106 // void setScaleToFit(bool scale_to_fit); |
90 // } | 107 // } |
91 | 108 |
92 #ifndef REMOTING_CLIENT_PLUGIN_CHROMOTING_SCRIPTABLE_OBJECT_H_ | 109 #ifndef REMOTING_CLIENT_PLUGIN_CHROMOTING_SCRIPTABLE_OBJECT_H_ |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
186 void AddMethod(const std::string& name, MethodHandler handler); | 203 void AddMethod(const std::string& name, MethodHandler handler); |
187 | 204 |
188 // This should be called to signal the JS code that the connection status has | 205 // This should be called to signal the JS code that the connection status has |
189 // changed. | 206 // changed. |
190 void SignalConnectionInfoChange(); | 207 void SignalConnectionInfoChange(); |
191 | 208 |
192 // Signal the JS code that the desktop size has changed. | 209 // Signal the JS code that the desktop size has changed. |
193 void SignalDesktopSizeChange(); | 210 void SignalDesktopSizeChange(); |
194 | 211 |
195 pp::Var DoConnect(const std::vector<pp::Var>& args, pp::Var* exception); | 212 pp::Var DoConnect(const std::vector<pp::Var>& args, pp::Var* exception); |
196 pp::Var DoConnectSandboxed(const std::vector<pp::Var>& args, | |
197 pp::Var* exception); | |
198 pp::Var DoDisconnect(const std::vector<pp::Var>& args, pp::Var* exception); | 213 pp::Var DoDisconnect(const std::vector<pp::Var>& args, pp::Var* exception); |
199 | 214 |
200 // This method is called by JS to provide login information. | 215 // This method is called by JS to provide login information. |
201 pp::Var DoSubmitLogin(const std::vector<pp::Var>& args, pp::Var* exception); | 216 pp::Var DoSubmitLogin(const std::vector<pp::Var>& args, pp::Var* exception); |
202 | 217 |
203 // This method is called by JS to set scale-to-fit. | 218 // This method is called by JS to set scale-to-fit. |
204 pp::Var DoSetScaleToFit(const std::vector<pp::Var>& args, pp::Var* exception); | 219 pp::Var DoSetScaleToFit(const std::vector<pp::Var>& args, pp::Var* exception); |
205 | 220 |
221 // This method is called by JS to set if we should connect from within a | |
222 // sandbox. By default, all connections are made from within a sandbox, so | |
223 // this is useful to turn off the sandbox for debugging or testing. | |
224 // TODO(garykac): Remove this once it is no longer needed for debug/test. | |
225 pp::Var DoSetSandboxed(const std::vector<pp::Var>& args, pp::Var* exception); | |
226 | |
206 // This method is caleld by Javascript to provide responses to sendIq() | 227 // This method is caleld by Javascript to provide responses to sendIq() |
207 // requests when establishing a sandboxed Chromoting connection. | 228 // requests when establishing a sandboxed Chromoting connection. |
208 pp::Var DoOnIq(const std::vector<pp::Var>& args, pp::Var* exception); | 229 pp::Var DoOnIq(const std::vector<pp::Var>& args, pp::Var* exception); |
209 | 230 |
210 PropertyNameMap property_names_; | 231 PropertyNameMap property_names_; |
211 std::vector<PropertyDescriptor> properties_; | 232 std::vector<PropertyDescriptor> properties_; |
212 scoped_refptr<PepperXmppProxy> xmpp_proxy_; | 233 scoped_refptr<PepperXmppProxy> xmpp_proxy_; |
213 | 234 |
214 ChromotingInstance* instance_; | 235 ChromotingInstance* instance_; |
215 }; | 236 }; |
216 | 237 |
217 } // namespace remoting | 238 } // namespace remoting |
218 | 239 |
219 #endif // REMOTING_CLIENT_PLUGIN_CHROMOTING_SCRIPTABLE_OBJECT_H_ | 240 #endif // REMOTING_CLIENT_PLUGIN_CHROMOTING_SCRIPTABLE_OBJECT_H_ |
OLD | NEW |