115922 embedding work. no changes should be observed in current product this will only affect the embedded effort. This moves the command handler stuff from content xul to embedding/components/commandhandler. a=judd r=saari built on mac/windows/gmake with this we will be able to finish removing editorshell from the app and have a true embedded editor.akkana will pick this up after me and finish the embedding work.

git-svn-id: svn://10.0.0.236/trunk@113507 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mjudge%netscape.com
2002-02-02 05:13:56 +00:00
parent cafbcdfba1
commit 40f7d1b02e
60 changed files with 2185 additions and 113 deletions

View File

@@ -110,6 +110,7 @@ typedef unsigned long HMTX;
#include "nsILayoutHistoryState.h"
#include "nsTextFormatter.h"
#include "nsPIDOMWindow.h"
#include "nsPICommandUpdater.h"
#include "nsIController.h"
#include "nsIFocusController.h"
#include "nsGUIEvent.h"
@@ -228,6 +229,27 @@ void nsWebShell::InitFrameData()
SetMarginHeight(-1);
}
nsresult
nsWebShell::EnsureCommandHandler()
{
if (!mCommandManager)
{
mCommandManager = do_CreateInstance("@mozilla.org/embedcomp/command-manager;1");
if (!mCommandManager) return NS_ERROR_OUT_OF_MEMORY;
nsCOMPtr<nsPICommandUpdater> commandUpdater = do_QueryInterface(mCommandManager);
if (!commandUpdater) return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMWindow> domWindow = do_GetInterface(NS_STATIC_CAST(nsIInterfaceRequestor *, this));
nsresult rv = commandUpdater->Init(domWindow);
NS_ASSERTION(NS_SUCCEEDED(rv), "Initting command manager failed");
}
return mCommandManager ? NS_OK : NS_ERROR_FAILURE;
}
NS_IMPL_ADDREF_INHERITED(nsWebShell, nsDocShell)
NS_IMPL_RELEASE_INHERITED(nsWebShell, nsDocShell)
@@ -274,6 +296,13 @@ nsWebShell::GetInterface(const nsIID &aIID, void** aInstancePtr)
NS_ERROR_FAILURE);
return NS_OK;
}
else if(aIID.Equals(NS_GET_IID(nsICommandManager)))
{
NS_ENSURE_SUCCESS(EnsureCommandHandler(), NS_ERROR_FAILURE);
NS_ENSURE_SUCCESS(mCommandManager->QueryInterface(NS_GET_IID(nsICommandManager),
aInstancePtr), NS_ERROR_FAILURE);
return NS_OK;
}
if (!*aInstancePtr || NS_FAILED(rv))
return nsDocShell::GetInterface(aIID,aInstancePtr);