[Spice-devel] [spice-xpi PATCHv2 1/2] Handle USB-related plugin properties

Christophe Fergeau cfergeau at redhat.com
Wed Apr 4 01:03:43 PDT 2012


The Firefox plugin exposes the UsbAutoShare property and the SetUsbFilter
method that were not wired until now. This commit propagates their value to
the nsPluginInstance object and send them through the controller socket.
---
 SpiceXPI/src/plugin/plugin.cpp |   18 ++++++++----------
 SpiceXPI/src/plugin/plugin.h   |    2 ++
 spice-protocol                 |    2 +-
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/SpiceXPI/src/plugin/plugin.cpp b/SpiceXPI/src/plugin/plugin.cpp
index 3459869..1f42214 100644
--- a/SpiceXPI/src/plugin/plugin.cpp
+++ b/SpiceXPI/src/plugin/plugin.cpp
@@ -194,6 +194,7 @@ nsPluginInstance::nsPluginInstance(NPP aInstance):
     m_admin_console(PR_FALSE),
     m_no_taskmgr_execution(PR_FALSE),
     m_send_ctrlaltdel(PR_TRUE),
+    m_usb_auto_share(PR_TRUE),
     m_scriptable_peer(NULL)
 {
     // create temporary directory in /tmp
@@ -231,6 +232,7 @@ NPBool nsPluginInstance::init(NPWindow *aWindow)
     m_number_of_monitors.clear();
     m_guest_host_name.clear();
     m_hot_keys.clear();
+    m_usb_filter.clear();
     m_language.clear();
     m_trust_store_file.clear();
     m_color_depth.clear();
@@ -479,17 +481,12 @@ void nsPluginInstance::SetUsbListenPort(unsigned short aUsbPort)
 /* attribute boolean UsbAutoShare; */
 PRBool nsPluginInstance::GetUsbAutoShare() const
 {
-    // this method exists due to RHEVM 2.2
-    // and should be removed some time in future,
-    // when fixed in RHEVM
-    return false;
+    return m_usb_auto_share;
 }
 
 void nsPluginInstance::SetUsbAutoShare(PRBool aUsbAutoShare)
 {
-    // this method exists due to RHEVM 2.2
-    // and should be removed some time in future,
-    // when fixed in RHEVM
+    m_usb_auto_share = aUsbAutoShare;
 }
 
 /* attribute string ColorDepth; */
@@ -683,6 +680,8 @@ void nsPluginInstance::Connect()
         SendStr(CONTROLLER_TLS_CIPHERS, m_cipher_suite.c_str());
         SendStr(CONTROLLER_SET_TITLE, m_title.c_str());
         SendBool(CONTROLLER_SEND_CAD, m_send_ctrlaltdel);
+        SendBool(CONTROLLER_ENABLE_USB_AUTOSHARE, m_usb_auto_share);
+        SendStr(CONTROLLER_USB_FILTER, m_usb_filter.c_str());
 
         /*
          * HACK -- remove leading s from m_SSLChannels, e.g. "main" not "smain"
@@ -741,9 +740,8 @@ void nsPluginInstance::SetLanguageStrings(const char *aSection, const char *aLan
 
 void nsPluginInstance::SetUsbFilter(const char *aUsbFilter)
 {
-    // this method exists due to RHEVM 2.2
-    // and should be removed some time in future,
-    // when fixed in RHEVM
+    if (aUsbFilter != NULL)
+        m_usb_filter = aUsbFilter;
 }
 
 void nsPluginInstance::CallOnDisconnected(int code)
diff --git a/SpiceXPI/src/plugin/plugin.h b/SpiceXPI/src/plugin/plugin.h
index 8b3725d..91f2ce6 100644
--- a/SpiceXPI/src/plugin/plugin.h
+++ b/SpiceXPI/src/plugin/plugin.h
@@ -208,6 +208,8 @@ private:
     std::string m_hot_keys;
     PRBool m_no_taskmgr_execution;
     PRBool m_send_ctrlaltdel;
+    std::string m_usb_filter;
+    PRBool m_usb_auto_share;
     std::map<std::string, std::string> m_language;
     std::string m_color_depth;
     std::string m_disable_effects;
diff --git a/spice-protocol b/spice-protocol
index 8cf92f0..2d24f61 160000
--- a/spice-protocol
+++ b/spice-protocol
@@ -1 +1 @@
-Subproject commit 8cf92f042312e50b2ff186b28356053aeac9e04c
+Subproject commit 2d24f61aae4f92746940fd1c0daf546c7a51dae8
-- 
1.7.9.3



More information about the Spice-devel mailing list