home *** CD-ROM | disk | FTP | other *** search
/ Freelog 112 / FreelogNo112-NovembreDecembre2012.iso / Multimedia / Songbird / Songbird_2.0.0-2311_windows-i686-msvc8.exe / components / sbWindowsAutoPlayService.js < prev    next >
Text File  |  2012-06-08  |  21KB  |  677 lines

  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* vim: set sw=2 :miv */
  3. /*
  4.  *=BEGIN SONGBIRD GPL
  5.  *
  6.  * This file is part of the Songbird web player.
  7.  *
  8.  * Copyright(c) 2005-2010 POTI, Inc.
  9.  * http://www.songbirdnest.com
  10.  *
  11.  * This file may be licensed under the terms of of the
  12.  * GNU General Public License Version 2 (the ``GPL'').
  13.  *
  14.  * Software distributed under the License is distributed
  15.  * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
  16.  * express or implied. See the GPL for the specific language
  17.  * governing rights and limitations.
  18.  *
  19.  * You should have received a copy of the GPL along with this
  20.  * program. If not, go to http://www.gnu.org/licenses/gpl.html
  21.  * or write to the Free Software Foundation, Inc.,
  22.  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  23.  *
  24.  *=END SONGBIRD GPL
  25.  */
  26.  
  27. /**
  28.  * \file  sbWindowsAutoPlayService.js
  29.  * \brief Songbird Windows AutoPlay Service Source.
  30.  */
  31.  
  32. //------------------------------------------------------------------------------
  33. //------------------------------------------------------------------------------
  34. //
  35. // Windows AutoPlay Service component.
  36. //
  37. //   This component provides various Windows AutoPlay services.  This component
  38. // handles Windows AutoPlay flags in the Songbird command line.
  39. //
  40. //------------------------------------------------------------------------------
  41. //------------------------------------------------------------------------------
  42.  
  43. //------------------------------------------------------------------------------
  44. //
  45. // Windows AutoPlay service imported services.
  46. //
  47. //------------------------------------------------------------------------------
  48.  
  49. // Component manager defs.
  50. if (typeof(Cc) == "undefined")
  51.   var Cc = Components.classes;
  52. if (typeof(Ci) == "undefined")
  53.   var Ci = Components.interfaces;
  54. if (typeof(Cr) == "undefined")
  55.   var Cr = Components.results;
  56. if (typeof(Cu) == "undefined")
  57.   var Cu = Components.utils;
  58.  
  59. // Songbird imports.
  60. Cu.import("resource://app/jsmodules/ObserverUtils.jsm");
  61. Cu.import("resource://app/jsmodules/StringUtils.jsm");
  62. Cu.import("resource://gre/modules/XPCOMUtils.jsm");
  63.  
  64.  
  65. //------------------------------------------------------------------------------
  66. //
  67. // Windows AutoPlay service configuration.
  68. //
  69. //------------------------------------------------------------------------------
  70.  
  71. //
  72. // classDescription             Description of component class.
  73. // classID                      Component class ID.
  74. // contractID                   Component contract ID.
  75. // ifList                       List of external component interfaces.
  76. // _xpcom_categories            List of component categories.
  77. //
  78.  
  79. var sbWindowsAutoPlayServiceCfg = {
  80.   classDescription: "Songbird Windows AutoPlay Service",
  81.   classID: Components.ID("{3124ec90-1dd2-11b2-8059-c4e994415c12}"),
  82.   contractID: "@songbirdnest.com/Songbird/WindowsAutoPlayService;1",
  83.   ifList: [ Ci.sbIWindowsAutoPlayService,
  84.             Ci.sbICommandLineFlagHandler,
  85.             Ci.nsIObserver ]
  86. };
  87.  
  88. sbWindowsAutoPlayServiceCfg._xpcom_categories = [
  89.   {
  90.     category: "app-startup",
  91.     entry:    sbWindowsAutoPlayServiceCfg.className,
  92.     value:    "service," + sbWindowsAutoPlayServiceCfg.contractID
  93.   }
  94. ];
  95.  
  96.  
  97. //------------------------------------------------------------------------------
  98. //
  99. // Windows AutoPlay service object.
  100. //
  101. //------------------------------------------------------------------------------
  102.  
  103. /**
  104.  * Construct a Windows AutoPlay service object.
  105.  */
  106.  
  107. function sbWindowsAutoPlayService() {
  108.   // Initialize.
  109.   this._initialize();
  110. }
  111.  
  112. // Define the object prototype.
  113. sbWindowsAutoPlayService.prototype = {
  114.   // Set the constructor.
  115.   constructor: sbWindowsAutoPlayService,
  116.  
  117.   //
  118.   // Windows AutoPlay service fields.
  119.   //
  120.   //   classDescription         Description of component class.
  121.   //   classID                  Component class ID.
  122.   //   contractID               Component contract ID.
  123.   //   _xpcom_categories        List of component categories.
  124.   //
  125.   //   _cfg                     Configuration settings.
  126.   //   _isInitialized           True if the services have been initialized.
  127.   //   _isProcessingEvents      True if processing Windows AutoPlay events.
  128.   //   _observerSet             Set of observers.
  129.   //   _actionHandlerTable      Table mapping AutoPlay actions to lists of
  130.   //                            action handlers.
  131.   //
  132.  
  133.   classDescription: sbWindowsAutoPlayServiceCfg.classDescription,
  134.   classID: sbWindowsAutoPlayServiceCfg.classID,
  135.   contractID: sbWindowsAutoPlayServiceCfg.contractID,
  136.   _xpcom_categories: sbWindowsAutoPlayServiceCfg._xpcom_categories,
  137.  
  138.   _cfg: sbWindowsAutoPlayServiceCfg,
  139.   _isInitialized: false,
  140.   _isProcessingEvents: false,
  141.   _observerSet: null,
  142.   _actionHandlerTable: null,
  143.  
  144.  
  145.   //----------------------------------------------------------------------------
  146.   //
  147.   // Windows AutoPlay sbIWindowsAutoPlayService services.
  148.   //
  149.   //----------------------------------------------------------------------------
  150.  
  151.   /**
  152.    * Add the action handler specified by aHandler as a handler for the AutoPlay
  153.    * action specified by aAction.
  154.    *
  155.    * \param aHandler            AutoPlay action handler.
  156.    * \param aAction             Action to handle.
  157.    */
  158.  
  159.   addActionHandler:
  160.     function sbWindowsAutoPlayService_addActionHandler(aHandler, aAction) {
  161.     // Get the action handler list, creating one if needed.
  162.     var actionHandlerList;
  163.     if (aAction in this._actionHandlerTable) {
  164.       actionHandlerList = this._actionHandlerTable[aAction];
  165.     } else {
  166.       actionHandlerList = [];
  167.       this._actionHandlerTable[aAction] = actionHandlerList;
  168.     }
  169.  
  170.     // Add the handler if it's not already in the list.
  171.     if (actionHandlerList.indexOf(aHandler) < 0)
  172.       actionHandlerList.push(aHandler);
  173.   },
  174.  
  175.  
  176.   /**
  177.    * Remove the action handler specified by aHandler as a handler for the
  178.    * AutoPlay action specified by aAction.
  179.    *
  180.    * \param aHandler            AutoPlay action handler.
  181.    * \param aAction             Action to handle.
  182.    */
  183.  
  184.   removeActionHandler:
  185.     function sbWindowsAutoPlayService_removeActionHandler(aHandler, aAction) {
  186.     // Do nothing if not initialized.  This allows clients to call this function
  187.     // if they're finalized after the Windows AutoPlay service is finalized.
  188.     if (!this._isInitialized)
  189.       return;
  190.  
  191.     // Get the action handler list.  Do nothing if no handlers for the action.
  192.     if (!(aAction in this._actionHandlerTable))
  193.       return;
  194.     var actionHandlerList = this._actionHandlerTable[aAction];
  195.  
  196.     // Remove handler from the list.
  197.     var handlerIndex = actionHandlerList.indexOf(aHandler);
  198.     if (handlerIndex >= 0)
  199.       actionHandlerList.splice(handlerIndex, 1);
  200.  
  201.     // Remove the action handler list if it's empty.
  202.     if (!actionHandlerList.length)
  203.       delete this._actionHandlerTable[aAction];
  204.   },
  205.  
  206.  
  207.   //----------------------------------------------------------------------------
  208.   //
  209.   // Windows AutoPlay nsIObserver services.
  210.   //
  211.   //----------------------------------------------------------------------------
  212.  
  213.   /**
  214.    * Handle the observed event specified by aSubject, aTopic, and aData.
  215.    *
  216.    * \param aSubject            Event subject.
  217.    * \param aTopic              Event topic.
  218.    * \param aData               Event data.
  219.    */
  220.  
  221.   observe: function sbWindowsAutoPlayService_observe(aSubject, aTopic, aData) {
  222.     // Dispatch processing of the event.
  223.     switch (aTopic) {
  224.       case "app-startup" :
  225.         this._handleAppStartup();
  226.         break;
  227.  
  228.       case "songbird-main-window-presented" :
  229.         this._handleSBMainWindowPresented();
  230.         break;
  231.  
  232.       case "quit-application-granted" :
  233.         this._handleQuitApplicationGranted();
  234.         break;
  235.  
  236.       default :
  237.         break;
  238.     }
  239.   },
  240.  
  241.  
  242.   //----------------------------------------------------------------------------
  243.   //
  244.   // Windows AutoPlay sbICommandLineFlagHandler services.
  245.   //
  246.   //----------------------------------------------------------------------------
  247.  
  248.   /**
  249.    * \brief Handle a command line flag
  250.    * \param aFlag The command line flag
  251.    * \param aParam The parameter for the flag
  252.    * \return Return true if the handler processed this item. Items that have
  253.    *         not been processed are passed on to the next command line item
  254.    *         handler
  255.    */
  256.  
  257.   handleFlag: function sbWindowsAutoPlayService_handleFlag(aFlag, aParam) {
  258.     // Dispatch processing of flag.  Return that flag was not processed if it is
  259.     // not recognized.
  260.     switch (aFlag)
  261.     {
  262.       case "autoplay-manage-volume-device" :
  263.         this._handleAutoPlayManageVolumeDevice();
  264.         break;
  265.  
  266.       case "autoplay-manage-mtp-device" :
  267.         this._handleAutoPlayManageMTPDevice();
  268.         break;
  269.  
  270.       case "autoplay-cd-rip" :
  271.         this._handleAutoPlayCDRip();
  272.         break;
  273.  
  274.       default :
  275.         return false;
  276.     }
  277.  
  278.     return true;
  279.   },
  280.  
  281.  
  282.   //----------------------------------------------------------------------------
  283.   //
  284.   // Windows AutoPlay nsISupports services.
  285.   //
  286.   //----------------------------------------------------------------------------
  287.  
  288.   QueryInterface: XPCOMUtils.generateQI(sbWindowsAutoPlayServiceCfg.ifList),
  289.  
  290.  
  291.   //----------------------------------------------------------------------------
  292.   //
  293.   // Windows AutoPlay action services.
  294.   //
  295.   //----------------------------------------------------------------------------
  296.  
  297.   /**
  298.    * Handle a Windows AutoPlay manage volume device action.
  299.    */
  300.  
  301.   _handleAutoPlayManageVolumeDevice:
  302.     function sbWindowsAutoPlayService__handleAutoPlayManageVolumeDevice() {
  303.     // Handle the action.
  304.     var actionHandled =
  305.           this._handleAction
  306.                  (Ci.sbIWindowsAutoPlayService.ACTION_MANAGE_VOLUME_DEVICE,
  307.                   null);
  308.  
  309.     // If the action was not handled, alert the user that the device cannot be
  310.     // managed.  Wait until a Songbird main window is available so it can be
  311.     // used as the parent of the alert.
  312.     if (!actionHandled) {
  313.       var windowWatcher = Cc["@songbirdnest.com/Songbird/window-watcher;1"]
  314.                             .getService(Ci.sbIWindowWatcher);
  315.       var _this = this;
  316.       var func = function(aWindow)
  317.                    { _this._alertUserCannotManageVolumeDevice(aWindow); };
  318.       windowWatcher.callWithWindow("Songbird:Main", func);
  319.     }
  320.   },
  321.  
  322.  
  323.   /**
  324.    * Handle a Windows AutoPlay manage MTP device action.
  325.    */
  326.  
  327.   _handleAutoPlayManageMTPDevice:
  328.     function sbWindowsAutoPlayService__handleAutoPlayManageMTPDevice() {
  329.     // Handle the action.
  330.     var actionHandled =
  331.           this._handleAction
  332.                  (Ci.sbIWindowsAutoPlayService.ACTION_MANAGE_MTP_DEVICE,
  333.                   null);
  334.  
  335.     // If the action was not handled, alert the user that the device cannot be
  336.     // managed.  Wait until a Songbird main window is available so it can be
  337.     // used as the parent of the alert.
  338.     if (!actionHandled) {
  339.       var windowWatcher = Cc["@songbirdnest.com/Songbird/window-watcher;1"]
  340.                             .getService(Ci.sbIWindowWatcher);
  341.       var _this = this;
  342.       var func = function(aWindow)
  343.                    { _this._alertUserCannotManageMTPDevice(aWindow); };
  344.       windowWatcher.callWithWindow("Songbird:Main", func);
  345.     }
  346.   },
  347.  
  348.  
  349.   /**
  350.    * Handle a CD Rip action
  351.    */
  352.  
  353.   _handleAutoPlayCDRip:
  354.     function sbWindowsAutoPlayService__handleAutoPlayCDRip() {
  355.     // Handle the action.
  356.     var actionHandled =
  357.           this._handleAction
  358.                  (Ci.sbIWindowsAutoPlayService.ACTION_CD_RIP,
  359.                   null);
  360.  
  361.     // If the action was not handled, alert the user that the device cannot be
  362.     // managed.  Wait until a Songbird main window is available so it can be
  363.     // used as the parent of the alert.
  364.     if (!actionHandled) {
  365.       var windowWatcher = Cc["@songbirdnest.com/Songbird/window-watcher;1"]
  366.                             .getService(Ci.sbIWindowWatcher);
  367.       var _this = this;
  368.       var func = function(aWindow)
  369.                    { _this._alertUserCannotCDRip(aWindow); };
  370.       windowWatcher.callWithWindow("Songbird:Main", func);
  371.     }
  372.   },
  373.  
  374.  
  375.   /**
  376.    * Handle the Windows AutoPlay action specified by aAction with the argument
  377.    * specified by aActionArg.  Return true if the action is handled.
  378.    *
  379.    * \param aAction             AutoPlay action to handle.
  380.    * \param aActionArg          Action argument.
  381.    *
  382.    * \return true               Action was handled.
  383.    */
  384.  
  385.   _handleAction: function sbWindowsAutoPlayService__handleAction(aAction,
  386.                                                                  aActionArg) {
  387.     // Get the action handler list.  Do nothing if no handlers for action.
  388.     if (!(aAction in this._actionHandlerTable))
  389.       return false;
  390.     var actionHandlerList = this._actionHandlerTable[aAction];
  391.  
  392.     // Dispatch action to the handlers until it's handled.
  393.     var actionHandled = false;
  394.     for (var i = 0; i < actionHandlerList.length; i++) {
  395.       var actionHandler = actionHandlerList[i];
  396.       try {
  397.         actionHandled = actionHandler.handleAction(aAction, aActionArg);
  398.       } catch (ex) {
  399.         Cu.reportError(ex);
  400.       }
  401.       if (actionHandled)
  402.         break;
  403.     }
  404.  
  405.     return actionHandled;
  406.   },
  407.  
  408.  
  409.   /**
  410.    * Alert the user that a volume device cannot be managed.  Use the window
  411.    * specified by aWindow for the parent window of the alert.
  412.    *
  413.    * \param aWindow             Parent window of alert.
  414.    */
  415.  
  416.   _alertUserCannotManageVolumeDevice: function
  417.     sbWindowsAutoPlayService__alertUserCannotManageVolumeDevice(aWindow) {
  418.     // Get the application services.
  419.     var Application = Cc["@mozilla.org/fuel/application;1"]
  420.                         .getService(Ci.fuelIApplication);
  421.  
  422.     // Determine which dialog strings to use.
  423.     var stringNamePrefix = "windows.autoplay.cannot_manage_device.dialog.";
  424.     if (Application.extensions.has("msc@songbirdnest.com")) {
  425.       if (!Application.extensions.get("msc@songbirdnest.com").enabled) {
  426.         stringNamePrefix =
  427.           "windows.autoplay.cannot_manage_device.msc_not_enabled.dialog.";
  428.       }
  429.     } else {
  430.       stringNamePrefix =
  431.         "windows.autoplay.cannot_manage_device.msc_not_installed.dialog.";
  432.     }
  433.  
  434.     // Alert user.
  435.     var prompter = Cc["@songbirdnest.com/Songbird/Prompter;1"]
  436.                      .createInstance(Ci.sbIPrompter);
  437.     var title = SBString(stringNamePrefix + "title");
  438.     var msg = SBString(stringNamePrefix + "msg");
  439.     prompter.alert(aWindow, title, msg);
  440.   },
  441.  
  442.  
  443.   /**
  444.    * Alert the user that an MTP device cannot be managed.  Use the window
  445.    * specified by aWindow for the parent window of the alert.
  446.    *
  447.    * \param aWindow             Parent window of alert.
  448.    */
  449.  
  450.   _alertUserCannotManageMTPDevice: function
  451.     sbWindowsAutoPlayService__alertUserCannotManageMTPDevice(aWindow) {
  452.     // Get the application services.
  453.     var Application = Cc["@mozilla.org/fuel/application;1"]
  454.                         .getService(Ci.fuelIApplication);
  455.  
  456.     // Determine which dialog strings to use.
  457.     var stringNamePrefix = "windows.autoplay.cannot_manage_device.dialog.";
  458.     if (Application.extensions.has("mtp@songbirdnest.com")) {
  459.       if (!Application.extensions.get("mtp@songbirdnest.com").enabled) {
  460.         stringNamePrefix =
  461.           "windows.autoplay.cannot_manage_device.mtp_not_enabled.dialog.";
  462.       }
  463.     } else {
  464.       stringNamePrefix =
  465.         "windows.autoplay.cannot_manage_device.mtp_not_installed.dialog.";
  466.     }
  467.  
  468.     // Alert user.
  469.     var prompter = Cc["@songbirdnest.com/Songbird/Prompter;1"]
  470.                      .createInstance(Ci.sbIPrompter);
  471.     var title = SBString(stringNamePrefix + "title");
  472.     var msg = SBString(stringNamePrefix + "msg");
  473.     prompter.alert(aWindow, title, msg);
  474.   },
  475.  
  476.  
  477.   /**
  478.    * Alert the user that the CD cannot be ripped. Use the window specified
  479.    * by aWindow for the parent window of the alert.
  480.    *
  481.    * \param aWindow             Parent window of the alert.
  482.    */
  483.  
  484.   _alertUserCannotCDRip:
  485.     function sbWindowsAutoPlayService__alertUserCannotCDRip(aWindow) {
  486.     var prefix = "windows.autoplay.cannot_cd_rip.dialog.";
  487.     var prompter = Cc["@songbirdnest.com/Songbird/Prompter;1"]
  488.                      .createInstance(Ci.sbIPrompter);
  489.     var title = SBString(prefix + "title");
  490.     var msg = SBString(prefix + "msg");
  491.     prompter.alert(aWindow, title, msg);
  492.   },
  493.  
  494.   //----------------------------------------------------------------------------
  495.   //
  496.   // Windows AutoPlay event handler services.
  497.   //
  498.   //----------------------------------------------------------------------------
  499.  
  500.   /**
  501.    * Handle application startup events.
  502.    */
  503.  
  504.   _handleAppStartup: function sbWindowsAutoPlayService__handleAppStartup() {
  505.     // Initialize the services.
  506.     this._initialize();
  507.   },
  508.  
  509.  
  510.   /**
  511.    * Handle Songbird main window presented events.
  512.    */
  513.  
  514.   _handleSBMainWindowPresented:
  515.     function sbWindowsAutoPlayService__handleSBMainWindowPresented() {
  516.     // Start processing Windows AutoPlay events.
  517.     // Wait until the maing window is presented so that all clients can register
  518.     // AutoPlay handlers.
  519.     this._start();
  520.   },
  521.  
  522.  
  523.   /**
  524.    * Handle quit application granted events.
  525.    */
  526.  
  527.   _handleQuitApplicationGranted:
  528.     function sbWindowsAutoPlayService__handleQuitApplicationGranted() {
  529.     // Finalize the services.
  530.     this._finalize();
  531.   },
  532.  
  533.  
  534.   //----------------------------------------------------------------------------
  535.   //
  536.   // Windows AutoPlay command line services.
  537.   //
  538.   //----------------------------------------------------------------------------
  539.  
  540.   /**
  541.    * Start Windows AutoPlay command line event processing.
  542.    */
  543.  
  544.   _startCommandLine: function sbWindowsAutoPlayService__startCommandLine() {
  545.     // Get the Songbird command line manager.
  546.     var commandLineManager =
  547.       Cc["@songbirdnest.com/commandlinehandler/general-startup;1?type=songbird"]
  548.         .getService(Ci.sbICommandLineManager);
  549.  
  550.     // Add Windows AutoPlay command line flag handlers.
  551.     commandLineManager.addFlagHandler(this, "autoplay-manage-volume-device");
  552.     commandLineManager.addFlagHandler(this, "autoplay-manage-mtp-device");
  553.  
  554.     // Add Windows CD AutoPlay rip command line flag handlers
  555.     commandLineManager.addFlagHandler(this, "autoplay-cd-rip");
  556.   },
  557.  
  558.  
  559.   /**
  560.    * Stop Windows AutoPlay command line event processing.
  561.    */
  562.  
  563.   _stopCommandLine: function sbWindowsAutoPlayService__stopCommandLine() {
  564.     // Get the Songbird command line manager.
  565.     var commandLineManager =
  566.       Cc["@songbirdnest.com/commandlinehandler/general-startup;1?type=songbird"]
  567.         .getService(Ci.sbICommandLineManager);
  568.  
  569.     // Remove Windows AutoPlay command line flag handlers.
  570.     commandLineManager.removeFlagHandler(this, "autoplay-manage-volume-device");
  571.  
  572.     // Remove Windows CD AutoPlay rip command line flag handlers
  573.     commandLineManager.removeFlagHandler(this, "autoplay-cd-rip");
  574.   },
  575.  
  576.  
  577.   //----------------------------------------------------------------------------
  578.   //
  579.   // Internal Windows AutoPlay services.
  580.   //
  581.   //----------------------------------------------------------------------------
  582.  
  583.   /**
  584.    * Initialize the services.
  585.    */
  586.  
  587.   _initialize: function sbWindowsAutoPlayService__initialize() {
  588.     // Do nothing if already initialized.
  589.     if (this._isInitialized)
  590.       return;
  591.  
  592.     // Initialize the action handler table.
  593.     this._actionHandlerTable = {};
  594.  
  595.     // Set up observers.
  596.     if (!this._observerSet) {
  597.       this._observerSet = new ObserverSet();
  598.       this._observerSet.add(this,
  599.                             "songbird-main-window-presented",
  600.                             false,
  601.                             false);
  602.       this._observerSet.add(this, "quit-application-granted", false, false);
  603.     }
  604.  
  605.     // Initialization is now complete.
  606.     this._isInitialized = true;
  607.   },
  608.  
  609.  
  610.   /**
  611.    * Finalize the services.
  612.    */
  613.  
  614.   _finalize: function sbWindowsAutoPlayService__finalize() {
  615.     // Remove observers.
  616.     if (this._observerSet) {
  617.       this._observerSet.removeAll();
  618.       this._observerSet = null;
  619.     }
  620.  
  621.     // Stop processing Windows AutoPlay events.
  622.     this._stop();
  623.  
  624.     // Remove object references.
  625.     this._actionHandlerTable = null;
  626.  
  627.     // No longer initialized.
  628.     this._isInitialized = false;
  629.   },
  630.  
  631.  
  632.   /**
  633.    * Start processing AutoPlay events.
  634.    */
  635.  
  636.   _start: function sbWindowsAutoPlayService__start() {
  637.     // Do nothing if already processing events.  Immediately indicate that
  638.     // Windows AutoPlay events are being processed to avoid re-entrancy issues.
  639.     if (this._isProcessingEvents)
  640.       return;
  641.     this._isProcessingEvents = true;
  642.  
  643.     // Start command line event processing.
  644.     this._startCommandLine();
  645.   },
  646.  
  647.  
  648.   /**
  649.    * Stop processing AutoPlay events.
  650.    */
  651.  
  652.   _stop: function sbWindowsAutoPlayService__stop() {
  653.     // Do nothing if not processing events.
  654.     if (!this._isProcessingEvents)
  655.       return;
  656.  
  657.     // Stop command line event processing.
  658.     this._stopCommandLine();
  659.  
  660.     // Indicate that Windows AutoPlay events are no longer being processed.
  661.     this._isProcessingEvents = false;
  662.   }
  663. };
  664.  
  665.  
  666. //------------------------------------------------------------------------------
  667. //
  668. // Windows AutoPlay service component services.
  669. //
  670. //------------------------------------------------------------------------------
  671.  
  672. function NSGetModule(compMgr, fileSpec) {
  673.   return XPCOMUtils.generateModule([sbWindowsAutoPlayService]);
  674. }
  675.  
  676.  
  677.