NOT PART OF BUILD. Implement IWebBrowser/2/App object and preference change observer. Cleanup naming convention

This commit is contained in:
locka%iol.ie 2002-10-18 11:43:36 +00:00
Родитель 5b065c698f
Коммит f0a081a4bb
5 изменённых файлов: 897 добавлений и 28 удалений

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

@ -43,6 +43,7 @@ REQUIRES = \
widget \
gfx \
js \
pref \
$(NULL)
XPIFILE = mozactivex.xpi
@ -135,12 +136,13 @@ CPPSRCS = \
StdAfx.cpp \
LegacyPlugin.cpp \
MozActiveX.cpp \
PrefObserver.cpp \
npwin.cpp \
$(_CONTROL_CPPSRCS) \
$(NULL)
ifdef MOZ_ACTIVEX_PLUGIN_XPCONNECT
CPPSRCS += XPConnect.cpp XPCDocument.cpp
CPPSRCS += XPConnect.cpp XPCDocument.cpp XPCBrowser.cpp
endif
ifdef MOZ_ACTIVEX_PLUGIN_LIVECONNECT

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

@ -0,0 +1,137 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Adam Lock <adamlock@netscape.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "StdAfx.h"
#include <Wininet.h>
#include "npapi.h"
#include "nsIServiceManagerUtils.h"
#include "nsISupportsUtils.h"
#include "nsWeakReference.h"
#include "nsIObserver.h"
#include "nsIPrefService.h"
#include "nsIPrefBranchInternal.h"
class PrefObserver :
public nsSupportsWeakReference,
public nsIObserver
{
public:
PrefObserver();
protected:
virtual ~PrefObserver();
static PrefObserver *sPrefObserver;
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIOBSERVER
static nsresult Subscribe();
static nsresult Unsubscribe();
};
PrefObserver *PrefObserver::sPrefObserver = nsnull;
PrefObserver::PrefObserver()
{
NS_INIT_ISUPPORTS();
}
PrefObserver::~PrefObserver()
{
}
NS_IMPL_ADDREF(PrefObserver);
NS_IMPL_RELEASE(PrefObserver);
NS_INTERFACE_MAP_BEGIN(PrefObserver)
NS_INTERFACE_MAP_ENTRY(nsIObserver)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_END
/* void observe (in nsISupports aSubject, in string aTopic, in wstring aData); */
NS_IMETHODIMP PrefObserver::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *aData)
{
// const char *userAgent = NPN_UserAgent(mData->pPluginInstance);
// ::UrlMkSetSessionOption(URLMON_OPTION_USERAGENT, userAgent, strlen(userAgent), 0);
// INTERNET_PROXY_INFO ipi;
// UrlMkSetSessionOption(INTERNET_OPTION_PROXY, ....);
return NS_OK;
}
nsresult
PrefObserver::Subscribe()
{
if (sPrefObserver)
{
return NS_OK;
}
sPrefObserver = new PrefObserver();
NS_ENSURE_TRUE(sPrefObserver, NS_ERROR_OUT_OF_MEMORY);
sPrefObserver->AddRef();
nsresult rv = NS_OK;
nsCOMPtr<nsIPrefService> prefService = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIPrefBranch> prefBranch;
prefService->GetBranch(nsnull, getter_AddRefs(prefBranch));
NS_ENSURE_TRUE(prefBranch, NS_ERROR_FAILURE);
nsCOMPtr<nsIPrefBranchInternal> pbi = do_QueryInterface(prefBranch);
NS_ENSURE_TRUE(pbi, NS_ERROR_FAILURE);
pbi->AddObserver("network.http.proxy.", sPrefObserver, PR_TRUE);
pbi->AddObserver("general.useragent.", sPrefObserver, PR_TRUE);
return S_OK;
}
nsresult
PrefObserver::Unsubscribe()
{
if (sPrefObserver)
{
sPrefObserver->Release();
sPrefObserver = nsnull;
}
return NS_OK;
}

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

