summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
authorhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-02 01:34:45 +0000
committerhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-02 01:34:45 +0000
commit2aff5043bc7596acf7476f43119f4fb8314ffcb2 (patch)
tree10fbfab20480dd29556527caa6edc4eac3587dd7 /remoting
parentc6f74bd95941eb3f8bdc6959d19bf27af6e98e0b (diff)
downloadchromium_src-2aff5043bc7596acf7476f43119f4fb8314ffcb2.zip
chromium_src-2aff5043bc7596acf7476f43119f4fb8314ffcb2.tar.gz
chromium_src-2aff5043bc7596acf7476f43119f4fb8314ffcb2.tar.bz2
Change the chromoting plugin login interface
Provide the info string to the callback instead of through an attribute. BUG=71630 TEST=None Review URL: http://codereview.chromium.org/6598079 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76492 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r--remoting/client/appengine/static_files/chromoting_session.js7
-rw-r--r--remoting/client/plugin/chromoting_scriptable_object.cc47
-rw-r--r--remoting/client/plugin/chromoting_scriptable_object.h3
3 files changed, 15 insertions, 42 deletions
diff --git a/remoting/client/appengine/static_files/chromoting_session.js b/remoting/client/appengine/static_files/chromoting_session.js
index 94faa79..9d4c481 100644
--- a/remoting/client/appengine/static_files/chromoting_session.js
+++ b/remoting/client/appengine/static_files/chromoting_session.js
@@ -23,7 +23,7 @@ function init() {
// has changes and the UI needs to be updated. It needs to be an object with
// a 'callback' property that contains the callback function.
plugin.connectionInfoUpdate = connectionInfoUpdateCallback;
- plugin.debugInfoUpdate = debugInfoUpdateCallback;
+ plugin.debugInfo = debugInfoCallback;
plugin.loginChallenge = loginChallengeCallback;
console.log('connect request received: ' + chromoting.hostname + ' by ' +
@@ -211,9 +211,8 @@ function fade(name, id, val, delta, delay) {
* This is that callback that the plugin invokes to indicate that there
* is additional debug log info to display.
*/
-function debugInfoUpdateCallback() {
- var debugInfo = chromoting.plugin.debugInfo;
- addToDebugLog(debugInfo);
+function debugInfoCallback(msg) {
+ addToDebugLog(msg);
}
/**
diff --git a/remoting/client/plugin/chromoting_scriptable_object.cc b/remoting/client/plugin/chromoting_scriptable_object.cc
index c456a94..95a91b2 100644
--- a/remoting/client/plugin/chromoting_scriptable_object.cc
+++ b/remoting/client/plugin/chromoting_scriptable_object.cc
@@ -14,8 +14,7 @@ using pp::Var;
namespace remoting {
const char kConnectionInfoUpdate[] = "connectionInfoUpdate";
-const char kDebugInfoUpdate[] = "debugInfoUpdate";
-const char kDebugInfoAttribute[] = "debugInfo";
+const char kDebugInfo[] = "debugInfo";
const char kDesktopHeight[] = "desktopHeight";
const char kDesktopWidth[] = "desktopWidth";
const char kLoginChallenge[] = "loginChallenge";
@@ -54,10 +53,8 @@ void ChromotingScriptableObject::Init() {
AddAttribute("QUALITY_BAD", Var(QUALITY_BAD));
// Debug info to display.
- AddAttribute(kDebugInfoAttribute, Var());
-
AddAttribute(kConnectionInfoUpdate, Var());
- AddAttribute(kDebugInfoUpdate, Var());
+ AddAttribute(kDebugInfo, Var());
AddAttribute(kLoginChallenge, Var());
AddAttribute(kDesktopWidth, Var(0));
AddAttribute(kDesktopHeight, Var(0));
@@ -142,7 +139,7 @@ void ChromotingScriptableObject::SetProperty(const Var& name,
// chromoting_scriptable_object.h for the object interface definition.
std::string property_name = name.AsString();
if (property_name != kConnectionInfoUpdate &&
- property_name != kDebugInfoUpdate &&
+ property_name != kDebugInfo &&
property_name != kLoginChallenge &&
property_name != kDesktopWidth &&
property_name != kDesktopHeight) {
@@ -185,14 +182,17 @@ void ChromotingScriptableObject::SetConnectionInfo(ConnectionStatus status,
}
void ChromotingScriptableObject::LogDebugInfo(const std::string& info) {
- int debug_info_index = property_names_[kDebugInfoAttribute];
+ Var exception;
+ Var cb = GetProperty(Var(kDebugInfo), &exception);
- // Update the debug info string.
- // Note that this only stores the most recent debug string.
- properties_[debug_info_index].attribute = Var(info);
+ // Var() means call the object directly as a function rather than calling
+ // a method in the object.
+ cb.Call(Var(), Var(info), &exception);
- // Signal the client UI to get the updated debug info.
- SignalDebugInfoChange();
+ if (!exception.is_undefined()) {
+ LOG(WARNING) << "Exception when invoking debugInfo JS callback: "
+ << exception.DebugString();
+ }
}
void ChromotingScriptableObject::SetDesktopSize(int width, int height) {
@@ -220,9 +220,6 @@ void ChromotingScriptableObject::AddMethod(const std::string& name,
void ChromotingScriptableObject::SignalConnectionInfoChange() {
Var exception;
-
- // The JavaScript callback function is the 'callback' property on the
- // 'connectionInfoUpdate' object.
Var cb = GetProperty(Var(kConnectionInfoUpdate), &exception);
// Var() means call the object directly as a function rather than calling
@@ -235,28 +232,8 @@ void ChromotingScriptableObject::SignalConnectionInfoChange() {
}
}
-void ChromotingScriptableObject::SignalDebugInfoChange() {
- Var exception;
-
- // The JavaScript callback function is the 'callback' property on the
- // 'debugInfoUpdate' object.
- Var cb = GetProperty(Var(kDebugInfoUpdate), &exception);
-
- // Var() means call the object directly as a function rather than calling
- // a method in the object.
- cb.Call(Var(), 0, NULL, &exception);
-
- if (!exception.is_undefined()) {
- LOG(WARNING) << "Exception when invoking debugInfoUpdate JS callback: "
- << exception.DebugString();
- }
-}
-
void ChromotingScriptableObject::SignalLoginChallenge() {
Var exception;
-
- // The JavaScript callback function is the 'callback' property on the
- // 'loginChallenge' object.
Var cb = GetProperty(Var(kLoginChallenge), &exception);
// Var() means call the object directly as a function rather than calling
diff --git a/remoting/client/plugin/chromoting_scriptable_object.h b/remoting/client/plugin/chromoting_scriptable_object.h
index e5c57b5..aec9c23 100644
--- a/remoting/client/plugin/chromoting_scriptable_object.h
+++ b/remoting/client/plugin/chromoting_scriptable_object.h
@@ -150,9 +150,6 @@ class ChromotingScriptableObject : public pp::deprecated::ScriptableObject {
// changed.
void SignalConnectionInfoChange();
- // Call this to signal that there is new debug info to display.
- void SignalDebugInfoChange();
-
pp::Var DoConnect(const std::vector<pp::Var>& args, pp::Var* exception);
pp::Var DoDisconnect(const std::vector<pp::Var>& args, pp::Var* exception);