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

Christophe Fergeau cfergeau at redhat.com
Tue Apr 3 06:07:03 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. Next step will be to transmit them to
the controller.
---
 SpiceXPI/src/plugin/plugin.cpp |   19 +++++++++----------
 SpiceXPI/src/plugin/plugin.h   |    2 ++
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/SpiceXPI/src/plugin/plugin.cpp b/SpiceXPI/src/plugin/plugin.cpp
index 5e40ee2..e3e6e80 100644
--- a/SpiceXPI/src/plugin/plugin.cpp
+++ b/SpiceXPI/src/plugin/plugin.cpp
@@ -195,6 +195,7 @@ nsPluginInstance::nsPluginInstance(NPP aInstance):
     m_no_taskmgr_execution(PR_FALSE),
     m_send_ctrlaltdel(PR_TRUE),
     m_usb_redir(PR_FALSE),
+    m_usb_auto_share(PR_TRUE),
     m_scriptable_peer(NULL)
 {
     // create temporary directory in /tmp
@@ -232,6 +233,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();
@@ -491,17 +493,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; */
@@ -695,6 +692,9 @@ 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, m_usb_redir);
+        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"
@@ -753,9 +753,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 7f1e259..e34574b 100644
--- a/SpiceXPI/src/plugin/plugin.h
+++ b/SpiceXPI/src/plugin/plugin.h
@@ -213,6 +213,8 @@ private:
     PRBool m_no_taskmgr_execution;
     PRBool m_send_ctrlaltdel;
     PRBool m_usb_redir;
+    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;
-- 
1.7.9.3



More information about the Spice-devel mailing list