Skip to content

Commit

Permalink
Use a -remote-control command line option instead of a FIREFOX_START_…
Browse files Browse the repository at this point in the history
…REMOTE_CONTROL environment variable
  • Loading branch information
pmorch committed Mar 2, 2013
1 parent f328947 commit f0b7f11
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 5 deletions.
5 changes: 4 additions & 1 deletion chrome.manifest
Expand Up @@ -2,6 +2,9 @@ content remotecontrol chrome/content/
skin remotecontrol classic/1.0 chrome/skin/
locale remotecontrol en-US chrome/locale/en-US/


overlay chrome://browser/content/browser.xul chrome://remotecontrol/content/ff-overlay.xul
style chrome://global/content/customizeToolbar.xul chrome://remotecontrol/skin/overlay.css

component {9D538A60-834E-11E2-8D9D-6F406188709B} components/commandLineHandler.js
contract @morch.com/remotecontrol/command-line-handler;1 {9D538A60-834E-11E2-8D9D-6F406188709B}
category command-line-handler m-remotecontrol-clh @morch.com/remotecontrol/command-line-handler;1
11 changes: 7 additions & 4 deletions chrome/content/overlay.js
Expand Up @@ -8,6 +8,7 @@ var remotecontrol;
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cr = Components.results;
const Cu = Components.utils;

// From http://javascript.crockford.com/prototypal.html
function object(o) {
Expand Down Expand Up @@ -258,13 +259,15 @@ remotecontrol = {
// nav-bar.
if (! button)
return;
var start = Components.classes["@mozilla.org/process/environment;1"]
.getService(Components.interfaces.nsIEnvironment)
.get('FIREFOX_START_REMOTE_CONTROL');
var start = Components.classes[
"@morch.com/remotecontrol/command-line-handler;1"
]
.getService()
.wrappedJSObject
.remoteControlFlag;
if (start) {
this.startControlSocket();
}

},

onToolbarButtonCommand: function(e) {
Expand Down
39 changes: 39 additions & 0 deletions components/commandLineHandler.js
@@ -0,0 +1,39 @@
"use strict";

const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;

Cu.import("resource://gre/modules/XPCOMUtils.jsm");

function commandLineHandler() {
this.wrappedJSObject = this;
}

commandLineHandler.prototype =
{

classDescription: "command line handler",
contractID: "@morch.com/remotecontrol/command-line-handler;1",
classID: Components.ID("9D538A60-834E-11E2-8D9D-6F406188709B"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsICommandLineHandler]),
_xpcom_categories: [{
category: "command-line-handler",
entry: "m-remotecontrol-clh"
}],

handle: function(cmdLine) {
try {
this.remoteControlFlag =
cmdLine.handleFlag("remote-control", false);
} catch (error) {
Cu.reportError("Command Line Handler failed: " + error);
}
},

helpInfo :
" -remote-control "+
"Start the Remote Control Extension automatically\n"
};

var NSGetFactory = XPCOMUtils.generateNSGetFactory([commandLineHandler])

0 comments on commit f0b7f11

Please sign in to comment.