summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
authorukai@chromium.org <ukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-25 06:50:54 +0000
committerukai@chromium.org <ukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-25 06:50:54 +0000
commit72308ecf6d57b3f760cf776e5e544b5d7b3e3589 (patch)
tree42f0e8a5847b2afa27a12849c27fb5cc5592bae6 /remoting
parent6e3410aef5015c1ced049802fd2dc1e06e822a03 (diff)
downloadchromium_src-72308ecf6d57b3f760cf776e5e544b5d7b3e3589.zip
chromium_src-72308ecf6d57b3f760cf776e5e544b5d7b3e3589.tar.gz
chromium_src-72308ecf6d57b3f760cf776e5e544b5d7b3e3589.tar.bz2
Revert 86573 - Add separate nonce version of connect calls to ChromotingScriptableObject.
It causes PPAPITest.Transport failure on Vista BUG=none TEST=manual Review URL: http://codereview.chromium.org/7042022 TBR=garykac@chromium.org Review URL: http://codereview.chromium.org/7069005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86575 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r--remoting/client/appengine/static_files/chromoting_session.js8
-rw-r--r--remoting/client/plugin/chromoting_scriptable_object.cc109
-rw-r--r--remoting/client/plugin/chromoting_scriptable_object.h20
-rw-r--r--remoting/webapp/me2mom/remoting_session.js8
4 files changed, 61 insertions, 84 deletions
diff --git a/remoting/client/appengine/static_files/chromoting_session.js b/remoting/client/appengine/static_files/chromoting_session.js
index 8b96642..b6960df 100644
--- a/remoting/client/appengine/static_files/chromoting_session.js
+++ b/remoting/client/appengine/static_files/chromoting_session.js
@@ -54,7 +54,8 @@ function registerConnection() {
var clientjid = xhr.responseText;
chromoting.plugin.sendIq = sendIq;
- chromoting.plugin.connect(chromoting.hostjid, clientjid);
+ // TODO:(jamiewalch): Pass in the correct nonce.
+ chromoting.plugin.connectSandboxed(clientjid, chromoting.hostjid);
// TODO(ajwong): This should just be feedIq();
window.setTimeout(feedIq, 1000);
} else {
@@ -131,8 +132,9 @@ function init() {
if (chromoting.connectMethod == "sandboxed") {
registerConnection();
} else {
- plugin.connectUnsandboxed(chromoting.hostjid, chromoting.username,
- chromoting.talkToken);
+ // TODO:(jamiewalch): Pass in the correct nonce.
+ plugin.connect(chromoting.username, chromoting.hostjid,
+ chromoting.talkToken, '');
}
} else {
addToDebugLog('ERROR: chromoting plugin not loaded');
diff --git a/remoting/client/plugin/chromoting_scriptable_object.cc b/remoting/client/plugin/chromoting_scriptable_object.cc
index 89c8793..106141f 100644
--- a/remoting/client/plugin/chromoting_scriptable_object.cc
+++ b/remoting/client/plugin/chromoting_scriptable_object.cc
@@ -85,8 +85,8 @@ void ChromotingScriptableObject::Init() {
AddAttribute(kRoundTripLatencyAttribute, Var());
AddMethod("connect", &ChromotingScriptableObject::DoConnect);
- AddMethod("connectUnsandboxed",
- &ChromotingScriptableObject::DoConnectUnsandboxed);
+ AddMethod("connectSandboxed",
+ &ChromotingScriptableObject::DoConnectSandboxed);
AddMethod("disconnect", &ChromotingScriptableObject::DoDisconnect);
AddMethod("submitLoginInfo", &ChromotingScriptableObject::DoSubmitLogin);
AddMethod("setScaleToFit", &ChromotingScriptableObject::DoSetScaleToFit);
@@ -327,100 +327,79 @@ void ChromotingScriptableObject::SendIq(const std::string& message_xml) {
cb.Call(Var(), Var(message_xml), &exception);
if (!exception.is_undefined())
- LogDebugInfo("Exception when invoking sendiq JS callback.");
+ LogDebugInfo("Exception when invoking loginChallenge JS callback.");
}
Var ChromotingScriptableObject::DoConnect(const std::vector<Var>& args,
Var* exception) {
- // Parameter order is:
- // host_jid
- // client_jid
- // access_code (optional)
- unsigned int arg = 0;
- if (!args[arg].is_string()) {
- *exception = Var("The host_jid must be a string.");
+ if (args.size() != 4) {
+ *exception = Var("Usage: connect(username, host_jid, auth_token)");
return Var();
}
- std::string host_jid = args[arg++].AsString();
- if (!args[arg].is_string()) {
- *exception = Var("The client_jid must be a string.");
+ ClientConfig config;
+
+ if (!args[0].is_string()) {
+ *exception = Var("The username must be a string.");
return Var();
}
- std::string client_jid = args[arg++].AsString();
-
- std::string access_code;
- if (args.size() > arg) {
- if (!args[arg].is_string()) {
- *exception = Var("The access code must be a string.");
- return Var();
- }
- access_code = args[arg++].AsString();
+ config.username = args[0].AsString();
+
+ if (!args[1].is_string()) {
+ *exception = Var("The host_jid must be a string.");
+ return Var();
}
+ config.host_jid = args[1].AsString();
- if (args.size() != arg) {
- *exception = Var("Too many agruments passed to connect().");
+ if (!args[2].is_string()) {
+ *exception = Var("The auth_token must be a string.");
return Var();
}
+ config.auth_token = args[2].AsString();
+
+ if (!args[3].is_string()) {
+ *exception = Var("nonce must be a string.");
+ return Var();
+ }
+ config.nonce = args[3].AsString();
LogDebugInfo("Connecting to host.");
- VLOG(1) << "client_jid: " << client_jid << ", host_jid: " << host_jid
- << ", access_code: " << access_code;
- instance_->ConnectSandboxed(client_jid, host_jid, access_code);
+ instance_->Connect(config);
return Var();
}
-Var ChromotingScriptableObject::DoConnectUnsandboxed(
- const std::vector<Var>& args,
- Var* exception) {
- // Parameter order is:
- // host_jid
- // username
- // xmpp_token
- // access_code (optional)
- unsigned int arg = 0;
- if (!args[arg].is_string()) {
- *exception = Var("The host_jid must be a string.");
+Var ChromotingScriptableObject::DoConnectSandboxed(
+ const std::vector<Var>& args, Var* exception) {
+ if (args.size() != 3) {
+ *exception = Var("Usage: connectSandboxed(your_jid, host_jid, nonce)");
return Var();
}
- std::string host_jid = args[arg++].AsString();
- if (!args[arg].is_string()) {
- *exception = Var("The username must be a string.");
+ std::string your_jid;
+ if (!args[0].is_string()) {
+ *exception = Var("your_jid must be a string.");
return Var();
}
- std::string username = args[arg++].AsString();
+ your_jid = args[0].AsString();
- if (!args[arg].is_string()) {
- *exception = Var("The auth_token must be a string.");
+ std::string host_jid;
+ if (!args[1].is_string()) {
+ *exception = Var("host_jid must be a string.");
return Var();
}
- std::string auth_token = args[arg++].AsString();
-
- std::string access_code;
- if (args.size() > arg) {
- if (!args[arg].is_string()) {
- *exception = Var("The access code must be a string.");
- return Var();
- }
- access_code = args[arg++].AsString();
- }
+ host_jid = args[1].AsString();
- if (args.size() != arg) {
- *exception = Var("Too many agruments passed to connect().");
+ std::string nonce;
+ if (!args[2].is_string()) {
+ *exception = Var("nonce must be a string.");
return Var();
}
+ nonce = args[2].AsString();
- LogDebugInfo("Connecting to host.");
- ClientConfig config;
- config.host_jid = host_jid;
- config.username = username;
- config.auth_token = auth_token;
- config.nonce = access_code;
- VLOG(1) << "host_jid: " << host_jid << ", username: " << username
- << ", access_code: " << access_code;
- instance_->Connect(config);
+ VLOG(1) << "your_jid: " << your_jid << ", host_jid: " << host_jid
+ << ", nonce: " << nonce;
+ instance_->ConnectSandboxed(your_jid, host_jid, nonce);
return Var();
}
diff --git a/remoting/client/plugin/chromoting_scriptable_object.h b/remoting/client/plugin/chromoting_scriptable_object.h
index 9c8545b..8ee2d12f 100644
--- a/remoting/client/plugin/chromoting_scriptable_object.h
+++ b/remoting/client/plugin/chromoting_scriptable_object.h
@@ -74,16 +74,12 @@
//
// // Methods for establishing a Chromoting connection.
// //
-// // When using the sandboxed versions, sendIq must be set and responses to
-// // calls on sendIq must be piped back into onIq().
-// void connect(string host_jid, string client_jid,
-// optional string access_code);
-// // Non-sandboxed version used for debugging/testing.
-// // TODO(garykac): Remove this version once we no longer need it.
-// void connectUnsandboxed(string host_jid, string username,
-// string xmpp_token, optional string access_code);
-//
-// // Terminating a Chromoting connection.
+// // Either use connect() or connectSandboxed(), not both. If using
+// // connectSandboxed(), sendIq must be set, and responses to calls on
+// // sendIq must be piped back into onIq().
+// void connect(string username, string host_jid, string auth_token,
+// string nonce);
+// void connectSandboxed(string your_jid, string host_jid, string nonce);
// void disconnect();
//
// // Method for submitting login information.
@@ -197,8 +193,8 @@ class ChromotingScriptableObject
void SignalDesktopSizeChange();
pp::Var DoConnect(const std::vector<pp::Var>& args, pp::Var* exception);
- pp::Var DoConnectUnsandboxed(const std::vector<pp::Var>& args,
- pp::Var* exception);
+ pp::Var DoConnectSandboxed(const std::vector<pp::Var>& args,
+ pp::Var* exception);
pp::Var DoDisconnect(const std::vector<pp::Var>& args, pp::Var* exception);
// This method is called by JS to provide login information.
diff --git a/remoting/webapp/me2mom/remoting_session.js b/remoting/webapp/me2mom/remoting_session.js
index 1a2629e..8a605dd 100644
--- a/remoting/webapp/me2mom/remoting_session.js
+++ b/remoting/webapp/me2mom/remoting_session.js
@@ -55,8 +55,8 @@ function registerConnection() {
var clientjid = xhr.responseText;
remoting.plugin.sendIq = sendIq;
- remoting.plugin.connect(remoting.hostjid, clientjid,
- remoting.accessCode);
+ remoting.plugin.connectSandboxed(clientjid, remoting.hostjid,
+ remoting.accessCode);
// TODO(ajwong): This should just be feedIq();
window.setTimeout(feedIq, 1000);
} else {
@@ -123,8 +123,8 @@ function init() {
if (remoting.connectMethod == 'sandboxed') {
registerConnection();
} else {
- plugin.connectUnsandboxed(remoting.hostjid, remoting.username,
- remoting.xmppAuthToken, remoting.accessCode);
+ plugin.connect(remoting.username, remoting.hostjid,
+ remoting.xmppAuthToken, remoting.accessCode);
}
} else {
addToDebugLog('ERROR: remoting plugin not loaded');