michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * vim: sw=2 ts=2 sts=2 et 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: const Cc = Components.classes; michael@0: const Ci = Components.interfaces; michael@0: michael@0: Components.utils.import("resource://gre/modules/NetUtil.jsm"); michael@0: Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); michael@0: michael@0: const SCHEME = "place"; michael@0: const URL = "chrome://browser/content/places/content-ui/controller.xhtml"; michael@0: michael@0: function PlacesProtocolHandler() {} michael@0: michael@0: PlacesProtocolHandler.prototype = { michael@0: scheme: SCHEME, michael@0: defaultPort: -1, michael@0: protocolFlags: Ci.nsIProtocolHandler.URI_DANGEROUS_TO_LOAD | michael@0: Ci.nsIProtocolHandler.URI_IS_LOCAL_RESOURCE | michael@0: Ci.nsIProtocolHandler.URI_NORELATIVE | michael@0: Ci.nsIProtocolHandler.URI_NOAUTH, michael@0: michael@0: newURI: function PPH_newURI(aSpec, aOriginCharset, aBaseUri) { michael@0: let uri = Cc["@mozilla.org/network/simple-uri;1"].createInstance(Ci.nsIURI); michael@0: uri.spec = aSpec; michael@0: return uri; michael@0: }, michael@0: michael@0: newChannel: function PPH_newChannel(aUri) { michael@0: let chan = NetUtil.newChannel(URL); michael@0: chan.originalURI = aUri; michael@0: return chan; michael@0: }, michael@0: michael@0: allowPort: function PPH_allowPort(aPort, aScheme) { michael@0: return false; michael@0: }, michael@0: michael@0: QueryInterface: XPCOMUtils.generateQI([ michael@0: Ci.nsIProtocolHandler michael@0: ]), michael@0: michael@0: classID: Components.ID("{6bcb9bde-9018-4443-a071-c32653469597}") michael@0: }; michael@0: michael@0: this.NSGetFactory = XPCOMUtils.generateNSGetFactory([PlacesProtocolHandler]);