mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
DOM changes for bug 349380 (better UI for registerContentHandler). r+sr=bzbarsky.
This commit is contained in:
parent
6a579c885f
commit
f384c540d5
@ -377,7 +377,7 @@ var WebContentConverterRegistrar = {
|
||||
* See nsIWebContentHandlerRegistrar
|
||||
*/
|
||||
registerProtocolHandler:
|
||||
function WCCR_registerProtocolHandler(protocol, uri, title) {
|
||||
function WCCR_registerProtocolHandler(protocol, uri, title, contentWindow) {
|
||||
// XXXben - for Firefox 2 we only support feed types
|
||||
return;
|
||||
|
||||
@ -393,7 +393,7 @@ var WebContentConverterRegistrar = {
|
||||
* preferences.
|
||||
*/
|
||||
registerContentHandler:
|
||||
function WCCR_registerContentHandler(contentType, uri, title) {
|
||||
function WCCR_registerContentHandler(contentType, uri, title, contentWindow) {
|
||||
LOG("registerContentHandler(" + contentType + "," + uri + "," + title + ")");
|
||||
|
||||
// XXXben - for Firefox 2 we only support feed types
|
||||
|
@ -38,6 +38,8 @@
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIDOMWindow;
|
||||
|
||||
/**
|
||||
* nsIWebContentHandlerRegistrar
|
||||
*
|
||||
@ -49,18 +51,22 @@
|
||||
* can invoke it.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(5184749d-8b4c-4fa5-900e-fb84a08f196a)]
|
||||
[scriptable, uuid(e6a75410-c93e-42bf-84ca-a5c3ec34a2f1)]
|
||||
interface nsIWebContentHandlerRegistrar : nsISupports
|
||||
{
|
||||
/**
|
||||
* Web Applications 1.0 Browser State: registerContentHandler
|
||||
* Allows web services to register themselves as handlers for certain content
|
||||
* types.
|
||||
* http://whatwg.org/specs/web-apps/current-work/
|
||||
* See also: nsIDOMClientInformation.idl
|
||||
* See documentation in nsIDOMClientInformation.idl
|
||||
* The additional contentWindow param for both methods represents the dom
|
||||
* content window from which the method has been called.
|
||||
*/
|
||||
void registerContentHandler(in DOMString mimeType, in DOMString uri, in DOMString title);
|
||||
void registerProtocolHandler(in DOMString protocol, in DOMString uri, in DOMString title);
|
||||
void registerContentHandler(in DOMString mimeType,
|
||||
in DOMString uri,
|
||||
in DOMString title,
|
||||
in nsIDOMWindow contentWindow);
|
||||
void registerProtocolHandler(in DOMString protocol,
|
||||
in DOMString uri,
|
||||
in DOMString title,
|
||||
in nsIDOMWindow contentWindow);
|
||||
};
|
||||
|
||||
%{ C++
|
||||
|
@ -8144,8 +8144,12 @@ nsNavigator::RegisterContentHandler(const nsAString& aMIMEType,
|
||||
{
|
||||
nsCOMPtr<nsIWebContentHandlerRegistrar> registrar =
|
||||
do_GetService(NS_WEBCONTENTHANDLERREGISTRAR_CONTRACTID);
|
||||
if (registrar)
|
||||
return registrar->RegisterContentHandler(aMIMEType, aURI, aTitle);
|
||||
if (registrar && mDocShell) {
|
||||
nsCOMPtr<nsIDOMWindow> contentDOMWindow(do_GetInterface(mDocShell));
|
||||
if (contentDOMWindow)
|
||||
return registrar->RegisterContentHandler(aMIMEType, aURI, aTitle,
|
||||
contentDOMWindow);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -8157,9 +8161,12 @@ nsNavigator::RegisterProtocolHandler(const nsAString& aProtocol,
|
||||
{
|
||||
nsCOMPtr<nsIWebContentHandlerRegistrar> registrar =
|
||||
do_GetService(NS_WEBCONTENTHANDLERREGISTRAR_CONTRACTID);
|
||||
if (registrar)
|
||||
return registrar->RegisterProtocolHandler(aProtocol, aURI, aTitle);
|
||||
if (registrar && mDocShell) {
|
||||
nsCOMPtr<nsIDOMWindow> contentDOMWindow(do_GetInterface(mDocShell));
|
||||
if (contentDOMWindow)
|
||||
return registrar->RegisterProtocolHandler(aProtocol, aURI, aTitle,
|
||||
contentDOMWindow);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user