@ -0,0 +1,451 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Adam Lock <adamlock@netscape.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "StdAfx.h"
#include "XPCBrowser.h"
IEBrowser::IEBrowser()
{
}
IEBrowser::~IEBrowser()
{
}
// IWebBrowser
HRESULT STDMETHODCALLTYPE IEBrowser::GoBack(void)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::GoForward(void)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::GoHome(void)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::GoSearch(void)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::Navigate(
BSTR URL,
VARIANT *Flags,
VARIANT *TargetFrameName,
VARIANT *PostData,
VARIANT *Headers)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::Refresh(void)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::Refresh2(
VARIANT *Level)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::Stop(void)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::get_Application(
IDispatch **ppDisp)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::get_Parent(
IDispatch **ppDisp)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::get_Container(
IDispatch **ppDisp)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::get_Document(
IDispatch **ppDisp)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::get_TopLevelContainer(
VARIANT_BOOL *pBool)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::get_Type(
BSTR *Type)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::get_Left(
long *pl)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::put_Left(
long Left)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::get_Top(
long *pl)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::put_Top(
long Top)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::get_Width(
long *pl)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::put_Width(
long Width)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::get_Height(
long *pl)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::put_Height(
long Height)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::get_LocationName(
BSTR *LocationName)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::get_LocationURL(
BSTR *LocationURL)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::get_Busy(
VARIANT_BOOL *pBool)
{
return E_NOTIMPL;
}
// IWebBrowserApp
HRESULT STDMETHODCALLTYPE IEBrowser::Quit(void)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::ClientToWindow(
int *pcx,
int *pcy)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::PutProperty(
BSTR Property,
VARIANT vtValue)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::GetProperty(
BSTR Property,
VARIANT *pvtValue)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::get_Name(
BSTR *Name)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::get_HWND(
long __RPC_FAR *pHWND)
{
// TODO
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::get_FullName(
BSTR *FullName)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::get_Path(
BSTR *Path)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::get_Visible(
VARIANT_BOOL *pBool)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::put_Visible(
VARIANT_BOOL Value)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::get_StatusBar(
VARIANT_BOOL *pBool)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::put_StatusBar(
VARIANT_BOOL Value)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::get_StatusText(
BSTR *StatusText)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::put_StatusText(
BSTR StatusText)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::get_ToolBar(
int *Value)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::put_ToolBar(
int Value)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::get_MenuBar(
VARIANT_BOOL *Value)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::put_MenuBar(
VARIANT_BOOL Value)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::get_FullScreen(
VARIANT_BOOL *pbFullScreen)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::put_FullScreen(
VARIANT_BOOL bFullScreen)
{
return E_NOTIMPL;
}
// IWebBrowser2
HRESULT STDMETHODCALLTYPE IEBrowser::Navigate2(
VARIANT *URL,
VARIANT *Flags,
VARIANT *TargetFrameName,
VARIANT *PostData,
VARIANT *Headers)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::QueryStatusWB(
OLECMDID cmdID,
OLECMDF *pcmdf)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::ExecWB(
OLECMDID cmdID,
OLECMDEXECOPT cmdexecopt,
VARIANT *pvaIn,
VARIANT *pvaOut)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::ShowBrowserBar(
VARIANT *pvaClsid,
VARIANT *pvarShow,
VARIANT *pvarSize)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::get_ReadyState(
READYSTATE *plReadyState)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::get_Offline(
VARIANT_BOOL *pbOffline)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::put_Offline(
VARIANT_BOOL bOffline)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::get_Silent(
VARIANT_BOOL *pbSilent)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::put_Silent(
VARIANT_BOOL bSilent)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::get_RegisterAsBrowser(
VARIANT_BOOL *pbRegister)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::put_RegisterAsBrowser(
VARIANT_BOOL bRegister)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::get_RegisterAsDropTarget(
VARIANT_BOOL *pbRegister)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::put_RegisterAsDropTarget(
VARIANT_BOOL bRegister)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::get_TheaterMode(
VARIANT_BOOL *pbRegister)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::put_TheaterMode(
VARIANT_BOOL bRegister)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::get_AddressBar(
VARIANT_BOOL *Value)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::put_AddressBar(
VARIANT_BOOL Value)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::get_Resizable(
VARIANT_BOOL *Value)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE IEBrowser::put_Resizable(
VARIANT_BOOL Value)
{
return E_NOTIMPL;
}

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

@ -0,0 +1,268 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Adam Lock <adamlock@netscape.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef IEBrowser_H
#define IEBrowser_H
#include <docobj.h>
#include <ExDisp.h>
class IEBrowser :
public CComObjectRootEx<CComSingleThreadModel>,
public IDispatchImpl<IWebBrowser2, &IID_IWebBrowser2, &LIBID_MSHTML>
{
public:
BEGIN_COM_MAP(IEBrowser)
COM_INTERFACE_ENTRY(IWebBrowser)
COM_INTERFACE_ENTRY(IWebBrowser2)
COM_INTERFACE_ENTRY(IWebBrowserApp)
END_COM_MAP()
IEBrowser();
virtual ~IEBrowser();
public:
// IWebBrowser
virtual /* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE GoBack(void);
virtual /* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE GoForward(void);
virtual /* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE GoHome(void);
virtual /* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE GoSearch(void);
virtual /* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE Navigate(
/* [in] */ BSTR URL,
/* [optional][in] */ VARIANT *Flags,
/* [optional][in] */ VARIANT *TargetFrameName,
/* [optional][in] */ VARIANT *PostData,
/* [optional][in] */ VARIANT *Headers);
virtual /* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE Refresh(void);
virtual /* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE Refresh2(
/* [optional][in] */ VARIANT *Level);
virtual /* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE Stop(void);
virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Application(
/* [retval][out] */ IDispatch **ppDisp);
virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Parent(
/* [retval][out] */ IDispatch **ppDisp);
virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Container(
/* [retval][out] */ IDispatch **ppDisp);
virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Document(
/* [retval][out] */ IDispatch **ppDisp);
virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_TopLevelContainer(
/* [retval][out] */ VARIANT_BOOL *pBool);
virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Type(
/* [retval][out] */ BSTR *Type);
virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Left(
/* [retval][out] */ long *pl);
virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_Left(
/* [in] */ long Left);
virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Top(
/* [retval][out] */ long *pl);
virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_Top(
/* [in] */ long Top);
virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Width(
/* [retval][out] */ long *pl);
virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_Width(
/* [in] */ long Width);
virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Height(
/* [retval][out] */ long *pl);
virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_Height(
/* [in] */ long Height);
virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_LocationName(
/* [retval][out] */ BSTR *LocationName);
virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_LocationURL(
/* [retval][out] */ BSTR *LocationURL);
virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Busy(
/* [retval][out] */ VARIANT_BOOL *pBool);
// IWebBrowserApp
virtual /* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE Quit(void);
virtual /* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE ClientToWindow(
/* [out][in] */ int *pcx,
/* [out][in] */ int *pcy);
virtual /* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE PutProperty(
/* [in] */ BSTR Property,
/* [in] */ VARIANT vtValue);
virtual /* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE GetProperty(
/* [in] */ BSTR Property,
/* [retval][out] */ VARIANT *pvtValue);
virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Name(
/* [retval][out] */ BSTR *Name);
virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_HWND(
/* [retval][out] */ long __RPC_FAR *pHWND);
virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_FullName(
/* [retval][out] */ BSTR *FullName);
virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Path(
/* [retval][out] */ BSTR *Path);
virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Visible(
/* [retval][out] */ VARIANT_BOOL *pBool);
virtual /* [helpcontext][helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_Visible(
/* [in] */ VARIANT_BOOL Value);
virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_StatusBar(
/* [retval][out] */ VARIANT_BOOL *pBool);
virtual /* [helpcontext][helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_StatusBar(
/* [in] */ VARIANT_BOOL Value);
virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_StatusText(
/* [retval][out] */ BSTR *StatusText);
virtual /* [helpcontext][helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_StatusText(
/* [in] */ BSTR StatusText);
virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_ToolBar(
/* [retval][out] */ int *Value);
virtual /* [helpcontext][helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_ToolBar(
/* [in] */ int Value);
virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_MenuBar(
/* [retval][out] */ VARIANT_BOOL *Value);
virtual /* [helpcontext][helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_MenuBar(
/* [in] */ VARIANT_BOOL Value);
virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_FullScreen(
/* [retval][out] */ VARIANT_BOOL *pbFullScreen);
virtual /* [helpcontext][helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_FullScreen(
/* [in] */ VARIANT_BOOL bFullScreen);
// IWebBrowser2
virtual /* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE Navigate2(
/* [in] */ VARIANT *URL,
/* [optional][in] */ VARIANT *Flags,
/* [optional][in] */ VARIANT *TargetFrameName,
/* [optional][in] */ VARIANT *PostData,
/* [optional][in] */ VARIANT *Headers);
virtual /* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE QueryStatusWB(
/* [in] */ OLECMDID cmdID,
/* [retval][out] */ OLECMDF *pcmdf);
virtual /* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE ExecWB(
/* [in] */ OLECMDID cmdID,
/* [in] */ OLECMDEXECOPT cmdexecopt,
/* [optional][in] */ VARIANT *pvaIn,
/* [optional][in][out] */ VARIANT *pvaOut);
virtual /* [helpcontext][helpstring][id] */ HRESULT STDMETHODCALLTYPE ShowBrowserBar(
/* [in] */ VARIANT *pvaClsid,
/* [optional][in] */ VARIANT *pvarShow,
/* [optional][in] */ VARIANT *pvarSize);
virtual /* [bindable][propget][id] */ HRESULT STDMETHODCALLTYPE get_ReadyState(
/* [out][retval] */ READYSTATE *plReadyState);
virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Offline(
/* [retval][out] */ VARIANT_BOOL *pbOffline);
virtual /* [helpcontext][helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_Offline(
/* [in] */ VARIANT_BOOL bOffline);
virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Silent(
/* [retval][out] */ VARIANT_BOOL *pbSilent);
virtual /* [helpcontext][helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_Silent(
/* [in] */ VARIANT_BOOL bSilent);
virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_RegisterAsBrowser(
/* [retval][out] */ VARIANT_BOOL *pbRegister);
virtual /* [helpcontext][helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_RegisterAsBrowser(
/* [in] */ VARIANT_BOOL bRegister);
virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_RegisterAsDropTarget(
/* [retval][out] */ VARIANT_BOOL *pbRegister);
virtual /* [helpcontext][helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_RegisterAsDropTarget(
/* [in] */ VARIANT_BOOL bRegister);
virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_TheaterMode(
/* [retval][out] */ VARIANT_BOOL *pbRegister);
virtual /* [helpcontext][helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_TheaterMode(
/* [in] */ VARIANT_BOOL bRegister);
virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_AddressBar(
/* [retval][out] */ VARIANT_BOOL *Value);
virtual /* [helpcontext][helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_AddressBar(
/* [in] */ VARIANT_BOOL Value);
virtual /* [helpcontext][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Resizable(
/* [retval][out] */ VARIANT_BOOL *Value);
virtual /* [helpcontext][helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_Resizable(
/* [in] */ VARIANT_BOOL Value);
};
#endif

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

