diff options
Diffstat (limited to 'remoting/tools')
-rw-r--r-- | remoting/tools/client.html | 30 | ||||
-rw-r--r-- | remoting/tools/client.js | 39 |
2 files changed, 69 insertions, 0 deletions
diff --git a/remoting/tools/client.html b/remoting/tools/client.html new file mode 100644 index 0000000..2f25c7d --- /dev/null +++ b/remoting/tools/client.html @@ -0,0 +1,30 @@ +<!-- +Copyright (c) 2010 The Chromium Authors. All rights reserved. +Use of this source code is governed by a BSD-style license that can be +found in the LICENSE file. +--> + +<html> + <head> + <script type="text/javascript" src="client.js"></script> + <title>Get hosts</title> + </head> + <body onload="init_params();"> + <form name="connectparams" action="" method="GET"> + <input type="text" name="username" value="" /> + <input type="text" name="host_jid" value="" /> + <input type="text" name="auth_token" value="" /> + <input type="button" name="connect" value="Connect" onclick="do_connect(this.form)" /> + </form> + + <div id="debug_div" style="border: red 1px solid;"> + -- Debugging messages go here -- + </div> + + <br /> + + <div id="plugin_div" style="border: black 1px dashed;"> + <embed name="chromoting" src="chrome://remoting" type="pepper-application/x-chromoting"> + </div> + </body> +</html> diff --git a/remoting/tools/client.js b/remoting/tools/client.js new file mode 100644 index 0000000..1038c32 --- /dev/null +++ b/remoting/tools/client.js @@ -0,0 +1,39 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +function init_params() { + var hash; + var hashes = window.location.href.slice( + window.location.href.indexOf('?') + 1).split('&'); + var connect_params = document.forms[0]; + for(var i = 0; i < hashes.length; i++) + { + hash = hashes[i].split('='); + if (hash[0] == "username") { + connect_params.username.value = hash[1]; + } else if (hash[0] == "host_jid") { + connect_params.host_jid.value = hash[1]; + } else if (hash[0] == "auth_token") { + connect_params.auth_token.value = hash[1]; + } + } +} + +function do_connect(form) { + debug_output("Attempt to connect with " + + "username='" + form.username.value + "'" + + " host_jid='" + form.host_jid.value + "'" + + " auth_token='" + form.auth_token.value + "'"); + + document.chromoting.connect(form.username.value, form.host_jid.value, form.auth_token.value); +} + +function debug_output(message) { + var debug_div = document.getElementById('debug_div'); + var message_node = document.createElement('p'); + message_node.innerText = message; + + debug_div.appendChild(message_node); +} + |