From 8e284ed5d1e64ced05bddcb5b701fb45466eed39 Mon Sep 17 00:00:00 2001 From: "locka%iol.ie" Date: Thu, 13 Apr 2000 16:28:43 +0000 Subject: [PATCH] Removed last vestiges of nsIWebShell (hurrah!) Not part of build git-svn-id: svn://10.0.0.236/trunk@65823 18797224-902f-48f8-a5cc-f745e15eee43 --- .../activex/src/control/MozillaBrowser.cpp | 64 +++++++------------ .../activex/src/control/MozillaBrowser.h | 3 - 2 files changed, 22 insertions(+), 45 deletions(-) diff --git a/mozilla/embedding/browser/activex/src/control/MozillaBrowser.cpp b/mozilla/embedding/browser/activex/src/control/MozillaBrowser.cpp index 419f4b84c9f..227ad4d4d95 100644 --- a/mozilla/embedding/browser/activex/src/control/MozillaBrowser.cpp +++ b/mozilla/embedding/browser/activex/src/control/MozillaBrowser.cpp @@ -95,7 +95,6 @@ CMozillaBrowser::CMozillaBrowser() // Initialize layout interfaces m_pIDocShell = nsnull; - m_pIWebShell = nsnull; m_pIWebShellWin = nsnull; m_pIPref = nsnull; m_pIServiceManager = nsnull; @@ -493,15 +492,18 @@ LRESULT CMozillaBrowser::OnViewSource(WORD wNotifyCode, WORD wID, HWND hWndCtl, { NG_TRACE_METHOD(CMozillaBrowser::OnViewSource); - // Get the url from the web shell - const PRUnichar *pszUrl = nsnull; - PRInt32 aHistoryIndex; - m_pIWebShell->GetHistoryIndex(aHistoryIndex); - m_pIWebShell->GetURL(aHistoryIndex, &pszUrl); + if (m_pWebShellContainer->m_pCurrentURI) + { + // No URI to view! + NG_ASSERT(0); + return 0; + } - nsString strUrl(pszUrl); - nsString strTemp(nsString("view-source:") + strUrl); - strUrl = strTemp; + // Get the current URI + nsXPIDLCString aURI; + m_pWebShellContainer->m_pCurrentURI->GetSpec(getter_Copies(aURI)); + + nsString strUrl = nsString("view-source:") + nsString(aURI); CIPtr(IDispatch) spDispNew; VARIANT_BOOL bCancel = VARIANT_FALSE; @@ -688,11 +690,7 @@ HRESULT CMozillaBrowser::CreateBrowser() // Create web shell m_pIWebBrowser = do_CreateInstance(NS_WEBBROWSER_PROGID, &rv); -/* rv = nsComponentManager::CreateInstance(kWebShellCID, nsnull, - NS_GET_IID(nsIDocShell), - (void**)&m_pIDocShell); -*/ - if (NS_OK != rv) + if (NS_FAILED(rv)) { return rv; } @@ -709,23 +707,12 @@ HRESULT CMozillaBrowser::CreateBrowser() m_pWebShellContainer->AddRef(); // Set up the web shell - m_pIDocShell->QueryInterface(NS_GET_IID(nsIWebShell), (void **) &m_pIWebShell); - NG_ASSERT(m_pIWebShell); - m_pIWebShell->SetContainer((nsIWebShellContainer*) m_pWebShellContainer); - m_pIWebShell->GetDocumentLoader(*getter_AddRefs(docLoader)); - - if (docLoader) - { - docLoader->AddObserver(m_pWebShellContainer); - } + m_pIWebBrowser->SetParentURIContentListener(m_pWebShellContainer); nsCOMPtr docShellAsItem(do_QueryInterface(m_pIDocShell)); docShellAsItem->SetTreeOwner(m_pWebShellContainer); -// m_pIWebShell->SetPrefs(m_pIPref); m_pIDocShell->SetDocLoaderObserver((nsIDocumentLoaderObserver*) m_pWebShellContainer); -// m_pIWebShell->SetWebShellType(nsWebShellContent); - m_pIWebShellWin->SetVisibility(PR_TRUE); m_bValidBrowser = TRUE; @@ -754,11 +741,6 @@ HRESULT CMozillaBrowser::DestroyBrowser() NS_RELEASE(m_pIWebShellWin); } - if (m_pIWebShell != nsnull) - { - NS_RELEASE(m_pIWebShell); - } - if (m_pIDocShell != nsnull) { NS_RELEASE(m_pIDocShell); @@ -1959,19 +1941,17 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_LocationURL(BSTR __RPC_FAR *Locat } // Get the url from the web shell - const PRUnichar *pszUrl = nsnull; - PRInt32 aHistoryIndex; - m_pIWebShell->GetHistoryIndex(aHistoryIndex); - m_pIWebShell->GetURL(aHistoryIndex, &pszUrl); - if (pszUrl == nsnull) + if (m_pWebShellContainer->m_pCurrentURI != nsnull) { - return E_FAIL; + USES_CONVERSION; + nsXPIDLCString aURI; + m_pWebShellContainer->m_pCurrentURI->GetSpec(getter_Copies(aURI)); + *LocationURL = SysAllocString(A2OLE((const char *) aURI)); + } + else + { + *LocationURL = NULL; } - - // Convert the string to a BSTR - USES_CONVERSION; - LPOLESTR pszConvertedUrl = W2OLE(const_cast(pszUrl)); - *LocationURL = SysAllocString(pszConvertedUrl); return S_OK; } diff --git a/mozilla/embedding/browser/activex/src/control/MozillaBrowser.h b/mozilla/embedding/browser/activex/src/control/MozillaBrowser.h index c0deb327f3a..9f99702daf8 100644 --- a/mozilla/embedding/browser/activex/src/control/MozillaBrowser.h +++ b/mozilla/embedding/browser/activex/src/control/MozillaBrowser.h @@ -310,8 +310,6 @@ protected: nsIEditor * m_pEditor; nsIServiceManager * m_pIServiceManager; - nsIWebShell * m_pIWebShell; - #ifdef HACK_AROUND_NONREENTRANT_INITXPCOM // Flag that stops XPCOM from blowing up when called multiple times static BOOL m_bXPCOMInitialised; @@ -361,7 +359,6 @@ public: // IOleObject overrides virtual HRESULT STDMETHODCALLTYPE CMozillaBrowser::GetClientSite(IOleClientSite **ppClientSite); - // IWebBrowser implementation virtual HRESULT STDMETHODCALLTYPE GoBack(void); virtual HRESULT STDMETHODCALLTYPE GoForward(void);