@ -42,6 +42,7 @@
#include <mshtml.h>
#include "XPConnect.h"
#include "XPCBrowser.h"
#include "LegacyPlugin.h"
#include "npapi.h"
@ -61,12 +62,12 @@
*/
// Note: corresponds to the window.navigator property in the IE DOM
class Navigator :
class IENavigator :
public CComObjectRootEx<CComSingleThreadModel>,
public IDispatchImpl<IOmNavigator, &IID_IOmNavigator, &LIBID_MSHTML>
{
public:
BEGIN_COM_MAP(Navigator)
BEGIN_COM_MAP(IENavigator)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(IOmNavigator)
COM_INTERFACE_ENTRY_BREAK(IWebBrowser)
@ -204,20 +205,20 @@ END_COM_MAP()
// Note: Corresponds to the window object in the IE DOM
class HTMLWindow :
class IEWindow :
public CComObjectRootEx<CComSingleThreadModel>,
public IDispatchImpl<IHTMLWindow2, &IID_IHTMLWindow2, &LIBID_MSHTML>
{
public:
PluginInstanceData *mData;
CComObject<Navigator> *mNavigator;
CComObject<IENavigator> *mNavigator;
HTMLWindow() : mNavigator(NULL)
IEWindow() : mNavigator(NULL)
{
}
protected:
virtual ~HTMLWindow()
virtual ~IEWindow()
{
if (mNavigator)
{
@ -227,7 +228,7 @@ protected:
public:
BEGIN_COM_MAP(HTMLWindow)
BEGIN_COM_MAP(IEWindow)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(IHTMLWindow2)
COM_INTERFACE_ENTRY(IHTMLFramesCollection2)
@ -358,7 +359,7 @@ END_COM_MAP()
{
if (!mNavigator)
{
CComObject<Navigator>::CreateInstance(&mNavigator);
CComObject<IENavigator>::CreateInstance(&mNavigator);
if (!mNavigator)
{
return E_UNEXPECTED;
@ -696,23 +697,30 @@ END_COM_MAP()
};
// Note: Corresponds to the document object in the IE DOM
class HTMLDocument :
class IEDocument :
public CComObjectRootEx<CComSingleThreadModel>,
public IDispatchImpl<IHTMLDocument2, &IID_IHTMLDocument2, &LIBID_MSHTML>,
public IServiceProvider
{
public:
PluginInstanceData *mData;
CComObject<HTMLWindow> *mWindow;
HTMLDocument() :
mWindow(NULL)
CComObject<IEWindow> *mWindow;
CComObject<IEBrowser> *mBrowser;
IEDocument() :
mWindow(NULL),
mBrowser(NULL)
{
xpc_AddRef();
}
virtual ~HTMLDocument()
virtual ~IEDocument()
{
if (mBrowser)
{
mBrowser->Release();
}
if (mWindow)
{
mWindow->Release();
@ -720,7 +728,7 @@ public:
xpc_Release();
}
BEGIN_COM_MAP(HTMLDocument)
BEGIN_COM_MAP(IEDocument)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(IHTMLDocument)
COM_INTERFACE_ENTRY(IHTMLDocument2)
@ -737,18 +745,21 @@ END_COM_MAP()
/* [out] */ void **ppvObject)
{
#ifdef DEBUG
ATLTRACE(_T("HTMLDocument::QueryService\n"));
if (IsEqualIID(riid, __uuidof(IWebBrowser)))
{
ATLTRACE(_T(" IWebBrowser\n"));
}
else if (IsEqualIID(riid, __uuidof(IWebBrowser2)))
{
ATLTRACE(_T(" IWebBrowser2\n"));
}
else if (IsEqualIID(riid, __uuidof(IWebBrowserApp)))
ATLTRACE(_T("IEDocument::QueryService\n"));
if (IsEqualIID(riid, __uuidof(IWebBrowser)) ||
IsEqualIID(riid, __uuidof(IWebBrowser2)) ||
IsEqualIID(riid, __uuidof(IWebBrowserApp)))
{
ATLTRACE(_T(" IWebBrowserApp\n"));
if (!mBrowser)
{
CComObject<IEBrowser>::CreateInstance(&mBrowser);
mBrowser->AddRef();
}
if (mBrowser)
{
return mBrowser->QueryInterface(riid, ppvObject);
}
}
else if (IsEqualIID(riid, __uuidof(IHTMLWindow2)))
{
@ -1418,7 +1429,7 @@ END_COM_MAP()
{
if (!mWindow)
{
CComObject<HTMLWindow>::CreateInstance(&mWindow);
CComObject<IEWindow>::CreateInstance(&mWindow);
if (!mWindow)
{
return E_UNEXPECTED;
@ -1475,8 +1486,8 @@ END_COM_MAP()
HRESULT xpc_GetServiceProvider(PluginInstanceData *pData, IServiceProvider **pSP)
{
CComObject<HTMLDocument> *pDoc = NULL;
CComObject<HTMLDocument>::CreateInstance(&pDoc);
CComObject<IEDocument> *pDoc = NULL;
CComObject<IEDocument>::CreateInstance(&pDoc);
pDoc->mData = pData;
return pDoc->QueryInterface(_uuidof(IServiceProvider), (void **) pSP);
}