michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /* michael@0: * -setDefaultBrowser commandline handler michael@0: * Makes the current executable the "default browser". michael@0: */ michael@0: michael@0: const Cc = Components.classes; michael@0: const Ci = Components.interfaces; michael@0: Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); michael@0: michael@0: function nsSetDefaultBrowser() {} michael@0: michael@0: nsSetDefaultBrowser.prototype = { michael@0: handle: function nsSetDefault_handle(aCmdline) { michael@0: if (aCmdline.handleFlag("setDefaultBrowser", false)) { michael@0: var shell = Cc["@mozilla.org/browser/shell-service;1"]. michael@0: getService(Ci.nsIShellService); michael@0: shell.setDefaultBrowser(true, true); michael@0: } michael@0: }, michael@0: michael@0: helpInfo: " -setDefaultBrowser Set this app as the default browser.\n", michael@0: michael@0: classID: Components.ID("{F57899D0-4E2C-4ac6-9E29-50C736103B0C}"), michael@0: QueryInterface: XPCOMUtils.generateQI([Ci.nsICommandLineHandler]), michael@0: }; michael@0: michael@0: this.NSGetFactory = XPCOMUtils.generateNSGetFactory([nsSetDefaultBrowser]);