summaryrefslogtreecommitdiffstats
path: root/remoting/tools
diff options
context:
space:
mode:
authorajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-28 02:36:17 +0000
committerajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-28 02:36:17 +0000
commit223668b47632c622506c82ee26a8b5ca08de7455 (patch)
treee056d95e7e68f295af716dcebd61e330b8ec83e8 /remoting/tools
parent86aa005b33fb99dbeb02bc38c84de1012d685418 (diff)
downloadchromium_src-223668b47632c622506c82ee26a8b5ca08de7455.zip
chromium_src-223668b47632c622506c82ee26a8b5ca08de7455.tar.gz
chromium_src-223668b47632c622506c82ee26a8b5ca08de7455.tar.bz2
Add a very simple client HTML/JS webpage.
This should allow easier invocation of the chromoting plugin. The javascript will parse window.location.href, so the plugin should be invocable via the commandline for easier debugging. Note, this isn't tested yet, but should it should be close to right. BUG=50248 TEST=none TBR: hclam@chromium.org, garykac@chromium.org git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53899 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/tools')
-rw-r--r--remoting/tools/client.html30
-rw-r--r--remoting/tools/client.js39
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);
+}
+