зеркало из https://github.com/mozilla/pjs.git
Fixed up to build (but not work) against the latest webshell stuff
This commit is contained in:
Родитель
440183335b
Коммит
860609d30f
|
@ -31,10 +31,13 @@
|
|||
#include "MozillaBrowser.h"
|
||||
#include "IEHtmlDocument.h"
|
||||
|
||||
#include "nsCWebBrowser.h"
|
||||
#include "nsFileSpec.h"
|
||||
#include "nsILocalFile.h"
|
||||
#include "nsIContentViewerFile.h"
|
||||
#include "nsIWebNavigation.h"
|
||||
|
||||
static NS_DEFINE_CID(kWindowCID, NS_WINDOW_CID);
|
||||
static NS_DEFINE_IID(kIWidgetIID, NS_IWIDGET_IID);
|
||||
|
||||
static const TCHAR *c_szInvalidArg = _T("Invalid parameter");
|
||||
static const TCHAR *c_szUninitialized = _T("Method called while control is uninitialized");
|
||||
|
@ -308,7 +311,7 @@ LRESULT CMozillaBrowser::OnPrint(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL&
|
|||
if (m_pIWebShell)
|
||||
{
|
||||
nsIContentViewer *pContentViewer = nsnull;
|
||||
res = m_pIWebShell->GetContentViewer(&pContentViewer);
|
||||
res = mDocShell->GetContentViewer(&pContentViewer);
|
||||
if (NS_SUCCEEDED(res))
|
||||
{
|
||||
nsCOMPtr<nsIContentViewerFile> spContentViewerFile = do_QueryInterface(pContentViewer);
|
||||
|
@ -665,28 +668,22 @@ HRESULT CMozillaBrowser::CreateWebShell()
|
|||
rv = m_pIPref->StartUp(); //Initialize the preference service
|
||||
rv = m_pIPref->ReadUserPrefs(); //Reads from default_prefs.js
|
||||
|
||||
// Create the web shell object
|
||||
rv = nsComponentManager::CreateInstance(kWebShellCID, nsnull,
|
||||
kIWebShellIID,
|
||||
(void**)&m_pIWebShell);
|
||||
if (NS_FAILED(rv))
|
||||
//------------------------------------------------------
|
||||
|
||||
|
||||
PRBool aAllowPlugins = PR_TRUE;
|
||||
|
||||
// Create top level window
|
||||
rv = nsComponentManager::CreateInstance(kWindowCID, nsnull,
|
||||
kIWidgetIID, (void**)&mWindow);
|
||||
if (NS_OK != rv)
|
||||
{
|
||||
NG_ASSERT(0);
|
||||
NG_TRACE(_T("Could not create web shell rv=%08x\n"), (int) rv);
|
||||
m_sErrorMessage = _T("Error - could not create web shell, check PATH settings");
|
||||
return E_FAIL;
|
||||
return rv;
|
||||
}
|
||||
|
||||
m_pIWebShell->QueryInterface(kIBaseWindowIID, (void **) &m_pIWebShellWin);
|
||||
|
||||
// Register the cookie service
|
||||
NS_WITH_SERVICE(nsICookieService, cookieService, kCookieServiceCID, &rv);
|
||||
if (NS_FAILED(rv) || (cookieService == nsnull)) {
|
||||
NG_TRACE(_T("Could not register the cookie manager. rv=%08x\n"), (int) rv);
|
||||
}
|
||||
// TODO make the cookie service persistent. Currently does not save or load cookies to/from disk.
|
||||
|
||||
// Initialise the web shell, making it fit the control dimensions
|
||||
nsWidgetInitData initData;
|
||||
initData.mWindowType = eWindowType_child;
|
||||
initData.mBorderStyle = eBorderStyle_none;
|
||||
|
||||
nsRect r;
|
||||
r.x = 0;
|
||||
|
@ -694,25 +691,48 @@ HRESULT CMozillaBrowser::CreateWebShell()
|
|||
r.width = rcLocation.right - rcLocation.left;
|
||||
r.height = rcLocation.bottom - rcLocation.top;
|
||||
|
||||
PRBool aAllowPlugins = PR_TRUE;
|
||||
PRBool aIsSunkenBorder = PR_FALSE;
|
||||
// TODO set parent window to this control
|
||||
mWindow->Create((nsIWidget*)NULL, r, nsnull, nsnull, nsnull, nsnull, &initData);
|
||||
mWindow->GetClientBounds(r);
|
||||
|
||||
rv = m_pIWebShell->Init(m_hWnd,
|
||||
r.x, r.y,
|
||||
r.width, r.height,
|
||||
aAllowPlugins,
|
||||
aIsSunkenBorder);
|
||||
|
||||
NG_ASSERT(NS_SUCCEEDED(rv));
|
||||
// Create web shell
|
||||
mWebBrowser = do_CreateInstance(NS_WEBBROWSER_PROGID, &rv);
|
||||
/* rv = nsComponentManager::CreateInstance(kWebShellCID, nsnull,
|
||||
NS_GET_IID(nsIDocShell),
|
||||
(void**)&mDocShell);
|
||||
*/
|
||||
if (NS_OK != rv)
|
||||
{
|
||||
return rv;
|
||||
}
|
||||
r.x = r.y = 0;
|
||||
nsCOMPtr<nsIBaseWindow> webBrowserWin(do_QueryInterface(mWebBrowser));
|
||||
rv = webBrowserWin->InitWindow(mWindow->GetNativeData(NS_NATIVE_WIDGET), nsnull, r.x, r.y, r.width, r.height);
|
||||
webBrowserWin->Create();
|
||||
mWebBrowser->GetDocShell(&mDocShell);
|
||||
mDocShell->SetAllowPlugins(aAllowPlugins);
|
||||
nsCOMPtr<nsIDocumentLoader> docLoader;
|
||||
nsCOMPtr<nsIWebShell> webShell(do_QueryInterface(mDocShell));
|
||||
webShell->SetContainer((nsIWebShellContainer*) this);
|
||||
|
||||
// Create the container object
|
||||
m_pWebShellContainer = new CWebShellContainer(this);
|
||||
m_pWebShellContainer->AddRef();
|
||||
|
||||
webShell->GetDocumentLoader(*getter_AddRefs(docLoader));
|
||||
if (docLoader)
|
||||
{
|
||||
docLoader->AddObserver(m_pWebShellContainer);
|
||||
}
|
||||
webBrowserWin->SetVisibility(PR_TRUE);
|
||||
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem(do_QueryInterface(mDocShell));
|
||||
docShellAsItem->SetTreeOwner(m_pWebShellContainer);
|
||||
|
||||
// m_pIWebShell->SetPrefs(m_pIPref);
|
||||
m_pIWebShell->SetContainer((nsIWebShellContainer*) m_pWebShellContainer);
|
||||
/// m_pIWebShell->SetObserver((nsIStreamObserver*) m_pWebShellContainer);
|
||||
m_pIWebShell->SetDocLoaderObserver((nsIDocumentLoaderObserver*) m_pWebShellContainer);
|
||||
webShell->SetContainer((nsIWebShellContainer*) m_pWebShellContainer);
|
||||
mDocShell->SetDocLoaderObserver((nsIDocumentLoaderObserver*) m_pWebShellContainer);
|
||||
// m_pIWebShell->SetWebShellType(nsWebShellContent);
|
||||
|
||||
m_pIWebShellWin->SetVisibility(PR_TRUE);
|
||||
|
@ -872,7 +892,7 @@ HRESULT CMozillaBrowser::GetPresShell(nsIPresShell **pPresShell)
|
|||
}
|
||||
|
||||
nsIContentViewer* pIContentViewer = nsnull;
|
||||
res = m_pIWebShell->GetContentViewer(&pIContentViewer);
|
||||
res = mDocShell->GetContentViewer(&pIContentViewer);
|
||||
if (NS_SUCCEEDED(res) && pIContentViewer)
|
||||
{
|
||||
nsIDocumentViewer* pIDocViewer = nsnull;
|
||||
|
@ -918,7 +938,7 @@ HRESULT CMozillaBrowser::GetDOMDocument(nsIDOMDocument **pDocument)
|
|||
}
|
||||
|
||||
nsIContentViewer * pCViewer = nsnull;
|
||||
res = m_pIWebShell->GetContentViewer(&pCViewer);
|
||||
res = mDocShell->GetContentViewer(&pCViewer);
|
||||
if (NS_SUCCEEDED(res) && pCViewer)
|
||||
{
|
||||
nsIDocumentViewer * pDViewer = nsnull;
|
||||
|
@ -1214,10 +1234,12 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::GoBack(void)
|
|||
NG_ASSERT(0);
|
||||
RETURN_E_UNEXPECTED();
|
||||
}
|
||||
|
||||
if (m_pIWebShell->CanBack() == NS_OK)
|
||||
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mWebBrowser));
|
||||
PRBool aCanGoBack = PR_FALSE;
|
||||
webNav->GetCanGoBack(&aCanGoBack);
|
||||
if (aCanGoBack == PR_TRUE)
|
||||
{
|
||||
m_pIWebShell->Back();
|
||||
webNav->GoBack();
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
|
@ -1234,9 +1256,12 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::GoForward(void)
|
|||
RETURN_E_UNEXPECTED();
|
||||
}
|
||||
|
||||
if (m_pIWebShell->CanForward() == NS_OK)
|
||||
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mWebBrowser));
|
||||
PRBool aCanGoForward = PR_FALSE;
|
||||
webNav->GetCanGoForward(&aCanGoForward);
|
||||
if (aCanGoForward == PR_TRUE)
|
||||
{
|
||||
m_pIWebShell->Forward();
|
||||
webNav->GoForward();
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
|
|
|
@ -302,7 +302,12 @@ protected:
|
|||
CIEHtmlDocumentInstance * m_pDocument;
|
||||
|
||||
// Mozilla interfaces
|
||||
nsIWebShell * m_pIWebShell;
|
||||
nsCOMPtr<nsIWebBrowser> mWebBrowser;
|
||||
nsIWidget * mWindow;
|
||||
nsIDocShell * mDocShell;
|
||||
|
||||
|
||||
nsIWebShell * m_pIWebShell;
|
||||
nsIBaseWindow * m_pIWebShellWin;
|
||||
nsIPref * m_pIPref;
|
||||
nsIEditor * m_pEditor;
|
||||
|
|
|
@ -89,6 +89,13 @@ typedef long int32;
|
|||
#include "nsIURL.h"
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsIBaseWindow.h"
|
||||
#include "nsIWebBrowser.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIDocShellTreeOwner.h"
|
||||
#include "nsIWebBrowserChrome.h"
|
||||
#include "nsIWebNavigation.h"
|
||||
#include "nsIDocumentLoader.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
|
|
@ -44,237 +44,287 @@ CWebShellContainer::~CWebShellContainer()
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// nsISupports implementation
|
||||
|
||||
|
||||
NS_IMPL_ADDREF(CWebShellContainer)
|
||||
NS_IMPL_RELEASE(CWebShellContainer)
|
||||
NS_IMPL_QUERY_HEAD(CWebShellContainer)
|
||||
NS_IMPL_QUERY_BODY(nsIBrowserWindow)
|
||||
NS_IMPL_QUERY_BODY(nsIStreamObserver)
|
||||
NS_IMPL_QUERY_BODY(nsIDocumentLoaderObserver)
|
||||
NS_IMPL_QUERY_BODY(nsIWebShellContainer)
|
||||
NS_IMPL_QUERY_TAIL(nsIStreamObserver)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(CWebShellContainer)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIWebBrowserChrome)
|
||||
// NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChrome)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDocShellTreeOwner)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIBaseWindow)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIStreamObserver)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDocumentLoaderObserver)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// nsIBrowserWindow implementation
|
||||
// nsIDocShellTreeOwner
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::Init(nsIAppShell* aAppShell, const nsRect& aBounds, PRUint32 aChromeMask, PRBool aAllowPlugins)
|
||||
CWebShellContainer::FindItemWithName(const PRUnichar* aName,
|
||||
nsIDocShellTreeItem* aRequestor, nsIDocShellTreeItem** aFoundItem)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::MoveTo(PRInt32 aX, PRInt32 aY)
|
||||
{
|
||||
NG_TRACE_METHOD(CWebShellContainer::MoveTo);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::SizeTo(PRInt32 aWidth, PRInt32 aHeight)
|
||||
{
|
||||
NG_TRACE_METHOD(CWebShellContainer::SizeTo);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::SizeWindowTo(PRInt32 aWidth, PRInt32 aHeight,
|
||||
PRBool aWidthTransient, PRBool aHeightTransient)
|
||||
{
|
||||
NG_TRACE_METHOD(CWebShellContainer::SizeWindowTo);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::SizeContentTo(PRInt32 aWidth, PRInt32 aHeight)
|
||||
{
|
||||
NG_TRACE_METHOD(CWebShellContainer::SizeContentTo);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::GetContentBounds(nsRect& aResult)
|
||||
{
|
||||
NG_TRACE_METHOD(CWebShellContainer::GetContentBounds);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::GetBounds(nsRect& aResult)
|
||||
{
|
||||
NG_TRACE_METHOD(CWebShellContainer::GetBounds);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::GetWindowBounds(nsRect& aResult)
|
||||
{
|
||||
NG_TRACE_METHOD(CWebShellContainer::GetWindowBounds);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::IsIntrinsicallySized(PRBool& aResult)
|
||||
{
|
||||
NG_TRACE_METHOD(CWebShellContainer::IsIntrinsicallySized);
|
||||
aResult = PR_FALSE;
|
||||
return NS_OK;
|
||||
NS_ERROR("Haven't Implemented this yet");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::ShowAfterCreation()
|
||||
CWebShellContainer::ContentShellAdded(nsIDocShellTreeItem* aContentShell,
|
||||
PRBool aPrimary, const PRUnichar* aID)
|
||||
{
|
||||
return NS_OK;
|
||||
NS_ERROR("Haven't Implemented this yet");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::Show()
|
||||
CWebShellContainer::GetPrimaryContentShell(nsIDocShellTreeItem** aShell)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::Hide()
|
||||
{
|
||||
NG_TRACE_METHOD(CWebShellContainer::Hide);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::Close()
|
||||
{
|
||||
NG_TRACE_METHOD(CWebShellContainer::Close);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::ShowModally(PRBool aPrepare)
|
||||
{
|
||||
NG_TRACE_METHOD(CWebShellContainer::ShowModally);
|
||||
return NS_OK;
|
||||
NS_ERROR("Haven't Implemented this yet");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::SetChrome(PRUint32 aNewChromeMask)
|
||||
CWebShellContainer::SizeShellTo(nsIDocShellTreeItem* aShell,
|
||||
PRInt32 aCX, PRInt32 aCY)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::GetChrome(PRUint32& aChromeMaskResult)
|
||||
{
|
||||
NG_TRACE_METHOD(CWebShellContainer::GetChrome);
|
||||
aChromeMaskResult = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::SetTitle(const PRUnichar* aTitle)
|
||||
{
|
||||
//Fire a title change event
|
||||
USES_CONVERSION;
|
||||
LPOLESTR pszConvertedLocationName = W2OLE(const_cast<PRUnichar *>(aTitle));
|
||||
BSTR __RPC_FAR LocationName = SysAllocString(pszConvertedLocationName);
|
||||
m_pEvents1->Fire_TitleChange(LocationName);
|
||||
m_pEvents2->Fire_TitleChange(LocationName);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::GetTitle(PRUnichar** aResult)
|
||||
{
|
||||
NG_TRACE_METHOD(CWebShellContainer::GetTitle);
|
||||
*aResult = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::SetStatus(const PRUnichar* aStatus)
|
||||
{
|
||||
|
||||
NG_TRACE_METHOD(CWebShellContainer::SetStatus);
|
||||
|
||||
//Gets fired on mouse over link events.
|
||||
BSTR bstrStatus = SysAllocString(W2OLE((PRUnichar *) aStatus));
|
||||
m_pEvents1->Fire_StatusTextChange(bstrStatus);
|
||||
m_pEvents2->Fire_StatusTextChange(bstrStatus);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::GetStatus(const PRUnichar** aResult)
|
||||
{
|
||||
NG_TRACE_METHOD(CWebShellContainer::GetStatus);
|
||||
*aResult = nsnull;
|
||||
return NS_OK;
|
||||
NS_ERROR("Haven't Implemented this yet");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::SetDefaultStatus(const PRUnichar* aStatus)
|
||||
CWebShellContainer::ShowModal()
|
||||
{
|
||||
NG_TRACE_METHOD(CWebShellContainer::SetDefaultStatus);
|
||||
return NS_OK;
|
||||
NS_ERROR("Haven't Implemented this yet");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP CWebShellContainer::GetNewWindow(PRInt32 aChromeFlags,
|
||||
nsIDocShellTreeItem** aDocShellTreeItem)
|
||||
{
|
||||
NS_ERROR("Haven't Implemented this yet");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::GetDefaultStatus(const PRUnichar** aResult)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// nsIBaseWindow
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::InitWindow(nativeWindow parentNativeWindow, nsIWidget * parentWidget, PRInt32 x, PRInt32 y, PRInt32 cx, PRInt32 cy)
|
||||
{
|
||||
NG_TRACE_METHOD(CWebShellContainer::GetDefaultStatus);
|
||||
*aResult = nsnull;
|
||||
return NS_OK;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::Create(void)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::Destroy(void)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::SetPosition(PRInt32 x, PRInt32 y)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::GetPosition(PRInt32 *x, PRInt32 *y)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::SetSize(PRInt32 cx, PRInt32 cy, PRBool fRepaint)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::GetSize(PRInt32 *cx, PRInt32 *cy)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::SetPositionAndSize(PRInt32 x, PRInt32 y, PRInt32 cx, PRInt32 cy, PRBool fRepaint)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::GetPositionAndSize(PRInt32 *x, PRInt32 *y, PRInt32 *cx, PRInt32 *cy)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::Repaint(PRBool force)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::GetParentWidget(nsIWidget * *aParentWidget)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::SetParentWidget(nsIWidget * aParentWidget)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::GetParentNativeWindow(nativeWindow *aParentNativeWindow)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::SetParentNativeWindow(nativeWindow aParentNativeWindow)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::GetVisibility(PRBool *aVisibility)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::SetVisibility(PRBool aVisibility)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::GetMainWidget(nsIWidget * *aMainWidget)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::SetFocus(void)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::FocusAvailable(nsIBaseWindow *aCurrentFocus, PRBool *aTookFocus)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::GetTitle(PRUnichar * *aTitle)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::SetTitle(const PRUnichar * aTitle)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// nsIWebBrowserChrome implementation
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::SetJSStatus(const PRUnichar *status)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::SetProgress(PRInt32 aProgress, PRInt32 aProgressMax)
|
||||
CWebShellContainer::SetJSDefaultStatus(const PRUnichar *status)
|
||||
{
|
||||
NG_TRACE_METHOD(CWebShellContainer::SetProgress);
|
||||
|
||||
return NS_OK;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::ShowMenuBar(PRBool aShow)
|
||||
CWebShellContainer::SetOverLink(const PRUnichar *link)
|
||||
{
|
||||
return NS_OK;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::GetWebShell(nsIWebShell*& aResult)
|
||||
CWebShellContainer::GetWebBrowser(nsIWebBrowser * *aWebBrowser)
|
||||
{
|
||||
NG_TRACE_METHOD(CWebShellContainer::GetWebShell);
|
||||
return NS_OK;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::GetContentWebShell(nsIWebShell **aResult)
|
||||
CWebShellContainer::SetWebBrowser(nsIWebBrowser * aWebBrowser)
|
||||
{
|
||||
NG_TRACE_METHOD(CWebShellContainer::GetContentWebShell);
|
||||
*aResult = nsnull;
|
||||
return NS_OK;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::GetChromeMask(PRUint32 *aChromeMask)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::SetChromeMask(PRUint32 aChromeMask)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::GetNewBrowser(PRUint32 chromeMask, nsIWebBrowser **_retval)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::FindNamedBrowser(const PRUnichar *aName, nsIWebBrowser **_retval)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::SizeBrowserTo(PRInt32 aCX, PRInt32 aCY)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::ShowAsModal(void)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -394,9 +444,13 @@ CWebShellContainer::EndLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, nsres
|
|||
CComVariant vURL(bstrURL);
|
||||
m_pEvents2->Fire_NavigateComplete2(m_pOwner, &vURL);
|
||||
|
||||
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(m_pOwner->mWebBrowser));
|
||||
|
||||
// Fire the new NavigateForward state
|
||||
VARIANT_BOOL bEnableForward = VARIANT_FALSE;
|
||||
if ( m_pOwner->m_pIWebShell->CanForward() == NS_OK )
|
||||
PRBool aCanGoForward = PR_FALSE;
|
||||
webNav->GetCanGoForward(&aCanGoForward);
|
||||
if (aCanGoForward == PR_TRUE)
|
||||
{
|
||||
bEnableForward = VARIANT_TRUE;
|
||||
}
|
||||
|
@ -404,7 +458,9 @@ CWebShellContainer::EndLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, nsres
|
|||
|
||||
// Fire the new NavigateBack state
|
||||
VARIANT_BOOL bEnableBack = VARIANT_FALSE;
|
||||
if ( m_pOwner->m_pIWebShell->CanBack() == NS_OK )
|
||||
PRBool aCanGoBack = PR_FALSE;
|
||||
webNav->GetCanGoBack(&aCanGoBack);
|
||||
if (aCanGoBack == PR_TRUE)
|
||||
{
|
||||
bEnableBack = VARIANT_TRUE;
|
||||
}
|
||||
|
@ -426,26 +482,6 @@ CWebShellContainer::NewWebShell(PRUint32 aChromeMask, PRBool aVisible, nsIWebShe
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::FindWebShellWithName(const PRUnichar* aName, nsIWebShell*& aResult)
|
||||
{
|
||||
USES_CONVERSION;
|
||||
NG_TRACE(_T("CWebShellContainer::FindWebShellWithName(\"%s\", ...)\n"), W2T(aName));
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// Zero result (in case we fail).
|
||||
aResult = nsnull;
|
||||
|
||||
if (m_pOwner->m_pIWebShell != NULL)
|
||||
{
|
||||
rv = m_pOwner->m_pIWebShell->FindChildWithName(aName, aResult);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebShellContainer::FocusAvailable(nsIWebShell* aFocusedWebShell, PRBool& aFocusTaken)
|
||||
{
|
||||
|
|
|
@ -26,10 +26,12 @@
|
|||
// interfaces into the web shell and so forth.
|
||||
|
||||
class CWebShellContainer :
|
||||
// public nsIBrowserWindow,
|
||||
public nsIBaseWindow,
|
||||
public nsIWebBrowserChrome,
|
||||
public nsIWebShellContainer,
|
||||
public nsIStreamObserver,
|
||||
public nsIDocumentLoaderObserver
|
||||
public nsIDocumentLoaderObserver,
|
||||
public nsIDocShellTreeOwner
|
||||
{
|
||||
public:
|
||||
CWebShellContainer(CMozillaBrowser *pOwner);
|
||||
|
@ -46,38 +48,11 @@ protected:
|
|||
CDWebBrowserEvents2 *m_pEvents2;
|
||||
|
||||
public:
|
||||
// nsISupports
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIBrowserWindow
|
||||
|
||||
NS_IMETHOD Init(nsIAppShell* aAppShell, const nsRect& aBounds, PRUint32 aChromeMask, PRBool aAllowPlugins = PR_TRUE);
|
||||
NS_IMETHOD MoveTo(PRInt32 aX, PRInt32 aY);
|
||||
NS_IMETHOD SizeTo(PRInt32 aWidth, PRInt32 aHeight);
|
||||
NS_IMETHOD GetContentBounds(nsRect& aResult);
|
||||
NS_IMETHOD GetBounds(nsRect& aResult);
|
||||
NS_IMETHOD GetWindowBounds(nsRect& aResult);
|
||||
NS_IMETHOD IsIntrinsicallySized(PRBool& aResult);
|
||||
NS_IMETHOD SizeWindowTo(PRInt32 aWidth, PRInt32 aHeight,
|
||||
PRBool aWidthTransient, PRBool aHeightTransient);
|
||||
NS_IMETHOD SizeContentTo(PRInt32 aWidth, PRInt32 aHeight);
|
||||
NS_IMETHOD ShowAfterCreation();
|
||||
NS_IMETHOD Show();
|
||||
NS_IMETHOD Hide();
|
||||
NS_IMETHOD Close();
|
||||
NS_IMETHOD ShowModally(PRBool aPrepare);
|
||||
NS_IMETHOD SetChrome(PRUint32 aNewChromeMask);
|
||||
NS_IMETHOD GetChrome(PRUint32& aChromeMaskResult);
|
||||
NS_IMETHOD SetTitle(const PRUnichar* aTitle);
|
||||
NS_IMETHOD GetTitle(PRUnichar** aResult);
|
||||
NS_IMETHOD SetStatus(const PRUnichar* aStatus);
|
||||
NS_IMETHOD GetStatus(const PRUnichar** aResult);
|
||||
NS_IMETHOD SetDefaultStatus(const PRUnichar* aStatus);
|
||||
NS_IMETHOD GetDefaultStatus(const PRUnichar** aResult);
|
||||
NS_IMETHOD SetProgress(PRInt32 aProgress, PRInt32 aProgressMax);
|
||||
NS_IMETHOD ShowMenuBar(PRBool aShow);
|
||||
NS_IMETHOD GetWebShell(nsIWebShell*& aResult);
|
||||
NS_IMETHOD GetContentWebShell(nsIWebShell **aResult);
|
||||
NS_DECL_NSIBASEWINDOW
|
||||
NS_DECL_NSIWEBBROWSERCHROME
|
||||
NS_DECL_NSIDOCSHELLTREEOWNER
|
||||
|
||||
// nsIWebShellContainer
|
||||
NS_IMETHOD WillLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, nsLoadType aReason);
|
||||
|
@ -87,7 +62,6 @@ public:
|
|||
NS_IMETHOD NewWebShell(PRUint32 aChromeMask,
|
||||
PRBool aVisible,
|
||||
nsIWebShell *&aNewWebShell);
|
||||
NS_IMETHOD FindWebShellWithName(const PRUnichar* aName, nsIWebShell*& aResult);
|
||||
NS_IMETHOD FocusAvailable(nsIWebShell* aFocusedWebShell, PRBool& aFocusTaken);
|
||||
NS_IMETHOD ContentShellAdded(nsIWebShell* aWebShell, nsIContent* frameNode);
|
||||
NS_IMETHOD CreatePopup(nsIDOMElement* aElement, nsIDOMElement* aPopupContent,
|
||||
|
|
|
@ -29,7 +29,6 @@ NS_DEFINE_CID(kCookieServiceCID, NS_COOKIESERVICE_CID);
|
|||
|
||||
// Interface IDs
|
||||
NS_DEFINE_IID(kIBaseWindowIID, NS_IBASEWINDOW_IID);
|
||||
NS_DEFINE_IID(kIBrowserWindowIID, NS_IBROWSER_WINDOW_IID);
|
||||
NS_DEFINE_IID(kIEventQueueServiceIID, NS_IEVENTQUEUESERVICE_IID);
|
||||
NS_DEFINE_IID(kIDocumentViewerIID, NS_IDOCUMENT_VIEWER_IID);
|
||||
NS_DEFINE_IID(kIDOMDocumentIID, NS_IDOMDOCUMENT_IID);
|
||||
|
|
Загрузка…
Ссылка в новой задаче