зеркало из https://github.com/mozilla/gecko-dev.git
adding GetRootCommandDispatcher to nsPIDOMWindow for utility.
Needed for beta2+ bug 38673. r=hyatt
This commit is contained in:
Родитель
6115b41783
Коммит
537596e625
|
@ -28,6 +28,9 @@
|
|||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIDOMLocation.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIDOMXULCommandDispatcher.h"
|
||||
#include "nsIDocument.h"
|
||||
|
||||
class nsIDocShell;
|
||||
class nsIDOMWindow;
|
||||
|
@ -51,6 +54,10 @@ public:
|
|||
// This is private because activate/deactivate events are not part of the DOM spec.
|
||||
NS_IMETHOD Activate() = 0;
|
||||
NS_IMETHOD Deactivate() = 0;
|
||||
|
||||
NS_IMETHOD GetRootCommandDispatcher (
|
||||
nsIDocument * aDoc,
|
||||
nsIDOMXULCommandDispatcher ** aDispatcher)=0;
|
||||
};
|
||||
|
||||
#endif // nsPIDOMWindow_h__
|
||||
|
|
|
@ -2603,6 +2603,38 @@ NS_IMETHODIMP GlobalWindowImpl::Deactivate()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP GlobalWindowImpl::GetRootCommandDispatcher (
|
||||
nsIDocument * aDoc,
|
||||
nsIDOMXULCommandDispatcher ** aDispatcher)
|
||||
{
|
||||
if(!aDispatcher)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
*aDispatcher = nsnull;
|
||||
|
||||
if(!aDoc)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMXULCommandDispatcher> commandDispatcher;
|
||||
nsCOMPtr<nsIScriptGlobalObject> ourGlobal;
|
||||
aDoc->GetScriptGlobalObject(getter_AddRefs(ourGlobal));
|
||||
nsCOMPtr<nsIDOMWindow> rootWindow;
|
||||
nsCOMPtr<nsPIDOMWindow> ourWindow = do_QueryInterface(ourGlobal);
|
||||
if(ourWindow) {
|
||||
ourWindow->GetPrivateRoot(getter_AddRefs(rootWindow));
|
||||
if(rootWindow) {
|
||||
nsCOMPtr<nsIDOMDocument> rootDocument;
|
||||
rootWindow->GetDocument(getter_AddRefs(rootDocument));
|
||||
|
||||
nsCOMPtr<nsIDOMXULDocument> xulDoc = do_QueryInterface(rootDocument);
|
||||
if(xulDoc) {
|
||||
xulDoc->GetCommandDispatcher(aDispatcher);
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// GlobalWindowImpl::nsIDOMViewCSS
|
||||
//*****************************************************************************
|
||||
|
|
|
@ -151,6 +151,11 @@ public:
|
|||
NS_IMETHOD Activate();
|
||||
NS_IMETHOD Deactivate();
|
||||
|
||||
NS_IMETHOD GetRootCommandDispatcher (
|
||||
nsIDocument * aDoc,
|
||||
nsIDOMXULCommandDispatcher ** aDispatcher);
|
||||
|
||||
|
||||
// nsIDOMViewCSS
|
||||
NS_DECL_IDOMVIEWCSS
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче