Updated to reflect recent modifications

This commit is contained in:
locka%iol.ie 1998-10-03 22:35:08 +00:00
Родитель a936f5fe48
Коммит 037d54b7e6
13 изменённых файлов: 312 добавлений и 1505 удалений

Просмотреть файл

@ -3,6 +3,10 @@
#include "MozillaControl.h" #include "MozillaControl.h"
#include "MozillaBrowser.h" #include "MozillaBrowser.h"
#define NS_DEFAULT_PREFS "prefs.js"
#define NS_DEFAULT_PREFS_HOMEPAGE "browser.startup.homepage"
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// CMozillaBrowser // CMozillaBrowser
@ -13,11 +17,17 @@ CMozillaBrowser::CMozillaBrowser()
m_bWindowOnly = TRUE; m_bWindowOnly = TRUE;
m_bWndLess = FALSE; m_bWndLess = FALSE;
// Initialize layout interfaces
m_pIWebShell = nsnull; m_pIWebShell = nsnull;
#ifdef USE_NGPREF
m_pIPref = nsnull;
#endif
// Create the container that handles some things for us // Create the container that handles some things for us
m_pWebShellContainer = NULL; m_pWebShellContainer = NULL;
m_bBusy = FALSE;
PL_InitializeEventsLib(""); PL_InitializeEventsLib("");
// Register everything // Register everything
NS_SetupRegistry(); NS_SetupRegistry();
@ -33,7 +43,7 @@ STDMETHODIMP CMozillaBrowser::InterfaceSupportsErrorInfo(REFIID riid)
{ {
static const IID* arr[] = static const IID* arr[] =
{ {
&IID_IMozillaBrowser, &IID_IWebBrowser,
}; };
for (int i=0;i<sizeof(arr)/sizeof(arr[0]);i++) for (int i=0;i<sizeof(arr)/sizeof(arr[0]);i++)
{ {
@ -58,14 +68,27 @@ LRESULT CMozillaBrowser::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL&
LRESULT CMozillaBrowser::OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) LRESULT CMozillaBrowser::OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{ {
/* Destroy NGLayout... */ /* Destroy layout... */
if (m_pIWebShell != nsnull) if (m_pIWebShell != nsnull)
{ {
m_pIWebShell->Destroy(); m_pIWebShell->Destroy();
NS_RELEASE(m_pIWebShell); NS_RELEASE(m_pIWebShell);
}
if (m_pWebShellContainer)
{
m_pWebShellContainer->Release(); m_pWebShellContainer->Release();
m_pWebShellContainer = NULL; m_pWebShellContainer = NULL;
} }
#ifdef USE_NGPREF
if (m_pIPref)
{
m_pIPref->Shutdown();
NS_RELEASE(m_pIPref);
}
#endif
return 0; return 0;
} }
@ -81,6 +104,17 @@ LRESULT CMozillaBrowser::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& b
} }
BOOL CMozillaBrowser::IsValid()
{
if (m_pIWebShell == nsnull)
{
return FALSE;
}
return TRUE;
}
HRESULT CMozillaBrowser::OnDraw(ATL_DRAWINFO& di) HRESULT CMozillaBrowser::OnDraw(ATL_DRAWINFO& di)
{ {
if (m_pIWebShell == nsnull) if (m_pIWebShell == nsnull)
@ -108,6 +142,15 @@ HRESULT CMozillaBrowser::CreateWebShell()
nsresult rv; nsresult rv;
// Load preferences
#ifdef USE_NGPREF
rv = nsRepository::CreateInstance(kPrefCID, NULL, kIPrefIID, (void **) &m_pIPref);
if (NS_OK != rv) {
return E_FAIL;
}
m_pIPref->Startup(NS_DEFAULT_PREFS);
#endif
rv = nsRepository::CreateInstance(kWebShellCID, nsnull, rv = nsRepository::CreateInstance(kWebShellCID, nsnull,
kIWebShellIID, kIWebShellIID,
(void**)&m_pIWebShell); (void**)&m_pIWebShell);
@ -130,24 +173,16 @@ HRESULT CMozillaBrowser::CreateWebShell()
nsScrollPreference_kAuto, aAllowPlugins); nsScrollPreference_kAuto, aAllowPlugins);
// Create the container object // Create the container object
m_pWebShellContainer = new CWebShellContainer; m_pWebShellContainer = new CWebShellContainer(this);
m_pWebShellContainer->AddRef(); m_pWebShellContainer->AddRef();
m_pIWebShell->SetContainer((nsIWebShellContainer*) m_pWebShellContainer); m_pIWebShell->SetContainer((nsIWebShellContainer*) m_pWebShellContainer);
// m_pIWebShell->SetObserver((nsIStreamObserver*)this); m_pIWebShell->SetObserver((nsIStreamObserver*) m_pWebShellContainer);
// m_pIWebShell->SetPrefs(aPrefs); #ifdef USE_NGPREF
m_pIWebShell->SetPrefs(m_pIPref);
#endif
m_pIWebShell->Show(); m_pIWebShell->Show();
// TODO
// -- remove
// Use the IWebBrowser::Navigate() method
USES_CONVERSION;
LPOLESTR pszUrl = T2OLE(_T("http://www.mozilla.org"));
BSTR bstrUrl = ::SysAllocString(pszUrl);
Navigate(bstrUrl, NULL, NULL, NULL, NULL);
::SysFreeString(bstrUrl);
// -- remove
return S_OK; return S_OK;
} }
@ -156,12 +191,12 @@ HRESULT CMozillaBrowser::CreateWebShell()
HRESULT STDMETHODCALLTYPE CMozillaBrowser::GoBack(void) HRESULT STDMETHODCALLTYPE CMozillaBrowser::GoBack(void)
{ {
if (m_pIWebShell == nsnull) if (!IsValid())
{ {
return E_UNEXPECTED; return E_UNEXPECTED;
} }
if (m_pIWebShell->CanBack()) if (m_pIWebShell->CanBack() == NS_OK)
{ {
m_pIWebShell->Back(); m_pIWebShell->Back();
} }
@ -172,12 +207,12 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::GoBack(void)
HRESULT STDMETHODCALLTYPE CMozillaBrowser::GoForward(void) HRESULT STDMETHODCALLTYPE CMozillaBrowser::GoForward(void)
{ {
if (m_pIWebShell == nsnull) if (!IsValid())
{ {
return E_UNEXPECTED; return E_UNEXPECTED;
} }
if (m_pIWebShell->CanForward()) if (m_pIWebShell->CanForward() == NS_OK)
{ {
m_pIWebShell->Forward(); m_pIWebShell->Forward();
} }
@ -188,14 +223,30 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::GoForward(void)
HRESULT STDMETHODCALLTYPE CMozillaBrowser::GoHome(void) HRESULT STDMETHODCALLTYPE CMozillaBrowser::GoHome(void)
{ {
if (m_pIWebShell == nsnull) if (!IsValid())
{ {
return E_UNEXPECTED; return E_UNEXPECTED;
} }
// TODO find and navigate to the home page somehow
USES_CONVERSION; USES_CONVERSION;
Navigate(T2OLE(_T("http://home.netscape.com")), NULL, NULL, NULL, NULL);
// Find the home page stored in prefs
TCHAR * sUrl = _T("http://home.netscape.com");
#ifdef USE_NGPREF
if (m_pIPref)
{
char szBuffer[512];
nsresult rv;
memset(szBuffer, 0, sizeof(szBuffer);
rv = m_pIPref->GetCharPref(NS_DEFAULT_PREFS_HOMEPAGE, szBuffer, sizeof(szBuffer));
if (rv == NS_OK)
{
sUrl = A2T(szBuffer);
}
}
#endif
// Navigate to the home page
Navigate(T2OLE(sUrl), NULL, NULL, NULL, NULL);
return S_OK; return S_OK;
} }
@ -203,15 +254,18 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::GoHome(void)
HRESULT STDMETHODCALLTYPE CMozillaBrowser::GoSearch(void) HRESULT STDMETHODCALLTYPE CMozillaBrowser::GoSearch(void)
{ {
if (m_pIWebShell == nsnull) if (!IsValid())
{ {
return E_UNEXPECTED; return E_UNEXPECTED;
} }
// TODO find and navigate to the search page somehow // TODO find and navigate to the search page stored in prefs
// and not this hard coded address
TCHAR * sUrl = _T("http://search.netscape.com");
USES_CONVERSION; USES_CONVERSION;
Navigate(T2OLE(_T("http://search.netscape.com")), NULL, NULL, NULL, NULL); Navigate(T2OLE(sUrl), NULL, NULL, NULL, NULL);
return S_OK; return S_OK;
} }
@ -219,7 +273,7 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::GoSearch(void)
HRESULT STDMETHODCALLTYPE CMozillaBrowser::Navigate(BSTR URL, VARIANT __RPC_FAR *Flags, VARIANT __RPC_FAR *TargetFrameName, VARIANT __RPC_FAR *PostData, VARIANT __RPC_FAR *Headers) HRESULT STDMETHODCALLTYPE CMozillaBrowser::Navigate(BSTR URL, VARIANT __RPC_FAR *Flags, VARIANT __RPC_FAR *TargetFrameName, VARIANT __RPC_FAR *PostData, VARIANT __RPC_FAR *Headers)
{ {
if (m_pIWebShell == nsnull) if (!IsValid())
{ {
return E_UNEXPECTED; return E_UNEXPECTED;
} }
@ -228,7 +282,6 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::Navigate(BSTR URL, VARIANT __RPC_FAR
nsString sUrl; nsString sUrl;
if (URL == NULL) if (URL == NULL)
{ {
// ASSERT(0);
return E_INVALIDARG; return E_INVALIDARG;
} }
else else
@ -252,28 +305,18 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::Navigate(BSTR URL, VARIANT __RPC_FAR
// Extract the target frame parameter // Extract the target frame parameter
nsString sTargetFrame; nsString sTargetFrame;
if (TargetFrameName) if (TargetFrameName && TargetFrameName->vt == VT_BSTR)
{ {
USES_CONVERSION; USES_CONVERSION;
CComVariant vTargetFrame; sTargetFrame = nsString(OLE2A(TargetFrameName->bstrVal));
if (VariantChangeType(TargetFrameName, &vTargetFrame, 0, VT_BSTR) != S_OK)
{
return E_INVALIDARG;
}
sTargetFrame = nsString(OLE2A(vTargetFrame.bstrVal));
} }
// Extract the post data parameter // Extract the post data parameter
nsString sPostData; nsString sPostData;
if (PostData) if (PostData && PostData->vt == VT_BSTR)
{ {
USES_CONVERSION; USES_CONVERSION;
CComVariant vPostData; sPostData = nsString(OLE2A(PostData->bstrVal));
if (VariantChangeType(PostData, &vPostData, 0, VT_BSTR) != S_OK)
{
return E_INVALIDARG;
}
sPostData = nsString(OLE2A(vPostData.bstrVal));
} }
@ -314,7 +357,7 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::Navigate(BSTR URL, VARIANT __RPC_FAR
HRESULT STDMETHODCALLTYPE CMozillaBrowser::Refresh(void) HRESULT STDMETHODCALLTYPE CMozillaBrowser::Refresh(void)
{ {
if (m_pIWebShell == nsnull) if (!IsValid())
{ {
return E_UNEXPECTED; return E_UNEXPECTED;
} }
@ -327,7 +370,7 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::Refresh(void)
HRESULT STDMETHODCALLTYPE CMozillaBrowser::Refresh2(VARIANT __RPC_FAR *Level) HRESULT STDMETHODCALLTYPE CMozillaBrowser::Refresh2(VARIANT __RPC_FAR *Level)
{ {
if (m_pIWebShell == nsnull) if (!IsValid())
{ {
return E_UNEXPECTED; return E_UNEXPECTED;
} }
@ -343,7 +386,7 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::Refresh2(VARIANT __RPC_FAR *Level)
HRESULT STDMETHODCALLTYPE CMozillaBrowser::Stop() HRESULT STDMETHODCALLTYPE CMozillaBrowser::Stop()
{ {
if (m_pIWebShell == nsnull) if (!IsValid())
{ {
return E_UNEXPECTED; return E_UNEXPECTED;
} }
@ -356,7 +399,7 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::Stop()
HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_Application(IDispatch __RPC_FAR *__RPC_FAR *ppDisp) HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_Application(IDispatch __RPC_FAR *__RPC_FAR *ppDisp)
{ {
if (m_pIWebShell == nsnull) if (!IsValid())
{ {
return E_UNEXPECTED; return E_UNEXPECTED;
} }
@ -368,7 +411,7 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_Application(IDispatch __RPC_FAR *
HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_Parent(IDispatch __RPC_FAR *__RPC_FAR *ppDisp) HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_Parent(IDispatch __RPC_FAR *__RPC_FAR *ppDisp)
{ {
if (m_pIWebShell == nsnull) if (!IsValid())
{ {
return E_UNEXPECTED; return E_UNEXPECTED;
} }
@ -380,7 +423,7 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_Parent(IDispatch __RPC_FAR *__RPC
HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_Container(IDispatch __RPC_FAR *__RPC_FAR *ppDisp) HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_Container(IDispatch __RPC_FAR *__RPC_FAR *ppDisp)
{ {
if (m_pIWebShell == nsnull) if (!IsValid())
{ {
return E_UNEXPECTED; return E_UNEXPECTED;
} }
@ -392,7 +435,7 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_Container(IDispatch __RPC_FAR *__
HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_Document(IDispatch __RPC_FAR *__RPC_FAR *ppDisp) HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_Document(IDispatch __RPC_FAR *__RPC_FAR *ppDisp)
{ {
if (m_pIWebShell == nsnull) if (!IsValid())
{ {
return E_UNEXPECTED; return E_UNEXPECTED;
} }
@ -401,10 +444,9 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_Document(IDispatch __RPC_FAR *__R
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_TopLevelContainer(VARIANT_BOOL __RPC_FAR *pBool) HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_TopLevelContainer(VARIANT_BOOL __RPC_FAR *pBool)
{ {
if (m_pIWebShell == nsnull) if (!IsValid())
{ {
return E_UNEXPECTED; return E_UNEXPECTED;
} }
@ -416,7 +458,7 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_TopLevelContainer(VARIANT_BOOL __
HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_Type(BSTR __RPC_FAR *Type) HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_Type(BSTR __RPC_FAR *Type)
{ {
if (m_pIWebShell == nsnull) if (!IsValid())
{ {
return E_UNEXPECTED; return E_UNEXPECTED;
} }
@ -428,132 +470,187 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_Type(BSTR __RPC_FAR *Type)
HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_Left(long __RPC_FAR *pl) HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_Left(long __RPC_FAR *pl)
{ {
if (m_pIWebShell == nsnull) if (!IsValid())
{ {
return E_UNEXPECTED; return E_UNEXPECTED;
} }
// TODO if (pl == NULL)
return E_NOTIMPL; {
return E_INVALIDARG;
}
*pl = 0; // TODO
return S_OK;
} }
HRESULT STDMETHODCALLTYPE CMozillaBrowser::put_Left(long Left) HRESULT STDMETHODCALLTYPE CMozillaBrowser::put_Left(long Left)
{ {
if (m_pIWebShell == nsnull) if (!IsValid())
{ {
return E_UNEXPECTED; return E_UNEXPECTED;
} }
// TODO // TODO
return E_NOTIMPL; return S_OK;
} }
HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_Top(long __RPC_FAR *pl) HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_Top(long __RPC_FAR *pl)
{ {
if (m_pIWebShell == nsnull) if (!IsValid())
{ {
return E_UNEXPECTED; return E_UNEXPECTED;
} }
// TODO if (pl == NULL)
{
return E_INVALIDARG;
}
*pl = 0; // TODO
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT STDMETHODCALLTYPE CMozillaBrowser::put_Top(long Top) HRESULT STDMETHODCALLTYPE CMozillaBrowser::put_Top(long Top)
{ {
if (m_pIWebShell == nsnull) if (!IsValid())
{ {
return E_UNEXPECTED; return E_UNEXPECTED;
} }
// TODO // TODO
return E_NOTIMPL; return S_OK;
} }
HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_Width(long __RPC_FAR *pl) HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_Width(long __RPC_FAR *pl)
{ {
if (m_pIWebShell == nsnull) if (!IsValid())
{ {
return E_UNEXPECTED; return E_UNEXPECTED;
} }
// TODO if (pl == NULL)
return E_NOTIMPL; {
return E_INVALIDARG;
}
*pl = 0; // TODO
return S_OK;
} }
HRESULT STDMETHODCALLTYPE CMozillaBrowser::put_Width(long Width) HRESULT STDMETHODCALLTYPE CMozillaBrowser::put_Width(long Width)
{ {
if (m_pIWebShell == nsnull) if (!IsValid())
{ {
return E_UNEXPECTED; return E_UNEXPECTED;
} }
// TODO // TODO
return E_NOTIMPL; return S_OK;
} }
HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_Height(long __RPC_FAR *pl) HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_Height(long __RPC_FAR *pl)
{ {
if (m_pIWebShell == nsnull) if (!IsValid())
{ {
return E_UNEXPECTED; return E_UNEXPECTED;
} }
// TODO if (pl == NULL)
return E_NOTIMPL; {
return E_INVALIDARG;
}
*pl = 0; // TODO
return S_OK;
} }
HRESULT STDMETHODCALLTYPE CMozillaBrowser::put_Height(long Height) HRESULT STDMETHODCALLTYPE CMozillaBrowser::put_Height(long Height)
{ {
if (m_pIWebShell == nsnull) if (!IsValid())
{ {
return E_UNEXPECTED; return E_UNEXPECTED;
} }
// TODO // TODO
return E_NOTIMPL; return S_OK;
} }
HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_LocationName(BSTR __RPC_FAR *LocationName) HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_LocationName(BSTR __RPC_FAR *LocationName)
{ {
if (m_pIWebShell == nsnull) if (!IsValid())
{ {
return E_UNEXPECTED; return E_UNEXPECTED;
} }
// TODO if (LocationName == NULL)
return E_NOTIMPL; {
return E_INVALIDARG;
}
// Get the url from the web shell
PRUnichar *pszLocationName = nsnull;
m_pIWebShell->GetTitle(&pszLocationName);
if (pszLocationName == nsnull)
{
return E_FAIL;
}
// Convert the string to a BSTR
USES_CONVERSION;
LPOLESTR pszConvertedLocationName = W2OLE(pszLocationName);
*LocationName = SysAllocString(pszConvertedLocationName);
return S_OK;
} }
HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_LocationURL(BSTR __RPC_FAR *LocationURL) HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_LocationURL(BSTR __RPC_FAR *LocationURL)
{ {
if (m_pIWebShell == nsnull) if (!IsValid())
{ {
return E_UNEXPECTED; return E_UNEXPECTED;
} }
// TODO if (LocationURL == NULL)
return E_NOTIMPL; {
return E_INVALIDARG;
}
// Get the url from the web shell
PRUnichar *pszUrl = nsnull;
m_pIWebShell->GetURL(0, &pszUrl);
if (pszUrl == nsnull)
{
return E_FAIL;
}
// Convert the string to a BSTR
USES_CONVERSION;
LPOLESTR pszConvertedUrl = W2OLE(pszUrl);
*LocationURL = SysAllocString(pszConvertedUrl);
return S_OK;
} }
HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_Busy(VARIANT_BOOL __RPC_FAR *pBool) HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_Busy(VARIANT_BOOL __RPC_FAR *pBool)
{ {
if (m_pIWebShell == nsnull) if (!IsValid())
{ {
return E_UNEXPECTED; return E_UNEXPECTED;
} }
// TODO if (!NgIsValidAddress(pBool, sizeof(*pBool)))
{
return E_NOTIMPL; return E_INVALIDARG;
}
*pBool = (m_bBusy) ? VARIANT_TRUE : VARIANT_FALSE;
return S_OK;
} }

Просмотреть файл

@ -18,7 +18,7 @@ class ATL_NO_VTABLE CMozillaBrowser :
public CComCoClass<CMozillaBrowser, &CLSID_MozillaBrowser>, public CComCoClass<CMozillaBrowser, &CLSID_MozillaBrowser>,
public CComControl<CMozillaBrowser>, public CComControl<CMozillaBrowser>,
public CProxyDWebBrowserEvents<CMozillaBrowser>, public CProxyDWebBrowserEvents<CMozillaBrowser>,
public CStockPropImpl<CMozillaBrowser, IMozillaBrowser, &IID_IMozillaBrowser, &LIBID_MOZILLACONTROLLib>, public CStockPropImpl<CMozillaBrowser, IWebBrowser, &IID_IWebBrowser, &LIBID_MOZILLACONTROLLib>,
public IProvideClassInfo2Impl<&CLSID_MozillaBrowser, &DIID_DWebBrowserEvents, &LIBID_MOZILLACONTROLLib>, public IProvideClassInfo2Impl<&CLSID_MozillaBrowser, &DIID_DWebBrowserEvents, &LIBID_MOZILLACONTROLLib>,
public IPersistStreamInitImpl<CMozillaBrowser>, public IPersistStreamInitImpl<CMozillaBrowser>,
public IPersistStorageImpl<CMozillaBrowser>, public IPersistStorageImpl<CMozillaBrowser>,
@ -31,10 +31,9 @@ class ATL_NO_VTABLE CMozillaBrowser :
public IDataObjectImpl<CMozillaBrowser>, public IDataObjectImpl<CMozillaBrowser>,
public ISupportErrorInfo, public ISupportErrorInfo,
public IConnectionPointContainerImpl<CMozillaBrowser>, public IConnectionPointContainerImpl<CMozillaBrowser>,
public ISpecifyPropertyPagesImpl<CMozillaBrowser>, public ISpecifyPropertyPagesImpl<CMozillaBrowser>
// Support for IE
public IDispatchImpl<IWebBrowser, &IID_IWebBrowser, &LIBID_MOZILLACONTROLLib>
{ {
friend CWebShellContainer;
public: public:
CMozillaBrowser(); CMozillaBrowser();
virtual ~CMozillaBrowser(); virtual ~CMozillaBrowser();
@ -42,8 +41,10 @@ public:
DECLARE_REGISTRY_RESOURCEID(IDR_MOZILLABROWSER) DECLARE_REGISTRY_RESOURCEID(IDR_MOZILLABROWSER)
BEGIN_COM_MAP(CMozillaBrowser) BEGIN_COM_MAP(CMozillaBrowser)
COM_INTERFACE_ENTRY(IMozillaBrowser) // IE web browser interface
COM_INTERFACE_ENTRY_IID(IID_IDispatch, IMozillaBrowser) COM_INTERFACE_ENTRY(IWebBrowser)
// COM_INTERFACE_ENTRY(IMozillaBrowser)
COM_INTERFACE_ENTRY_IID(IID_IDispatch, IWebBrowser)
COM_INTERFACE_ENTRY_IMPL(IViewObjectEx) COM_INTERFACE_ENTRY_IMPL(IViewObjectEx)
COM_INTERFACE_ENTRY_IMPL_IID(IID_IViewObject2, IViewObjectEx) COM_INTERFACE_ENTRY_IMPL_IID(IID_IViewObject2, IViewObjectEx)
COM_INTERFACE_ENTRY_IMPL_IID(IID_IViewObject, IViewObjectEx) COM_INTERFACE_ENTRY_IMPL_IID(IID_IViewObject, IViewObjectEx)
@ -53,7 +54,7 @@ BEGIN_COM_MAP(CMozillaBrowser)
COM_INTERFACE_ENTRY_IMPL(IOleInPlaceActiveObject) COM_INTERFACE_ENTRY_IMPL(IOleInPlaceActiveObject)
COM_INTERFACE_ENTRY_IMPL(IOleControl) COM_INTERFACE_ENTRY_IMPL(IOleControl)
COM_INTERFACE_ENTRY_IMPL(IOleObject) COM_INTERFACE_ENTRY_IMPL(IOleObject)
COM_INTERFACE_ENTRY_IMPL(IQuickActivate) // COM_INTERFACE_ENTRY_IMPL(IQuickActivate)
COM_INTERFACE_ENTRY_IMPL(IPersistStorage) COM_INTERFACE_ENTRY_IMPL(IPersistStorage)
COM_INTERFACE_ENTRY_IMPL(IPersistStreamInit) COM_INTERFACE_ENTRY_IMPL(IPersistStreamInit)
COM_INTERFACE_ENTRY_IMPL(ISpecifyPropertyPages) COM_INTERFACE_ENTRY_IMPL(ISpecifyPropertyPages)
@ -62,8 +63,6 @@ BEGIN_COM_MAP(CMozillaBrowser)
COM_INTERFACE_ENTRY(IProvideClassInfo2) COM_INTERFACE_ENTRY(IProvideClassInfo2)
COM_INTERFACE_ENTRY(ISupportErrorInfo) COM_INTERFACE_ENTRY(ISupportErrorInfo)
COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer) COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
// IE web browser interface
COM_INTERFACE_ENTRY(IWebBrowser)
END_COM_MAP() END_COM_MAP()
BEGIN_PROPERTY_MAP(CMozillaBrowser) BEGIN_PROPERTY_MAP(CMozillaBrowser)
@ -107,9 +106,16 @@ END_MSG_MAP()
// Protected members // Protected members
protected: protected:
CWebShellContainer * m_pWebShellContainer; CWebShellContainer * m_pWebShellContainer;
// Mozilla interfaces
nsIWebShell * m_pIWebShell; nsIWebShell * m_pIWebShell;
nsIPref * m_pIPref;
// Indicates the browser is busy doing something
BOOL m_bBusy;
virtual HRESULT CreateWebShell(); virtual HRESULT CreateWebShell();
virtual BOOL IsValid();
// IWebBrowser implementation // IWebBrowser implementation
public: public:
@ -139,7 +145,6 @@ public:
virtual HRESULT STDMETHODCALLTYPE get_LocationURL(BSTR __RPC_FAR *LocationURL); virtual HRESULT STDMETHODCALLTYPE get_LocationURL(BSTR __RPC_FAR *LocationURL);
virtual HRESULT STDMETHODCALLTYPE get_Busy(VARIANT_BOOL __RPC_FAR *pBool); virtual HRESULT STDMETHODCALLTYPE get_Busy(VARIANT_BOOL __RPC_FAR *pBool);
// IMozillaBrowser
public: public:
HRESULT OnDraw(ATL_DRAWINFO& di); HRESULT OnDraw(ATL_DRAWINFO& di);

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -12,18 +12,6 @@ import "ocidl.idl";
// import "exdisp.idl"; // import "exdisp.idl";
#include "exdispid.h" #include "exdispid.h"
[
object,
uuid(1339B54B-3453-11D2-93B9-000000000000),
dual,
helpstring("IMozillaBrowser Interface"),
pointer_default(unique)
]
interface IMozillaBrowser : IDispatch
{
[propget, id(DISPID_HWND)]
HRESULT Window([out, retval]long* phwnd);
};
[ [
uuid(1339B53E-3453-11D2-93B9-000000000000), uuid(1339B53E-3453-11D2-93B9-000000000000),
version(1.0), version(1.0),
@ -219,7 +207,7 @@ library MOZILLACONTROLLib
coclass MozillaBrowser coclass MozillaBrowser
{ {
[default] interface IWebBrowser; [default] interface IWebBrowser;
interface IMozillaBrowser; interface IDispatch;
// [default, source] dispinterface DWebBrowserEvents2; // [default, source] dispinterface DWebBrowserEvents2;
[default, source] dispinterface DWebBrowserEvents; [default, source] dispinterface DWebBrowserEvents;
}; };

Просмотреть файл

@ -97,6 +97,15 @@ END
IDR_MOZILLABROWSER REGISTRY DISCARDABLE "MozillaBrowser.rgs" IDR_MOZILLABROWSER REGISTRY DISCARDABLE "MozillaBrowser.rgs"
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_MOZILLABROWSER ICON DISCARDABLE "MozillaBrowser.ico"
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// String Table // String Table

Двоичные данные
webshell/embed/ActiveX/MozillaControl.tlb

Двоичный файл не отображается.

Просмотреть файл

@ -1,56 +0,0 @@
/* this file contains the actual definitions of */
/* the IIDs and CLSIDs */
/* link this file in with the server and any clients */
/* File created by MIDL compiler version 3.03.0110 */
/* at Sun Aug 23 21:54:29 1998
*/
/* Compiler settings for MozillaControl.idl:
Oicf (OptLev=i2), W1, Zp8, env=Win32, ms_ext, c_ext
error checks: none
*/
//@@MIDL_FILE_HEADING( )
#ifdef __cplusplus
extern "C"{
#endif
#ifndef __IID_DEFINED__
#define __IID_DEFINED__
typedef struct _IID
{
unsigned long x;
unsigned short s1;
unsigned short s2;
unsigned char c[8];
} IID;
#endif // __IID_DEFINED__
#ifndef CLSID_DEFINED
#define CLSID_DEFINED
typedef IID CLSID;
#endif // CLSID_DEFINED
const IID IID_IMozillaBrowser = {0x1339B54B,0x3453,0x11D2,{0x93,0xB9,0x00,0x00,0x00,0x00,0x00,0x00}};
const IID LIBID_MOZILLACONTROLLib = {0x1339B53E,0x3453,0x11D2,{0x93,0xB9,0x00,0x00,0x00,0x00,0x00,0x00}};
const IID IID_IWebBrowser = {0xEAB22AC1,0x30C1,0x11CF,{0xA7,0xEB,0x00,0x00,0xC0,0x5B,0xAE,0x0B}};
const IID DIID_DWebBrowserEvents = {0xEAB22AC2,0x30C1,0x11CF,{0xA7,0xEB,0x00,0x00,0xC0,0x5B,0xAE,0x0B}};
const CLSID CLSID_MozillaBrowser = {0x1339B54C,0x3453,0x11D2,{0x93,0xB9,0x00,0x00,0x00,0x00,0x00,0x00}};
#ifdef __cplusplus
}
#endif

Просмотреть файл

@ -1,277 +0,0 @@
/* this ALWAYS GENERATED file contains the proxy stub code */
/* File created by MIDL compiler version 3.03.0110 */
/* at Sun Aug 23 21:54:29 1998
*/
/* Compiler settings for MozillaControl.idl:
Oicf (OptLev=i2), W1, Zp8, env=Win32, ms_ext, c_ext
error checks: none
*/
//@@MIDL_FILE_HEADING( )
#define USE_STUBLESS_PROXY
/* verify that the <rpcproxy.h> version is high enough to compile this file*/
#ifndef __REDQ_RPCPROXY_H_VERSION__
#define __REQUIRED_RPCPROXY_H_VERSION__ 440
#endif
#include "rpcproxy.h"
#ifndef __RPCPROXY_H_VERSION__
#error this stub requires an updated version of <rpcproxy.h>
#endif // __RPCPROXY_H_VERSION__
#include "MozillaControl.h"
#define TYPE_FORMAT_STRING_SIZE 5
#define PROC_FORMAT_STRING_SIZE 25
typedef struct _MIDL_TYPE_FORMAT_STRING
{
short Pad;
unsigned char Format[ TYPE_FORMAT_STRING_SIZE ];
} MIDL_TYPE_FORMAT_STRING;
typedef struct _MIDL_PROC_FORMAT_STRING
{
short Pad;
unsigned char Format[ PROC_FORMAT_STRING_SIZE ];
} MIDL_PROC_FORMAT_STRING;
extern const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString;
extern const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString;
/* Object interface: IUnknown, ver. 0.0,
GUID={0x00000000,0x0000,0x0000,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}} */
/* Object interface: IDispatch, ver. 0.0,
GUID={0x00020400,0x0000,0x0000,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}} */
/* Object interface: IMozillaBrowser, ver. 0.0,
GUID={0x1339B54B,0x3453,0x11D2,{0x93,0xB9,0x00,0x00,0x00,0x00,0x00,0x00}} */
extern const MIDL_STUB_DESC Object_StubDesc;
extern const MIDL_SERVER_INFO IMozillaBrowser_ServerInfo;
#pragma code_seg(".orpc")
static const MIDL_STUB_DESC Object_StubDesc =
{
0,
NdrOleAllocate,
NdrOleFree,
0,
0,
0,
0,
0,
__MIDL_TypeFormatString.Format,
0, /* -error bounds_check flag */
0x20000, /* Ndr library version */
0,
0x303006e, /* MIDL Version 3.3.110 */
0,
0,
0, /* Reserved1 */
0, /* Reserved2 */
0, /* Reserved3 */
0, /* Reserved4 */
0 /* Reserved5 */
};
static const unsigned short IMozillaBrowser_FormatStringOffsetTable[] =
{
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
(unsigned short) -1,
0
};
static const MIDL_SERVER_INFO IMozillaBrowser_ServerInfo =
{
&Object_StubDesc,
0,
__MIDL_ProcFormatString.Format,
&IMozillaBrowser_FormatStringOffsetTable[-3],
0,
0,
0,
0
};
static const MIDL_STUBLESS_PROXY_INFO IMozillaBrowser_ProxyInfo =
{
&Object_StubDesc,
__MIDL_ProcFormatString.Format,
&IMozillaBrowser_FormatStringOffsetTable[-3],
0,
0,
0
};
CINTERFACE_PROXY_VTABLE(8) _IMozillaBrowserProxyVtbl =
{
&IMozillaBrowser_ProxyInfo,
&IID_IMozillaBrowser,
IUnknown_QueryInterface_Proxy,
IUnknown_AddRef_Proxy,
IUnknown_Release_Proxy ,
0 /* (void *)-1 /* IDispatch::GetTypeInfoCount */ ,
0 /* (void *)-1 /* IDispatch::GetTypeInfo */ ,
0 /* (void *)-1 /* IDispatch::GetIDsOfNames */ ,
0 /* IDispatch_Invoke_Proxy */ ,
(void *)-1 /* IMozillaBrowser::get_Window */
};
static const PRPC_STUB_FUNCTION IMozillaBrowser_table[] =
{
STUB_FORWARDING_FUNCTION,
STUB_FORWARDING_FUNCTION,
STUB_FORWARDING_FUNCTION,
STUB_FORWARDING_FUNCTION,
NdrStubCall2
};
CInterfaceStubVtbl _IMozillaBrowserStubVtbl =
{
&IID_IMozillaBrowser,
&IMozillaBrowser_ServerInfo,
8,
&IMozillaBrowser_table[-3],
CStdStubBuffer_DELEGATING_METHODS
};
#pragma data_seg(".rdata")
#if !defined(__RPC_WIN32__)
#error Invalid build platform for this stub.
#endif
#if !(TARGET_IS_NT40_OR_LATER)
#error You need a Windows NT 4.0 or later to run this stub because it uses these features:
#error -Oif or -Oicf.
#error However, your C/C++ compilation flags indicate you intend to run this app on earlier systems.
#error This app will die there with the RPC_X_WRONG_STUB_VERSION error.
#endif
static const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString =
{
0,
{
/* Procedure get_Window */
0x33, /* FC_AUTO_HANDLE */
0x64, /* 100 */
/* 2 */ NdrFcShort( 0x7 ), /* 7 */
#ifndef _ALPHA_
/* 4 */ NdrFcShort( 0xc ), /* x86, MIPS, PPC Stack size/offset = 12 */
#else
NdrFcShort( 0x18 ), /* Alpha Stack size/offset = 24 */
#endif
/* 6 */ NdrFcShort( 0x0 ), /* 0 */
/* 8 */ NdrFcShort( 0x10 ), /* 16 */
/* 10 */ 0x4, /* 4 */
0x2, /* 2 */
/* Parameter phwnd */
/* 12 */ NdrFcShort( 0x2150 ), /* 8528 */
#ifndef _ALPHA_
/* 14 */ NdrFcShort( 0x4 ), /* x86, MIPS, PPC Stack size/offset = 4 */
#else
NdrFcShort( 0x8 ), /* Alpha Stack size/offset = 8 */
#endif
/* 16 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Return value */
/* 18 */ NdrFcShort( 0x70 ), /* 112 */
#ifndef _ALPHA_
/* 20 */ NdrFcShort( 0x8 ), /* x86, MIPS, PPC Stack size/offset = 8 */
#else
NdrFcShort( 0x10 ), /* Alpha Stack size/offset = 16 */
#endif
/* 22 */ 0x8, /* FC_LONG */
0x0, /* 0 */
0x0
}
};
static const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString =
{
0,
{
0x11, 0xc, /* FC_RP [alloced_on_stack] [simple_pointer] */
/* 2 */ 0x8, /* FC_LONG */
0x5c, /* FC_PAD */
0x0
}
};
const CInterfaceProxyVtbl * _MozillaControl_ProxyVtblList[] =
{
( CInterfaceProxyVtbl *) &_IMozillaBrowserProxyVtbl,
0
};
const CInterfaceStubVtbl * _MozillaControl_StubVtblList[] =
{
( CInterfaceStubVtbl *) &_IMozillaBrowserStubVtbl,
0
};
PCInterfaceName const _MozillaControl_InterfaceNamesList[] =
{
"IMozillaBrowser",
0
};
const IID * _MozillaControl_BaseIIDList[] =
{
&IID_IDispatch,
0
};
#define _MozillaControl_CHECK_IID(n) IID_GENERIC_CHECK_IID( _MozillaControl, pIID, n)
int __stdcall _MozillaControl_IID_Lookup( const IID * pIID, int * pIndex )
{
if(!_MozillaControl_CHECK_IID(0))
{
*pIndex = 0;
return 1;
}
return 0;
}
const ExtendedProxyFileInfo MozillaControl_ProxyFileInfo =
{
(PCInterfaceProxyVtblList *) & _MozillaControl_ProxyVtblList,
(PCInterfaceStubVtblList *) & _MozillaControl_StubVtblList,
(const PCInterfaceName * ) & _MozillaControl_InterfaceNamesList,
(const IID ** ) & _MozillaControl_BaseIIDList,
& _MozillaControl_IID_Lookup,
1,
2
};

Просмотреть файл

@ -23,25 +23,37 @@ extern CComModule _Module;
#include <atlcom.h> #include <atlcom.h>
#include <atlctl.h> #include <atlctl.h>
/* Headers from NGLayout... */ #ifdef USE_NGPREF
#include <malloc.h> #include "nsIPref.h"
#endif
#include "prtypes.h"
#include "xp_core.h"
#include "jscompat.h"
#include "prthread.h"
#include "prprf.h"
#include "plevent.h"
#include "nsRepository.h"
#include "nsWidgetsCID.h"
#include "nsGfxCIID.h"
#include "nsViewsCID.h"
#include "nsString.h"
#include "nsGlobalVariables.h" #include "nsGlobalVariables.h"
#include "nsIWebShell.h" #include "nsIWebShell.h"
#include "nsIPresContext.h" #include "nsIPresContext.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsIDocumentObserver.h" #include "nsIDocumentObserver.h"
#include "nsIStreamListener.h"
#include "nsUnitConversion.h" #include "nsUnitConversion.h"
#include "nsVoidArray.h" #include "nsVoidArray.h"
#include "nsCRT.h" #include "nsCRT.h"
#include "prthread.h"
#include "prprf.h" #include "BrowserDiagnostics.h"
#include "nsRepository.h" #include "MozillaControl.h"
#include "nsWidgetsCID.h" #include "WebShellContainer.h"
#include "nsGfxCIID.h" #include "MozillaBrowser.h"
#include "nsViewsCID.h"
#include "nsString.h"
#include "plevent.h"
//{{AFX_INSERT_LOCATION}} //{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line. // Microsoft Developer Studio will insert additional declarations immediately before the previous line.

Просмотреть файл

@ -4,10 +4,12 @@
static NS_DEFINE_IID(kIWebShellContainerIID, NS_IWEB_SHELL_CONTAINER_IID); static NS_DEFINE_IID(kIWebShellContainerIID, NS_IWEB_SHELL_CONTAINER_IID);
static NS_DEFINE_IID(kIStreamObserverIID, NS_ISTREAMOBSERVER_IID);
CWebShellContainer::CWebShellContainer() CWebShellContainer::CWebShellContainer(CMozillaBrowser *pOwner)
{ {
m_pOwner = pOwner;
} }
@ -15,6 +17,10 @@ CWebShellContainer::~CWebShellContainer()
{ {
} }
///////////////////////////////////////////////////////////////////////////////
// nsISupports implementation
NS_IMPL_ADDREF(CWebShellContainer) NS_IMPL_ADDREF(CWebShellContainer)
NS_IMPL_RELEASE(CWebShellContainer) NS_IMPL_RELEASE(CWebShellContainer)
@ -31,13 +37,13 @@ nsresult CWebShellContainer::QueryInterface(const nsIID& aIID, void** aInstanceP
*aInstancePtrResult = (void*) ((nsIBrowserWindow*)this); *aInstancePtrResult = (void*) ((nsIBrowserWindow*)this);
AddRef(); AddRef();
return NS_OK; return NS_OK;
} } */
if (aIID.Equals(kIStreamObserverIID)) { if (aIID.Equals(kIStreamObserverIID)) {
*aInstancePtrResult = (void*) ((nsIStreamObserver*)this); *aInstancePtrResult = (void*) ((nsIStreamObserver*)this);
AddRef(); AddRef();
return NS_OK; return NS_OK;
} }
*/
if (aIID.Equals(kIWebShellContainerIID)) { if (aIID.Equals(kIWebShellContainerIID)) {
*aInstancePtrResult = (void*) ((nsIWebShellContainer*)this); *aInstancePtrResult = (void*) ((nsIWebShellContainer*)this);
AddRef(); AddRef();
@ -57,47 +63,63 @@ nsresult CWebShellContainer::QueryInterface(const nsIID& aIID, void** aInstanceP
return NS_NOINTERFACE; return NS_NOINTERFACE;
} }
///////////////////////////////////////////////////////////////////////////////
// nsIWebShellContainer implementation
NS_IMETHODIMP NS_IMETHODIMP
CWebShellContainer::WillLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, nsLoadType aReason) CWebShellContainer::WillLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, nsLoadType aReason)
{ {
// if (mStatus) {
// nsAutoString url("Connecting to ");
// url.Append(aURL);
// mStatus->SetText(url);
// }
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
CWebShellContainer::BeginLoadURL(nsIWebShell* aShell, const PRUnichar* aURL) CWebShellContainer::BeginLoadURL(nsIWebShell* aShell, const PRUnichar* aURL)
{ {
// if (mThrobber) { USES_CONVERSION;
// mThrobber->Start(); OLECHAR *pszURL = W2OLE((WCHAR *)aURL);
// mLocation->SetText(aURL); BSTR bstrURL = SysAllocString(pszURL);
// } BSTR bstrTargetFrameName = NULL;
BSTR bstrHeaders = NULL;
VARIANT *pvPostData = NULL;
VARIANT_BOOL bCancel = VARIANT_FALSE;
long lFlags = 0;
m_pOwner->Fire_BeforeNavigate(bstrURL, lFlags, bstrTargetFrameName, pvPostData, bstrHeaders, &bCancel);
if (bCancel == VARIANT_TRUE)
{
// TODO cancel browsing somehow
}
SysFreeString(bstrURL);
SysFreeString(bstrTargetFrameName);
SysFreeString(bstrHeaders);
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
CWebShellContainer::ProgressLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aProgress, PRInt32 aProgressMax) CWebShellContainer::ProgressLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aProgress, PRInt32 aProgressMax)
{ {
m_pOwner->Fire_ProgressChange(aProgress, aProgressMax);
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
CWebShellContainer::EndLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aStatus) CWebShellContainer::EndLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aStatus)
{ {
// if (mThrobber) { USES_CONVERSION;
// mThrobber->Stop(); OLECHAR *pszURL = W2OLE((WCHAR *) aURL);
// } BSTR bstrURL = SysAllocString(pszURL);
m_pOwner->Fire_NavigateComplete(bstrURL);
SysFreeString(bstrURL);
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
CWebShellContainer::NewWebShell(nsIWebShell *&aNewWebShell) CWebShellContainer::NewWebShell(nsIWebShell *&aNewWebShell)
{ {
nsresult rv = NS_OK; nsresult rv = NS_ERROR_OUT_OF_MEMORY;
rv = NS_ERROR_OUT_OF_MEMORY;
return rv; return rv;
} }
@ -106,3 +128,32 @@ CWebShellContainer::FindWebShellWithName(const PRUnichar* aName, nsIWebShell*& a
{ {
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
///////////////////////////////////////////////////////////////////////////////
// nsIStreamObserver implementation
NS_IMETHODIMP
CWebShellContainer::OnStartBinding(nsIURL* aURL, const char *aContentType)
{
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
CWebShellContainer::OnProgress(nsIURL* aURL, PRInt32 aProgress, PRInt32 aProgressMax)
{
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
CWebShellContainer::OnStatus(nsIURL* aURL, const nsString &aMsg)
{
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
CWebShellContainer::OnStopBinding(nsIURL* aURL, PRInt32 aStatus, const nsString &aMsg)
{
return NS_ERROR_FAILURE;
}

Просмотреть файл

@ -1,17 +1,21 @@
#ifndef WEBSHELLCONTAINER_H #ifndef WEBSHELLCONTAINER_H
#define WEBSHELLCONTAINER_H #define WEBSHELLCONTAINER_H
class CMozillaBrowser;
class CWebShellContainer : class CWebShellContainer :
public nsIWebShellContainer public nsIWebShellContainer,
public nsIStreamObserver
{ {
public: public:
CWebShellContainer(); CWebShellContainer(CMozillaBrowser *pOwner);
protected: protected:
virtual ~CWebShellContainer(); virtual ~CWebShellContainer();
// Protected members // Protected members
protected: protected:
nsString m_sTitle; nsString m_sTitle;
CMozillaBrowser *m_pOwner;
public: public:
// nsISupports // nsISupports
@ -24,6 +28,12 @@ public:
NS_IMETHOD EndLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aStatus); NS_IMETHOD EndLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aStatus);
NS_IMETHOD NewWebShell(nsIWebShell *&aNewWebShell); NS_IMETHOD NewWebShell(nsIWebShell *&aNewWebShell);
NS_IMETHOD FindWebShellWithName(const PRUnichar* aName, nsIWebShell*& aResult); NS_IMETHOD FindWebShellWithName(const PRUnichar* aName, nsIWebShell*& aResult);
// nsIStreamObserver
NS_IMETHOD OnStartBinding(nsIURL* aURL, const char *aContentType);
NS_IMETHOD OnProgress(nsIURL* aURL, PRInt32 aProgress, PRInt32 aProgressMax);
NS_IMETHOD OnStatus(nsIURL* aURL, const nsString &aMsg);
NS_IMETHOD OnStopBinding(nsIURL* aURL, PRInt32 aStatus, const nsString &aMsg);
}; };
#endif #endif

Просмотреть файл

@ -82,7 +82,7 @@ MozillaControl_i.c MozillaControl.h: MozillaControl.idl
MozillaControl.cpp \ MozillaControl.cpp \
MozillaBrowser.cpp \ MozillaBrowser.cpp \
WebShellContainer.cpp \ WebShellContainer.cpp \
StdAfx.cpp: StdAfx.h MozillaControl.h StdAfx.cpp: StdAfx.h MozillaControl.h MozillaBrowser.h WebShellContainer.h
clobber:: clobber::
regsvr32 /s /c /u $(DIST)\bin\$(DLLNAME).dll regsvr32 /s /c /u $(DIST)\bin\$(DLLNAME).dll

Просмотреть файл

@ -4,12 +4,13 @@
// //
#define IDS_PROJNAME 100 #define IDS_PROJNAME 100
#define IDR_MOZILLABROWSER 101 #define IDR_MOZILLABROWSER 101
#define IDI_MOZILLABROWSER 201
// Next default values for new objects // Next default values for new objects
// //
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 201 #define _APS_NEXT_RESOURCE_VALUE 202
#define _APS_NEXT_COMMAND_VALUE 32768 #define _APS_NEXT_COMMAND_VALUE 32768
#define _APS_NEXT_CONTROL_VALUE 201 #define _APS_NEXT_CONTROL_VALUE 201
#define _APS_NEXT_SYMED_VALUE 102 #define _APS_NEXT_SYMED_VALUE 102