Fixed some problems building with the latest platform sdk

This commit is contained in:
locka%iol.ie 2000-03-16 00:25:22 +00:00
Родитель f6727ec878
Коммит f7e4386783
4 изменённых файлов: 0 добавлений и 3941 удалений

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

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

@ -1,429 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* 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 Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
// MozillaBrowser.h : Declaration of the CMozillaBrowser
#ifndef __MOZILLABROWSER_H_
#define __MOZILLABROWSER_H_
// This file is autogenerated by the ATL proxy wizard
// so don't edit it!
#include "CPMozillaControl.h"
// Commands sent via WM_COMMAND
#define ID_PRINT 1
#define ID_PAGESETUP 2
#define ID_VIEWSOURCE 3
#define ID_SAVEAS 4
#define ID_PROPERTIES 5
#define ID_CUT 6
#define ID_COPY 7
#define ID_PASTE 8
#define ID_SELECTALL 9
// Command group and IDs exposed through IOleCommandTarget
extern const GUID CGID_IWebBrowser;
extern const GUID CGID_MSHTML;
#define HTMLID_FIND 1
#define HTMLID_VIEWSOURCE 2
#define HTMLID_OPTIONS 3
// Some definitions which are used to make firing events easier
#define CDWebBrowserEvents1 CProxyDWebBrowserEvents<CMozillaBrowser>
#define CDWebBrowserEvents2 CProxyDWebBrowserEvents2<CMozillaBrowser>
// A list of objects
typedef CComPtr<IUnknown> CComUnkPtr;
typedef std::vector<CComUnkPtr> ObjectList;
class CWebShellContainer;
/////////////////////////////////////////////////////////////////////////////
// CMozillaBrowser
class ATL_NO_VTABLE CMozillaBrowser :
public CComObjectRootEx<CComMultiThreadModel>,
public CComCoClass<CMozillaBrowser, &CLSID_MozillaBrowser>,
public CComControl<CMozillaBrowser>,
public CDWebBrowserEvents1,
public CDWebBrowserEvents2,
public CStockPropImpl<CMozillaBrowser, IWebBrowser2, &IID_IWebBrowser2, &LIBID_MOZILLACONTROLLib>,
public IProvideClassInfo2Impl<&CLSID_MozillaBrowser, &DIID_DWebBrowserEvents2, &LIBID_MOZILLACONTROLLib>,
public IPersistStreamInitImpl<CMozillaBrowser>,
public IPersistStorageImpl<CMozillaBrowser>,
public IQuickActivateImpl<CMozillaBrowser>,
public IOleControlImpl<CMozillaBrowser>,
public IOleObjectImpl<CMozillaBrowser>,
public IOleInPlaceActiveObjectImpl<CMozillaBrowser>,
public IViewObjectExImpl<CMozillaBrowser>,
public IOleInPlaceObjectWindowlessImpl<CMozillaBrowser>,
public IDataObjectImpl<CMozillaBrowser>,
public ISupportErrorInfo,
public IOleCommandTargetImpl<CMozillaBrowser>,
public IConnectionPointContainerImpl<CMozillaBrowser>,
public ISpecifyPropertyPagesImpl<CMozillaBrowser>
{
friend CWebShellContainer;
public:
CMozillaBrowser();
virtual ~CMozillaBrowser();
DECLARE_REGISTRY_RESOURCEID(IDR_MOZILLABROWSER)
BEGIN_COM_MAP(CMozillaBrowser)
// IE web browser interface
COM_INTERFACE_ENTRY(IWebBrowser2) //CMozillaBrowser Derives from IWebBrowser2
COM_INTERFACE_ENTRY_IID(IID_IDispatch, IWebBrowser2) //Requests to IWebBrowser will actually get the vtable of IWebBrowser2
COM_INTERFACE_ENTRY_IID(IID_IWebBrowser, IWebBrowser2) //ditto
COM_INTERFACE_ENTRY_IID(IID_IWebBrowserApp, IWebBrowser2) //ditto
COM_INTERFACE_ENTRY_IMPL(IViewObjectEx) //CMozillaBrowser derives from IViewObjectEx
COM_INTERFACE_ENTRY_IMPL_IID(IID_IViewObject2, IViewObjectEx) //Request to IViewObject2 will actually get the vtable of IViewObjectEx
COM_INTERFACE_ENTRY_IMPL_IID(IID_IViewObject, IViewObjectEx)
COM_INTERFACE_ENTRY_IMPL(IOleInPlaceObjectWindowless)
COM_INTERFACE_ENTRY_IMPL_IID(IID_IOleInPlaceObject, IOleInPlaceObjectWindowless)
COM_INTERFACE_ENTRY_IMPL_IID(IID_IOleWindow, IOleInPlaceObjectWindowless)
COM_INTERFACE_ENTRY_IMPL(IOleInPlaceActiveObject)
COM_INTERFACE_ENTRY_IMPL(IOleControl)
COM_INTERFACE_ENTRY_IMPL(IOleObject)
// COM_INTERFACE_ENTRY_IMPL(IQuickActivate) // This causes size assertion in ATL
COM_INTERFACE_ENTRY_IMPL(IPersistStorage)
COM_INTERFACE_ENTRY_IMPL(IPersistStreamInit)
COM_INTERFACE_ENTRY_IMPL(ISpecifyPropertyPages)
COM_INTERFACE_ENTRY_IMPL(IDataObject)
COM_INTERFACE_ENTRY(IOleCommandTarget)
COM_INTERFACE_ENTRY(IProvideClassInfo)
COM_INTERFACE_ENTRY(IProvideClassInfo2)
COM_INTERFACE_ENTRY(ISupportErrorInfo)
COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
COM_INTERFACE_ENTRY_IID(DIID_DWebBrowserEvents, CDWebBrowserEvents1) //Requests to DWebBrowserEvents will get the vtable of CDWebBrowserEvents1
COM_INTERFACE_ENTRY_IID(DIID_DWebBrowserEvents2, CDWebBrowserEvents2) //Requests to DWebBrowserEvents2 will get the vtable of CDWebBrowserEvents2
END_COM_MAP()
BEGIN_PROPERTY_MAP(CMozillaBrowser)
// Example entries
// PROP_ENTRY("Property Description", dispid, clsid)
PROP_PAGE(CLSID_StockColorPage)
END_PROPERTY_MAP()
BEGIN_CONNECTION_POINT_MAP(CMozillaBrowser)
// Fires IE events
CONNECTION_POINT_ENTRY(DIID_DWebBrowserEvents2) //Connection points for the client's event sinks
CONNECTION_POINT_ENTRY(DIID_DWebBrowserEvents)
END_CONNECTION_POINT_MAP()
BEGIN_MSG_MAP(CMozillaBrowser)
MESSAGE_HANDLER(WM_CREATE, OnCreate)
MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
MESSAGE_HANDLER(WM_SIZE, OnSize)
MESSAGE_HANDLER(WM_PAINT, OnPaint)
MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus)
MESSAGE_HANDLER(WM_KILLFOCUS, OnKillFocus)
COMMAND_ID_HANDLER(ID_PRINT, OnPrint)
COMMAND_ID_HANDLER(ID_PAGESETUP, OnPageSetup)
COMMAND_ID_HANDLER(ID_SAVEAS, OnSaveAs)
COMMAND_ID_HANDLER(ID_PROPERTIES, OnProperties)
COMMAND_ID_HANDLER(ID_CUT, OnCut)
COMMAND_ID_HANDLER(ID_COPY, OnCopy)
COMMAND_ID_HANDLER(ID_PASTE, OnPaste)
COMMAND_ID_HANDLER(ID_SELECTALL, OnSelectAll)\
END_MSG_MAP()
static HRESULT _stdcall EditModeHandler(CMozillaBrowser *pThis, const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
static HRESULT _stdcall EditCommandHandler(CMozillaBrowser *pThis, const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
BEGIN_OLECOMMAND_TABLE()
// Standard "common" commands
OLECOMMAND_MESSAGE(OLECMDID_PRINT, NULL, ID_PRINT, L"Print", L"Print the page")
OLECOMMAND_MESSAGE(OLECMDID_PAGESETUP, NULL, ID_PAGESETUP, L"Page Setup", L"Page Setup")
OLECOMMAND_MESSAGE(OLECMDID_UNDO, NULL, 0, L"Undo", L"Undo")
OLECOMMAND_MESSAGE(OLECMDID_REDO, NULL, 0, L"Redo", L"Redo")
OLECOMMAND_MESSAGE(OLECMDID_REFRESH, NULL, 0, L"Refresh", L"Refresh")
OLECOMMAND_MESSAGE(OLECMDID_STOP, NULL, 0, L"Stop", L"Stop")
OLECOMMAND_MESSAGE(OLECMDID_ONUNLOAD, NULL, 0, L"OnUnload", L"OnUnload")
OLECOMMAND_MESSAGE(OLECMDID_SAVEAS, NULL, ID_SAVEAS, L"SaveAs", L"Save the page")
OLECOMMAND_MESSAGE(OLECMDID_CUT, NULL, ID_CUT, L"Cut", L"Cut selection")
OLECOMMAND_MESSAGE(OLECMDID_COPY, NULL, ID_COPY, L"Copy", L"Copy selection")
OLECOMMAND_MESSAGE(OLECMDID_PASTE, NULL, ID_PASTE, L"Paste", L"Paste as selection")
OLECOMMAND_MESSAGE(OLECMDID_SELECTALL, NULL, ID_SELECTALL, L"SelectAll", L"Select all")
OLECOMMAND_MESSAGE(OLECMDID_PROPERTIES, NULL, ID_PROPERTIES, L"Properties", L"Show page properties")
// Unsupported IE 4.x command group
OLECOMMAND_MESSAGE(HTMLID_FIND, &CGID_IWebBrowser, 0, L"Find", L"Find")
OLECOMMAND_MESSAGE(HTMLID_VIEWSOURCE, &CGID_IWebBrowser, 0, L"ViewSource", L"View Source")
OLECOMMAND_MESSAGE(HTMLID_OPTIONS, &CGID_IWebBrowser, 0, L"Options", L"Options")
// DHTML editor command group
OLECOMMAND_HANDLER(IDM_EDITMODE, &CGID_MSHTML, EditModeHandler, L"EditMode", L"Switch to edit mode")
OLECOMMAND_HANDLER(IDM_BROWSEMODE, &CGID_MSHTML, EditModeHandler, L"UserMode", L"Switch to user mode")
OLECOMMAND_HANDLER(IDM_BOLD, &CGID_MSHTML, EditCommandHandler, L"Bold", L"Toggle Bold")
OLECOMMAND_HANDLER(IDM_ITALIC, &CGID_MSHTML, EditCommandHandler, L"Italic", L"Toggle Italic")
OLECOMMAND_HANDLER(IDM_UNDERLINE, &CGID_MSHTML, EditCommandHandler, L"Underline", L"Toggle Underline")
OLECOMMAND_HANDLER(IDM_UNKNOWN, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_ALIGNBOTTOM, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_ALIGNHORIZONTALCENTERS, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_ALIGNLEFT, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_ALIGNRIGHT, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_ALIGNTOGRID, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_ALIGNTOP, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_ALIGNVERTICALCENTERS, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_ARRANGEBOTTOM, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_ARRANGERIGHT, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_BRINGFORWARD, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_BRINGTOFRONT, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_CENTERHORIZONTALLY, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_CENTERVERTICALLY, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_CODE, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_DELETE, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_FONTNAME, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_FONTSIZE, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_GROUP, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_HORIZSPACECONCATENATE, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_HORIZSPACEDECREASE, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_HORIZSPACEINCREASE, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_HORIZSPACEMAKEEQUAL, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_INSERTOBJECT, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_MULTILEVELREDO, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_SENDBACKWARD, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_SENDTOBACK, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_SHOWTABLE, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_SIZETOCONTROL, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_SIZETOCONTROLHEIGHT, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_SIZETOCONTROLWIDTH, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_SIZETOFIT, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_SIZETOGRID, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_SNAPTOGRID, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_TABORDER, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_TOOLBOX, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_MULTILEVELUNDO, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_UNGROUP, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_VERTSPACECONCATENATE, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_VERTSPACEDECREASE, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_VERTSPACEINCREASE, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_VERTSPACEMAKEEQUAL, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_JUSTIFYFULL, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_BACKCOLOR, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_BORDERCOLOR, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_FLAT, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_FORECOLOR, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_JUSTIFYCENTER, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_JUSTIFYGENERAL, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_JUSTIFYLEFT, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_JUSTIFYRIGHT, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_RAISED, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_SUNKEN, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_CHISELED, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_ETCHED, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_SHADOWED, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_FIND, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_SHOWGRID, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_OBJECTVERBLIST0, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_OBJECTVERBLIST1, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_OBJECTVERBLIST2, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_OBJECTVERBLIST3, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_OBJECTVERBLIST4, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_OBJECTVERBLIST5, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_OBJECTVERBLIST6, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_OBJECTVERBLIST7, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_OBJECTVERBLIST8, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_OBJECTVERBLIST9, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_OBJECTVERBLISTLAST, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_CONVERTOBJECT, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_CUSTOMCONTROL, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_CUSTOMIZEITEM, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_RENAME, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_IMPORT, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_NEWPAGE, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_MOVE, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_CANCEL, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_FONT, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_STRIKETHROUGH, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_DELETEWORD, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_EXECPRINT, &CGID_MSHTML, NULL, L"", L"")
OLECOMMAND_HANDLER(IDM_JUSTIFYNONE, &CGID_MSHTML, NULL, L"", L"")
END_OLECOMMAND_TABLE()
HWND GetCommandTargetWindow() const
{
return m_hWnd;
}
// Windows message handlers
LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnPrint(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
LRESULT OnPageSetup(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
LRESULT OnViewSource(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
LRESULT OnSaveAs(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
LRESULT OnProperties(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
LRESULT OnCut(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
LRESULT OnCopy(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
LRESULT OnPaste(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
LRESULT OnSelectAll(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
// ISupportsErrorInfo
STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
// IViewObjectEx
STDMETHOD(GetViewStatus)(DWORD* pdwStatus)
{
ATLTRACE(_T("IViewObjectExImpl::GetViewStatus\n"));
*pdwStatus = VIEWSTATUS_SOLIDBKGND | VIEWSTATUS_OPAQUE;
return S_OK;
}
// Protected members
protected:
// Flag to prevent multiple object registrations
static BOOL m_bRegistryInitialized;
// Pointer to web shell manager
CWebShellContainer * m_pWebShellContainer;
// CComObject to IHTMLDocument implementer
CIEHtmlDocumentInstance * m_pDocument;
// Mozilla interfaces
nsIWebShell * m_pIWebShell;
nsIBaseWindow * m_pIWebShellWin;
nsIPref * m_pIPref;
nsIEditor * m_pEditor;
nsIServiceManager * m_pIServiceManager;
// System registry key for various control settings
CRegKey m_SystemKey;
// User registry key for various control settings
CRegKey m_UserKey;
// Indicates the browser is busy doing something
BOOL m_bBusy;
// Flag to indicate if browser is in edit mode or not
BOOL m_bEditorMode;
// Flag to indicate if the browser has a drop target
BOOL m_bDropTarget;
// Contains an error message if startup went wrong
tstring m_sErrorMessage;
// Property list
PropertyList m_PropertyList;
// Ready status of control
READYSTATE m_nBrowserReadyState;
// List of registered browser helper objects
ObjectList m_cBrowserHelperList;
// Post data from last navigate operation
CComVariant m_vLastPostData;
virtual HRESULT CreateWebShell();
virtual HRESULT InitWebShell();
virtual HRESULT TermWebShell();
virtual HRESULT SetErrorInfo(LPCTSTR lpszDesc, HRESULT hr);
virtual HRESULT GetPresShell(nsIPresShell **pPresShell);
virtual HRESULT GetDOMDocument(nsIDOMDocument **pDocument);
virtual HRESULT SetEditorMode(BOOL bEnabled);
virtual HRESULT OnEditorCommand(DWORD nCmdID);
virtual BOOL IsValid();
virtual int MessageBox(LPCTSTR lpszText, LPCTSTR lpszCaption = _T(""), UINT nType = MB_OK);
virtual HRESULT LoadBrowserHelpers();
virtual HRESULT UnloadBrowserHelpers();
public:
// IOleObjectImpl overrides
HRESULT InPlaceActivate(LONG iVerb, const RECT* prcPosRect);
// IOleObject overrides
virtual HRESULT STDMETHODCALLTYPE CMozillaBrowser::GetClientSite(IOleClientSite **ppClientSite);
// IWebBrowser implementation
virtual HRESULT STDMETHODCALLTYPE GoBack(void);
virtual HRESULT STDMETHODCALLTYPE GoForward(void);
virtual HRESULT STDMETHODCALLTYPE GoHome(void);
virtual HRESULT STDMETHODCALLTYPE GoSearch(void);
virtual HRESULT STDMETHODCALLTYPE Navigate(BSTR URL, VARIANT __RPC_FAR *Flags, VARIANT __RPC_FAR *TargetFrameName, VARIANT __RPC_FAR *PostData, VARIANT __RPC_FAR *Headers);
virtual HRESULT STDMETHODCALLTYPE Refresh(void);
virtual HRESULT STDMETHODCALLTYPE Refresh2(VARIANT __RPC_FAR *Level);
virtual HRESULT STDMETHODCALLTYPE Stop( void);
virtual HRESULT STDMETHODCALLTYPE get_Application(IDispatch __RPC_FAR *__RPC_FAR *ppDisp);
virtual HRESULT STDMETHODCALLTYPE get_Parent(IDispatch __RPC_FAR *__RPC_FAR *ppDisp);
virtual HRESULT STDMETHODCALLTYPE get_Container(IDispatch __RPC_FAR *__RPC_FAR *ppDisp);
virtual HRESULT STDMETHODCALLTYPE get_Document(IDispatch __RPC_FAR *__RPC_FAR *ppDisp);
virtual HRESULT STDMETHODCALLTYPE get_TopLevelContainer(VARIANT_BOOL __RPC_FAR *pBool);
virtual HRESULT STDMETHODCALLTYPE get_Type(BSTR __RPC_FAR *Type);
virtual HRESULT STDMETHODCALLTYPE get_Left(long __RPC_FAR *pl);
virtual HRESULT STDMETHODCALLTYPE put_Left(long Left);
virtual HRESULT STDMETHODCALLTYPE get_Top(long __RPC_FAR *pl);
virtual HRESULT STDMETHODCALLTYPE put_Top(long Top);
virtual HRESULT STDMETHODCALLTYPE get_Width(long __RPC_FAR *pl);
virtual HRESULT STDMETHODCALLTYPE put_Width(long Width);
virtual HRESULT STDMETHODCALLTYPE get_Height(long __RPC_FAR *pl);
virtual HRESULT STDMETHODCALLTYPE put_Height(long Height);
virtual HRESULT STDMETHODCALLTYPE get_LocationName(BSTR __RPC_FAR *LocationName);
virtual HRESULT STDMETHODCALLTYPE get_LocationURL(BSTR __RPC_FAR *LocationURL);
virtual HRESULT STDMETHODCALLTYPE get_Busy(VARIANT_BOOL __RPC_FAR *pBool);
// IWebBrowserApp implementation
virtual HRESULT STDMETHODCALLTYPE Quit(void);
virtual HRESULT STDMETHODCALLTYPE ClientToWindow(int __RPC_FAR *pcx, int __RPC_FAR *pcy);
virtual HRESULT STDMETHODCALLTYPE PutProperty(BSTR Property, VARIANT vtValue);
virtual HRESULT STDMETHODCALLTYPE GetProperty(BSTR Property, VARIANT __RPC_FAR *pvtValue);
virtual HRESULT STDMETHODCALLTYPE get_Name(BSTR __RPC_FAR *Name);
virtual HRESULT STDMETHODCALLTYPE get_HWND(long __RPC_FAR *pHWND);
virtual HRESULT STDMETHODCALLTYPE get_FullName(BSTR __RPC_FAR *FullName);
virtual HRESULT STDMETHODCALLTYPE get_Path(BSTR __RPC_FAR *Path);
virtual HRESULT STDMETHODCALLTYPE get_Visible(VARIANT_BOOL __RPC_FAR *pBool);
virtual HRESULT STDMETHODCALLTYPE put_Visible(VARIANT_BOOL Value);
virtual HRESULT STDMETHODCALLTYPE get_StatusBar(VARIANT_BOOL __RPC_FAR *pBool);
virtual HRESULT STDMETHODCALLTYPE put_StatusBar(VARIANT_BOOL Value);
virtual HRESULT STDMETHODCALLTYPE get_StatusText(BSTR __RPC_FAR *StatusText);
virtual HRESULT STDMETHODCALLTYPE put_StatusText(BSTR StatusText);
virtual HRESULT STDMETHODCALLTYPE get_ToolBar(int __RPC_FAR *Value);
virtual HRESULT STDMETHODCALLTYPE put_ToolBar(int Value);
virtual HRESULT STDMETHODCALLTYPE get_MenuBar(VARIANT_BOOL __RPC_FAR *Value);
virtual HRESULT STDMETHODCALLTYPE put_MenuBar(VARIANT_BOOL Value);
virtual HRESULT STDMETHODCALLTYPE get_FullScreen(VARIANT_BOOL __RPC_FAR *pbFullScreen);
virtual HRESULT STDMETHODCALLTYPE put_FullScreen(VARIANT_BOOL bFullScreen);
// IWebBrowser2 implementation
virtual HRESULT STDMETHODCALLTYPE Navigate2(VARIANT __RPC_FAR *URL, VARIANT __RPC_FAR *Flags, VARIANT __RPC_FAR *TargetFrameName, VARIANT __RPC_FAR *PostData, VARIANT __RPC_FAR *Headers);
virtual HRESULT STDMETHODCALLTYPE QueryStatusWB(OLECMDID cmdID, OLECMDF __RPC_FAR *pcmdf);
virtual HRESULT STDMETHODCALLTYPE ExecWB(OLECMDID cmdID, OLECMDEXECOPT cmdexecopt, VARIANT __RPC_FAR *pvaIn, VARIANT __RPC_FAR *pvaOut);
virtual HRESULT STDMETHODCALLTYPE ShowBrowserBar(VARIANT __RPC_FAR *pvaClsid, VARIANT __RPC_FAR *pvarShow, VARIANT __RPC_FAR *pvarSize);
virtual HRESULT STDMETHODCALLTYPE get_ReadyState(READYSTATE __RPC_FAR *plReadyState);
virtual HRESULT STDMETHODCALLTYPE get_Offline(VARIANT_BOOL __RPC_FAR *pbOffline);
virtual HRESULT STDMETHODCALLTYPE put_Offline(VARIANT_BOOL bOffline);
virtual HRESULT STDMETHODCALLTYPE get_Silent(VARIANT_BOOL __RPC_FAR *pbSilent);
virtual HRESULT STDMETHODCALLTYPE put_Silent(VARIANT_BOOL bSilent);
virtual HRESULT STDMETHODCALLTYPE get_RegisterAsBrowser(VARIANT_BOOL __RPC_FAR *pbRegister);
virtual HRESULT STDMETHODCALLTYPE put_RegisterAsBrowser(VARIANT_BOOL bRegister);
virtual HRESULT STDMETHODCALLTYPE get_RegisterAsDropTarget(VARIANT_BOOL __RPC_FAR *pbRegister);
virtual HRESULT STDMETHODCALLTYPE put_RegisterAsDropTarget(VARIANT_BOOL bRegister);
virtual HRESULT STDMETHODCALLTYPE get_TheaterMode(VARIANT_BOOL __RPC_FAR *pbRegister);
virtual HRESULT STDMETHODCALLTYPE put_TheaterMode(VARIANT_BOOL bRegister);
virtual HRESULT STDMETHODCALLTYPE get_AddressBar(VARIANT_BOOL __RPC_FAR *Value);
virtual HRESULT STDMETHODCALLTYPE put_AddressBar(VARIANT_BOOL Value);
virtual HRESULT STDMETHODCALLTYPE get_Resizable(VARIANT_BOOL __RPC_FAR *Value);
virtual HRESULT STDMETHODCALLTYPE put_Resizable(VARIANT_BOOL Value);
public:
HRESULT OnDraw(ATL_DRAWINFO& di);
};
#endif //__MOZILLABROWSER_H_

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

@ -1,607 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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 Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#include "stdafx.h"
#include <limits.h>
#include <shlobj.h>
#include "WebShellContainer.h"
CWebShellContainer::CWebShellContainer(CMozillaBrowser *pOwner)
{
NS_INIT_REFCNT();
m_pOwner = pOwner;
m_pEvents1 = m_pOwner;
m_pEvents2 = m_pOwner;
}
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)
///////////////////////////////////////////////////////////////////////////////
// nsIBrowserWindow implementation
NS_IMETHODIMP
CWebShellContainer::Init(nsIAppShell* aAppShell, nsIPref* aPrefs, const nsRect& aBounds, PRUint32 aChromeMask, PRBool aAllowPlugins)
{
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_IMETHODIMP
CWebShellContainer::ShowAfterCreation()
{
return NS_OK;
}
NS_IMETHODIMP
CWebShellContainer::Show()
{
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_IMETHODIMP
CWebShellContainer::SetChrome(PRUint32 aNewChromeMask)
{
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_IMETHODIMP
CWebShellContainer::SetDefaultStatus(const PRUnichar* aStatus)
{
NG_TRACE_METHOD(CWebShellContainer::SetDefaultStatus);
return NS_OK;
}
NS_IMETHODIMP
CWebShellContainer::GetDefaultStatus(const PRUnichar** aResult)
{
NG_TRACE_METHOD(CWebShellContainer::GetDefaultStatus);
*aResult = nsnull;
return NS_OK;
}
NS_IMETHODIMP
CWebShellContainer::SetProgress(PRInt32 aProgress, PRInt32 aProgressMax)
{
NG_TRACE_METHOD(CWebShellContainer::SetProgress);
return NS_OK;
}
NS_IMETHODIMP
CWebShellContainer::ShowMenuBar(PRBool aShow)
{
return NS_OK;
}
NS_IMETHODIMP
CWebShellContainer::GetWebShell(nsIWebShell*& aResult)
{
NG_TRACE_METHOD(CWebShellContainer::GetWebShell);
return NS_OK;
}
NS_IMETHODIMP
CWebShellContainer::GetContentWebShell(nsIWebShell **aResult)
{
NG_TRACE_METHOD(CWebShellContainer::GetContentWebShell);
*aResult = nsnull;
return NS_OK;
}
///////////////////////////////////////////////////////////////////////////////
// nsIWebShellContainer implementation
NS_IMETHODIMP
CWebShellContainer::WillLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, nsLoadType aReason)
{
USES_CONVERSION;
NG_TRACE(_T("CWebShellContainer::WillLoadURL(..., \"%s\", %d)\n"), W2T(aURL), (int) aReason);
return NS_OK;
}
NS_IMETHODIMP
CWebShellContainer::BeginLoadURL(nsIWebShell* aShell, const PRUnichar* aURL)
{
USES_CONVERSION;
NG_TRACE(_T("CWebShellContainer::BeginLoadURL(..., \"%s\")\n"), W2T(aURL));
// Setup the post data
CComVariant vPostDataRef;
CComVariant vPostData;
vPostDataRef.vt = VT_BYREF | VT_VARIANT;
vPostDataRef.pvarVal = &vPostData;
// TODO get the post data passed in via the original call to Navigate()
// Fire a BeforeNavigate event
OLECHAR *pszURL = W2OLE((WCHAR *)aURL);
BSTR bstrURL = SysAllocString(pszURL);
BSTR bstrTargetFrameName = NULL;
BSTR bstrHeaders = NULL;
VARIANT_BOOL bCancel = VARIANT_FALSE;
long lFlags = 0;
m_pEvents1->Fire_BeforeNavigate(bstrURL, lFlags, bstrTargetFrameName, &vPostDataRef, bstrHeaders, &bCancel);
// Fire a BeforeNavigate2 event
CComVariant vURL(bstrURL);
CComVariant vFlags(lFlags);
CComVariant vTargetFrameName(bstrTargetFrameName);
CComVariant vHeaders(bstrHeaders);
m_pEvents2->Fire_BeforeNavigate2(m_pOwner, &vURL, &vFlags, &vTargetFrameName, &vPostDataRef, &vHeaders, &bCancel);
SysFreeString(bstrURL);
SysFreeString(bstrTargetFrameName);
SysFreeString(bstrHeaders);
if (bCancel == VARIANT_TRUE)
{
return NS_ERROR_ABORT;
}
else
{
m_pOwner->m_bBusy = TRUE;
}
//NOTE: The IE control fires a DownloadBegin after the first BeforeNavigate. It then fires a
// DownloadComplete after then engine has made it's initial connection to the server. It
// then fires a second DownloadBegin/DownloadComplete pair around the loading of everything
// on the page. These events get fired out of CWebShellContainer::StartDocumentLoad() and
// CWebShellContainer::EndDocumentLoad().
// We don't appear to distinguish between the initial connection to the server and the
// actual transfer of data. Firing these events here simulates, appeasing applications
// that are expecting that initial pair.
m_pEvents1->Fire_DownloadBegin();
m_pEvents2->Fire_DownloadBegin();
m_pEvents1->Fire_DownloadComplete();
m_pEvents2->Fire_DownloadComplete();
return NS_OK;
}
NS_IMETHODIMP
CWebShellContainer::ProgressLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aProgress, PRInt32 aProgressMax)
{
USES_CONVERSION;
NG_TRACE(_T("CWebShellContainer::ProgressLoadURL(..., \"%s\", %d, %d)\n"), W2T(aURL), (int) aProgress, (int) aProgressMax);
long nProgress = aProgress;
long nProgressMax = aProgressMax;
if (nProgress == 0)
{
}
if (nProgressMax == 0)
{
nProgressMax = LONG_MAX;
}
if (nProgress > nProgressMax)
{
nProgress = nProgressMax; // Progress complete
}
m_pEvents1->Fire_ProgressChange(nProgress, nProgressMax);
m_pEvents2->Fire_ProgressChange(nProgress, nProgressMax);
return NS_OK;
}
NS_IMETHODIMP
CWebShellContainer::EndLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, nsresult aStatus)
{
USES_CONVERSION;
NG_TRACE(_T("CWebShellContainer::EndLoadURL(..., \"%s\", %d)\n"), W2T(aURL), (int) aStatus);
// Fire a NavigateComplete event
OLECHAR *pszURL = W2OLE((WCHAR *) aURL);
BSTR bstrURL = SysAllocString(pszURL);
m_pEvents1->Fire_NavigateComplete(bstrURL);
// Fire a NavigateComplete2 event
CComVariant vURL(bstrURL);
m_pEvents2->Fire_NavigateComplete2(m_pOwner, &vURL);
// Fire the new NavigateForward state
VARIANT_BOOL bEnableForward = VARIANT_FALSE;
if ( m_pOwner->m_pIWebShell->CanForward() == NS_OK )
{
bEnableForward = VARIANT_TRUE;
}
m_pEvents2->Fire_CommandStateChange(CSC_NAVIGATEFORWARD, bEnableForward);
// Fire the new NavigateBack state
VARIANT_BOOL bEnableBack = VARIANT_FALSE;
if ( m_pOwner->m_pIWebShell->CanBack() == NS_OK )
{
bEnableBack = VARIANT_TRUE;
}
m_pEvents2->Fire_CommandStateChange(CSC_NAVIGATEBACK, bEnableBack);
m_pOwner->m_bBusy = FALSE;
SysFreeString(bstrURL);
return NS_OK;
}
NS_IMETHODIMP
CWebShellContainer::NewWebShell(PRUint32 aChromeMask, PRBool aVisible, nsIWebShell *&aNewWebShell)
{
NG_TRACE_METHOD(CWebShellContainer::NewWebShell);
nsresult rv = NS_ERROR_OUT_OF_MEMORY;
return rv;
}
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)
{
NG_TRACE_METHOD(CWebShellContainer::FocusAvailable);
return NS_OK;
}
NS_IMETHODIMP
CWebShellContainer::ContentShellAdded(nsIWebShell* aWebShell, nsIContent* frameNode)
{
NG_TRACE_METHOD(CWebShellContainer::ContentShellAdded);
nsresult rv = NS_OK;
return rv;
}
NS_IMETHODIMP
CWebShellContainer::CreatePopup(nsIDOMElement* aElement, nsIDOMElement* aPopupContent,
PRInt32 aXPos, PRInt32 aYPos,
const nsString& aPopupType, const nsString& anAnchorAlignment,
const nsString& aPopupAlignment,
nsIDOMWindow* aWindow, nsIDOMWindow** outPopup)
{
NG_TRACE_METHOD(CWebShellContainer::CreatePopup);
HMENU hMenu = ::CreatePopupMenu();
*outPopup = NULL;
InsertMenu(hMenu, 0, MF_BYPOSITION, 1, _T("TODO"));
TrackPopupMenu(hMenu, TPM_LEFTALIGN, aXPos, aYPos, NULL, NULL, NULL);
return NS_OK;
}
///////////////////////////////////////////////////////////////////////////////
// nsIStreamObserver implementation
NS_IMETHODIMP
CWebShellContainer::OnStartRequest(nsIChannel* aChannel, nsISupports* aContext)
{
USES_CONVERSION;
NG_TRACE(_T("CWebShellContainer::OnStartRequest(...)\n"));
return NS_OK;
}
NS_IMETHODIMP
CWebShellContainer::OnStopRequest(nsIChannel* aChannel, nsISupports* aContext, nsresult aStatus, const PRUnichar* aMsg)
{
USES_CONVERSION;
NG_TRACE(_T("CWebShellContainer::OnStopRequest(..., %d, \"%s\")\n"), (int) aStatus, W2T((PRUnichar *) aMsg));
// Fire a DownloadComplete event
m_pEvents1->Fire_DownloadComplete();
m_pEvents2->Fire_DownloadComplete();
return NS_OK;
}
///////////////////////////////////////////////////////////////////////////////
// nsIDocumentLoaderObserver implementation
NS_IMETHODIMP
CWebShellContainer::OnStartDocumentLoad(nsIDocumentLoader* loader, nsIURI* aURL, const char* aCommand)
{
char* wString = nsnull;
aURL->GetPath(&wString);
USES_CONVERSION;
NG_TRACE(_T("CWebShellContainer::OnStartDocumentLoad(..., %s, \"%s\")\n"),A2CT(wString), A2CT(aCommand));
//Fire a DownloadBegin
m_pEvents1->Fire_DownloadBegin();
m_pEvents2->Fire_DownloadBegin();
return NS_OK;
}
// we need this to fire the document complete
NS_IMETHODIMP
CWebShellContainer::OnEndDocumentLoad(nsIDocumentLoader* loader, nsIChannel *aChannel, nsresult aStatus)
{
NG_TRACE(_T("CWebShellContainer::OnEndDocumentLoad(..., \"\")\n"));
//Fire a DownloadComplete
m_pEvents1->Fire_DownloadComplete();
m_pEvents2->Fire_DownloadComplete();
char* aString = nsnull;
nsIURI* uri = nsnull;
aChannel->GetURI(&uri);
if (uri) {
uri->GetSpec(&aString);
}
if (aString == NULL)
{
return NS_ERROR_NULL_POINTER;
}
USES_CONVERSION;
BSTR bstrURL = SysAllocString(A2OLE((CHAR *) aString));
delete [] aString; // clean up.
// Fire a DocumentComplete event
CComVariant vURL(bstrURL);
m_pEvents2->Fire_DocumentComplete(m_pOwner, &vURL);
SysFreeString(bstrURL);
//Fire a StatusTextChange event
BSTR bstrStatus = SysAllocString(A2OLE((CHAR *) "Done"));
m_pEvents1->Fire_StatusTextChange(bstrStatus);
m_pEvents2->Fire_StatusTextChange(bstrStatus);
return NS_OK;
}
NS_IMETHODIMP
CWebShellContainer::OnStartURLLoad(nsIDocumentLoader* loader, nsIChannel* aChannel)
{
NG_TRACE(_T("CWebShellContainer::OnStartURLLoad(..., \"\")\n"));
//NOTE: This appears to get fired once for each individual item on a page.
return NS_OK;
}
NS_IMETHODIMP
CWebShellContainer::OnProgressURLLoad(nsIDocumentLoader* loader, nsIChannel* aChannel, PRUint32 aProgress, PRUint32 aProgressMax)
{
USES_CONVERSION;
NG_TRACE(_T("CWebShellContainer::OnProgress(..., \"%d\", \"%d\")\n"), (int) aProgress, (int) aProgressMax);
return NS_OK;
}
NS_IMETHODIMP
CWebShellContainer::OnStatusURLLoad(nsIDocumentLoader* loader, nsIChannel* aChannel, nsString& aMsg)
{
NG_TRACE(_T("CWebShellContainer::OnStatusURLLoad(..., \"\")\n"));
//NOTE: This appears to get fired for each individual item on a page, indicating the status of that item.
BSTR bstrStatus = SysAllocString(W2OLE((PRUnichar *) aMsg.GetUnicode()));
m_pEvents1->Fire_StatusTextChange(bstrStatus);
m_pEvents2->Fire_StatusTextChange(bstrStatus);
return NS_OK;
}
NS_IMETHODIMP
CWebShellContainer::OnEndURLLoad(nsIDocumentLoader* loader, nsIChannel* channel, nsresult aStatus)
{
NG_TRACE(_T("CWebShellContainer::OnEndURLLoad(..., \"\")\n"));
//NOTE: This appears to get fired once for each individual item on a page.
return NS_OK;
}

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

@ -1,107 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* 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 Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#ifndef WEBSHELLCONTAINER_H
#define WEBSHELLCONTAINER_H
// This is the class that handles the XPCOM side of things, callback
// interfaces into the web shell and so forth.
class CWebShellContainer :
public nsIBrowserWindow,
public nsIWebShellContainer,
public nsIStreamObserver,
public nsIDocumentLoaderObserver
{
public:
CWebShellContainer(CMozillaBrowser *pOwner);
protected:
virtual ~CWebShellContainer();
// Protected members
protected:
nsString m_sTitle;
CMozillaBrowser *m_pOwner;
CDWebBrowserEvents1 *m_pEvents1;
CDWebBrowserEvents2 *m_pEvents2;
public:
// nsISupports
NS_DECL_ISUPPORTS
// nsIBrowserWindow
NS_IMETHOD Init(nsIAppShell* aAppShell, nsIPref* aPrefs, 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);
// nsIWebShellContainer
NS_IMETHOD WillLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, nsLoadType aReason);
NS_IMETHOD BeginLoadURL(nsIWebShell* aShell, const PRUnichar* aURL);
NS_IMETHOD ProgressLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, PRInt32 aProgress, PRInt32 aProgressMax);
NS_IMETHOD EndLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, nsresult aStatus);
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,
PRInt32 aXPos, PRInt32 aYPos,
const nsString& aPopupType, const nsString& anAnchorAlignment,
const nsString& aPopupAlignment,
nsIDOMWindow* aWindow, nsIDOMWindow** outPopup);
// nsIStreamObserver
NS_IMETHOD OnStartRequest(nsIChannel* aChannel, nsISupports* aContext);
NS_IMETHOD OnStopRequest(nsIChannel* aChannel, nsISupports* aContext, nsresult aStatus, const PRUnichar* aMsg);
// nsIDocumentLoaderObserver
NS_DECL_NSIDOCUMENTLOADEROBSERVER
};
#endif