From e0687b722385f1bd5c2b981064b3fd0471f9593d Mon Sep 17 00:00:00 2001 From: "locka%iol.ie" Date: Tue, 7 Dec 1999 23:54:09 +0000 Subject: [PATCH] Fixed to build mozctl.dll git-svn-id: svn://10.0.0.236/trunk@55651 18797224-902f-48f8-a5cc-f745e15eee43 --- .../browser/activex/src/control/Master.dsp | 97 +++++++++ .../browser/activex/src/control/Master.dsw | 83 +++++++ .../activex/src/control/MozillaBrowser.cpp | 204 +++++++++++++++--- .../activex/src/control/MozillaControl.h | 12 +- .../activex/src/control/MozillaControl.idl | 11 +- .../browser/activex/src/control/StdAfx,h | 0 .../browser/activex/src/control/StdAfx.h | 25 +-- .../activex/src/control/WebShellContainer.cpp | 79 +++++-- .../activex/src/control/WebShellContainer.h | 2 +- .../browser/activex/src/control/guids.cpp | 1 + .../browser/activex/src/control/guids.h | 1 + .../browser/activex/src/control/makefile.win | 2 +- .../browser/activex/src/control/mkctldef.bat | 16 +- 13 files changed, 445 insertions(+), 88 deletions(-) create mode 100644 mozilla/embedding/browser/activex/src/control/Master.dsp create mode 100644 mozilla/embedding/browser/activex/src/control/Master.dsw create mode 100644 mozilla/embedding/browser/activex/src/control/StdAfx,h diff --git a/mozilla/embedding/browser/activex/src/control/Master.dsp b/mozilla/embedding/browser/activex/src/control/Master.dsp new file mode 100644 index 00000000000..f99a2f56728 --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/Master.dsp @@ -0,0 +1,97 @@ +# Microsoft Developer Studio Project File - Name="Master" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) External Target" 0x0106 + +CFG=Master - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "Master.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "Master.mak" CFG="Master - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "Master - Win32 Release" (based on "Win32 (x86) External Target") +!MESSAGE "Master - Win32 Debug" (based on "Win32 (x86) External Target") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" + +!IF "$(CFG)" == "Master - Win32 Release" + +# PROP BASE Use_MFC +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Cmd_Line "NMAKE /f Master.mak" +# PROP BASE Rebuild_Opt "/a" +# PROP BASE Target_File "Master.exe" +# PROP BASE Bsc_Name "Master.bsc" +# PROP BASE Target_Dir "" +# PROP Use_MFC +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Cmd_Line "nmake /f "Master.mak"" +# PROP Rebuild_Opt "/a" +# PROP Target_File "Master.exe" +# PROP Bsc_Name "" +# PROP Target_Dir "" + +!ELSEIF "$(CFG)" == "Master - Win32 Debug" + +# PROP BASE Use_MFC +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Master___Win32_Debug" +# PROP BASE Intermediate_Dir "Master___Win32_Debug" +# PROP BASE Cmd_Line "NMAKE /f Master.mak" +# PROP BASE Rebuild_Opt "/a" +# PROP BASE Target_File "Master.exe" +# PROP BASE Bsc_Name "Master.bsc" +# PROP BASE Target_Dir "" +# PROP Use_MFC +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Master___Win32_Debug" +# PROP Intermediate_Dir "Master___Win32_Debug" +# PROP Cmd_Line "nmake /f "Master.mak"" +# PROP Rebuild_Opt "/a" +# PROP Target_File "Master.exe" +# PROP Bsc_Name "" +# PROP Target_Dir "" + +!ENDIF + +# Begin Target + +# Name "Master - Win32 Release" +# Name "Master - Win32 Debug" + +!IF "$(CFG)" == "Master - Win32 Release" + +!ELSEIF "$(CFG)" == "Master - Win32 Debug" + +!ENDIF + +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project diff --git a/mozilla/embedding/browser/activex/src/control/Master.dsw b/mozilla/embedding/browser/activex/src/control/Master.dsw new file mode 100644 index 00000000000..59119338bd8 --- /dev/null +++ b/mozilla/embedding/browser/activex/src/control/Master.dsw @@ -0,0 +1,83 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "IEPatcher"=.\tests\IEPatcher\IEPatcher.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Master"=.\Master.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name cbrowse + End Project Dependency + Begin Project Dependency + Project_Dep_Name RegMozCtl + End Project Dependency +}}} + +############################################################################### + +Project: "MozillaControl"=.\MozillaControl.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "RegMozCtl"=.\tests\RegMozCtl\RegMozCtl.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "cbrowse"=.\tests\cbrowse\cbrowse.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/mozilla/embedding/browser/activex/src/control/MozillaBrowser.cpp b/mozilla/embedding/browser/activex/src/control/MozillaBrowser.cpp index 4cd4532a03c..d6b63e0b0db 100644 --- a/mozilla/embedding/browser/activex/src/control/MozillaBrowser.cpp +++ b/mozilla/embedding/browser/activex/src/control/MozillaBrowser.cpp @@ -23,6 +23,8 @@ #include "stdafx.h" #include #include +#include +#include #include "MozillaControl.h" #include "MozillaBrowser.h" @@ -77,6 +79,7 @@ CMozillaBrowser::CMozillaBrowser() // Initialize layout interfaces m_pIWebShell = nsnull; + m_pIPref = nsnull; m_pIServiceManager = nsnull; @@ -132,7 +135,7 @@ STDMETHODIMP CMozillaBrowser::InterfaceSupportsErrorInfo(REFIID riid) &IID_IWebBrowser2, &IID_IWebBrowserApp }; - for (int i=0;i': + case '<': + case '?': + break; + case '.': + if (szTmp[i+1] != '\0') { + szFile[j] = '_'; + j++; + } + break; + case '/': + szFile[j] = '-'; + j++; + break; + default: + szFile[j] = szTmp[i]; + j++; + } + } + szFile[j] = '\0'; + + HRESULT res = S_OK; + if ( GetSaveFileName(&SaveFileName) ) { + //Get the current DOM document + nsIDOMDocument* pDocument = nsnull; + res = GetDOMDocument(&pDocument); + if ( FAILED(res) ) + return res; + + //Get an nsIDiskDocument interface to the DOM document + nsCOMPtr diskDoc = do_QueryInterface(pDocument); + if (!diskDoc) + return E_NOINTERFACE; + + //Set the file type specified by the user + //Add the correct file extension if none is specified + nsIDiskDocument::ESaveFileType saveFileType; + if ( SaveFileName.nFilterIndex == 2 ) //SaveAs text file + saveFileType = nsIDiskDocument::eSaveFileText; + else //SaveAs html file + saveFileType = nsIDiskDocument::eSaveFileHTML; + + //Create an nsFilelSpec from the selected file path. + nsFileSpec fileSpec(szFile, PR_FALSE); + + //Save the file. + res = diskDoc->SaveFile(&fileSpec, PR_TRUE, PR_TRUE, saveFileType, ""); + } + return res; } LRESULT CMozillaBrowser::OnProperties(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) { + NG_TRACE_METHOD(CMozillaBrowser::OnProperties); + MessageBox(_T("No Properties Yet!"), _T("Control Message"), MB_OK); // TODO show the properties dialog return 0; @@ -320,6 +422,8 @@ LRESULT CMozillaBrowser::OnProperties(WORD wNotifyCode, WORD wID, HWND hWndCtl, LRESULT CMozillaBrowser::OnCut(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) { + NG_TRACE_METHOD(CMozillaBrowser::OnCut); + nsresult res; nsIPresShell* pIPresShell = nsnull; @@ -345,6 +449,8 @@ LRESULT CMozillaBrowser::OnCut(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& b LRESULT CMozillaBrowser::OnCopy(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) { + NG_TRACE_METHOD(CMozillaBrowser::OnCopy); + nsresult res; nsIPresShell* pIPresShell = nsnull; @@ -362,6 +468,8 @@ LRESULT CMozillaBrowser::OnCopy(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& LRESULT CMozillaBrowser::OnPaste(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) { + NG_TRACE_METHOD(CMozillaBrowser::OnPaste); + MessageBox(_T("No Paste Yet!"), _T("Control Message"), MB_OK); // TODO enable pasting return 0; @@ -369,6 +477,8 @@ LRESULT CMozillaBrowser::OnPaste(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& LRESULT CMozillaBrowser::OnSelectAll(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) { + NG_TRACE_METHOD(CMozillaBrowser::OnSelectAll); + MessageBox(_T("No Select All Yet!"), _T("Control Message"), MB_OK); // TODO enable Select All return 0; @@ -376,7 +486,9 @@ LRESULT CMozillaBrowser::OnSelectAll(WORD wNotifyCode, WORD wID, HWND hWndCtl, B // Handle ID_VIEWSOURCE command LRESULT CMozillaBrowser::OnViewSource(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) -{ +{ + NG_TRACE_METHOD(CMozillaBrowser::OnViewSource); + // Get the url from the web shell const PRUnichar *pszUrl = nsnull; PRInt32 aHistoryIndex; @@ -438,10 +550,11 @@ LRESULT CMozillaBrowser::OnViewSource(WORD wNotifyCode, WORD wID, HWND hWndCtl, // Test if the browser is in a valid state BOOL CMozillaBrowser::IsValid() { + NG_TRACE_METHOD(CMozillaBrowser::IsValid); + return (m_pIWebShell == nsnull) ? FALSE : TRUE; } - ///////////////////////////////////////////////////////////////////////////// static NS_DEFINE_IID(kIWebShellIID, NS_IWEB_SHELL_IID); @@ -525,7 +638,7 @@ HRESULT CMozillaBrowser::TermWebShell() // Create and initialise the web shell HRESULT CMozillaBrowser::CreateWebShell() -{ +{ NG_TRACE_METHOD(CMozillaBrowser::CreateWebShell); if (m_pIWebShell != nsnull) @@ -544,7 +657,7 @@ HRESULT CMozillaBrowser::CreateWebShell() nsresult rv; - // Load preferences + // Load preferences service rv = nsServiceManager::GetService(kPrefCID, nsIPref::GetIID(), (nsISupports **)&m_pIPref); @@ -555,6 +668,10 @@ HRESULT CMozillaBrowser::CreateWebShell() m_sErrorMessage = _T("Error - could not create preference object"); return E_FAIL; } + else { + rv = m_pIPref->StartUp(); //Initialize the preference service + rv = m_pIPref->ReadUserPrefs(); //Reads from default_prefs.js + } // Create the web shell object rv = nsComponentManager::CreateInstance(kWebShellCID, nsnull, @@ -568,6 +685,13 @@ HRESULT CMozillaBrowser::CreateWebShell() return E_FAIL; } + // Register the cookie service + NS_WITH_SERVICE(nsICookieService, cookieService, kCookieServiceCID, &rv); + if (NS_FAILED(rv) || (cookieService == nsnull)) { + NG_TRACE(_T("Could not register the cookie manager. rv=%08x\n"), (int) rv); + } + // TODO make the cookie service persistent. Currently does not save or load cookies to/from disk. + // Initialise the web shell, making it fit the control dimensions nsRect r; @@ -585,6 +709,7 @@ HRESULT CMozillaBrowser::CreateWebShell() nsScrollPreference_kAuto, aAllowPlugins, aIsSunkenBorder); + NG_ASSERT(NS_SUCCEEDED(rv)); // Create the container object @@ -606,6 +731,8 @@ HRESULT CMozillaBrowser::CreateWebShell() // Turns the editor mode on or off HRESULT CMozillaBrowser::SetEditorMode(BOOL bEnabled) { + NG_TRACE_METHOD(CMozillaBrowser::SetEditorMode); + m_bEditorMode = FALSE; if (bEnabled && m_pEditor == nsnull) { @@ -663,6 +790,8 @@ HRESULT CMozillaBrowser::SetEditorMode(BOOL bEnabled) HRESULT CMozillaBrowser::OnEditorCommand(DWORD nCmdID) { + NG_TRACE_METHOD(CMozillaBrowser::OnEditorCommand); + static nsIAtom * propB = NS_NewAtom("b"); static nsIAtom * propI = NS_NewAtom("i"); static nsIAtom * propU = NS_NewAtom("u"); @@ -731,6 +860,7 @@ HRESULT CMozillaBrowser::OnEditorCommand(DWORD nCmdID) HRESULT CMozillaBrowser::GetPresShell(nsIPresShell **pPresShell) { NG_TRACE_METHOD(CMozillaBrowser::GetPresShell); + nsresult res; // Test for stupid args @@ -776,6 +906,7 @@ HRESULT CMozillaBrowser::GetPresShell(nsIPresShell **pPresShell) HRESULT CMozillaBrowser::GetDOMDocument(nsIDOMDocument **pDocument) { NG_TRACE_METHOD(CMozillaBrowser::GetDOMDocument); + nsresult res; // Test for stupid args @@ -921,6 +1052,8 @@ HRESULT CMozillaBrowser::UnloadBrowserHelpers() HRESULT CMozillaBrowser::InPlaceActivate(LONG iVerb, const RECT* prcPosRect) { + NG_TRACE_METHOD(CMozillaBrowser::InPlaceActivate); + HRESULT hr; if (m_spClientSite == NULL) @@ -1055,6 +1188,8 @@ HRESULT CMozillaBrowser::InPlaceActivate(LONG iVerb, const RECT* prcPosRect) HRESULT STDMETHODCALLTYPE CMozillaBrowser::GetClientSite(IOleClientSite **ppClientSite) { + NG_TRACE_METHOD(CMozillaBrowser::GetClientSite); + NG_ASSERT(ppClientSite); // This fixes a problem in the base class which asserts if the client @@ -1140,7 +1275,6 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::GoHome(void) sUrl = A2T(szBuffer); } } - // Navigate to the home page Navigate(T2OLE(sUrl), NULL, NULL, NULL, NULL); @@ -1167,7 +1301,6 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::GoSearch(void) // TODO find and navigate to the search page stored in prefs // and not this hard coded address } - Navigate(T2OLE(sUrl), NULL, NULL, NULL, NULL); return S_OK; @@ -1215,7 +1348,7 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::Navigate(BSTR URL, VARIANT __RPC_FAR Flags->vt != VT_NULL) { CComVariant vFlags; - if (vFlags.ChangeType(VT_I4, Flags) != S_OK) + if ( vFlags.ChangeType(VT_I4, Flags) != S_OK ) { NG_ASSERT(0); RETURN_E_INVALIDARG(); @@ -1260,7 +1393,7 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::Navigate(BSTR URL, VARIANT __RPC_FAR lFlags &= ~(navOpenInNewWindow); if ((bCancel == VARIANT_FALSE) && spDispNew) { - CIPtr(IWebBrowser2) spOther = spDispNew;; + CIPtr(IWebBrowser2) spOther = spDispNew; if (spOther) { CComVariant vURL(URL); @@ -1291,7 +1424,7 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::Navigate(BSTR URL, VARIANT __RPC_FAR // Load the URL char *tmpCommand = sCommand.ToNewCString(); nsresult res = m_pIWebShell->LoadURL(sUrl.GetUnicode()); - + /* , tmpCommand, pIPostData, bModifyHistory); NS_IMETHOD LoadURL(const PRUnichar *aURLSpec, nsIInputStream* aPostDataStream=nsnull, @@ -1339,7 +1472,7 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::Refresh2(VARIANT __RPC_FAR *Level) if (Level) { CComVariant vLevelAsInt; - if (vLevelAsInt.ChangeType(VT_I4, Level) != S_OK) + if ( vLevelAsInt.ChangeType(VT_I4, Level) != S_OK ) { NG_ASSERT(0); RETURN_E_UNEXPECTED(); @@ -1594,6 +1727,8 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::put_Left(long Left) NG_ASSERT(0); RETURN_E_UNEXPECTED(); } + + //TODO: Implement put_Left - Should set the left position of this control. return S_OK; } @@ -1723,16 +1858,16 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_LocationName(BSTR __RPC_FAR *Loca } // Get the url from the web shell - const PRUnichar *pszLocationName = nsnull; - m_pIWebShell->GetTitle(&pszLocationName); - if (pszLocationName == nsnull) + nsXPIDLString szLocationName; + m_pIWebShell->GetTitle(getter_Copies(szLocationName)); + if (nsnull == (const PRUnichar *) szLocationName) { RETURN_E_UNEXPECTED(); } // Convert the string to a BSTR USES_CONVERSION; - LPOLESTR pszConvertedLocationName = W2OLE(const_cast(pszLocationName)); + LPCOLESTR pszConvertedLocationName = W2COLE((const PRUnichar *) szLocationName); *LocationName = SysAllocString(pszConvertedLocationName); return S_OK; @@ -1938,7 +2073,8 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_HWND(long __RPC_FAR *pHWND) RETURN_E_INVALIDARG(); } - //This generates an exception in the IE control. + //This is supposed to return a handle to the IE main window. Since that doesn't exist + //in the control's case, this shouldn't do anything. *pHWND = NULL; return S_OK; } @@ -2079,6 +2215,8 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::get_StatusText(BSTR __RPC_FAR *Status } //TODO: Implement get_StatusText + //NOTE: This function is related to the MS status bar which doesn't exist in this control. Needs more + // investigation, but probably doesn't apply. *StatusText = SysAllocString(L""); return S_OK; } @@ -2095,6 +2233,8 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::put_StatusText(BSTR StatusText) } //TODO: Implement put_StatusText + //NOTE: This function is related to the MS status bar which doesn't exist in this control. Needs more + // investigation, but probably doesn't apply. return S_OK; } @@ -2235,7 +2375,7 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::Navigate2(VARIANT __RPC_FAR *URL, VAR #endif CComVariant vURLAsString; - if (vURLAsString.ChangeType(VT_BSTR, URL) != S_OK) + if ( vURLAsString.ChangeType(VT_BSTR, URL) != S_OK ) { RETURN_E_INVALIDARG(); } @@ -2483,28 +2623,31 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::put_RegisterAsDropTarget(VARIANT_BOOL pDropTarget->AddRef(); pDropTarget->SetOwner(this); + // Ask the site if it wants to replace this drop target for another one CIPtr(IDropTarget) spDropTarget; CIPtr(IDocHostUIHandler) spDocHostUIHandler = m_spClientSite; if (spDocHostUIHandler) { - if (spDocHostUIHandler->GetDropTarget(pDropTarget, &spDropTarget) != S_OK) + //if (spDocHostUIHandler->GetDropTarget(pDropTarget, &spDropTarget) != S_OK) + if (spDocHostUIHandler->GetDropTarget(pDropTarget, &spDropTarget) == S_OK) { - spDropTarget = pDropTarget; + m_bDropTarget = TRUE; + ::RegisterDragDrop(m_hWnd, spDropTarget); + //spDropTarget = pDropTarget; } } - if (spDropTarget) + else + //if (spDropTarget) { m_bDropTarget = TRUE; - ::RegisterDragDrop(m_hWnd, spDropTarget); + ::RegisterDragDrop(m_hWnd, pDropTarget); + //::RegisterDragDrop(m_hWnd, spDropTarget); } - pDropTarget->Release(); } - // Now revoke any child window drop targets and pray they aren't // reset by the layout engine. - ::EnumChildWindows(m_hWnd, EnumChildProc, (LPARAM) this); } } @@ -2631,7 +2774,6 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::put_Resizable(VARIANT_BOOL Value) return S_OK; } - /////////////////////////////////////////////////////////////////////////////// // Ole Command Handlers @@ -2648,4 +2790,4 @@ HRESULT _stdcall CMozillaBrowser::EditCommandHandler(CMozillaBrowser *pThis, con { pThis->OnEditorCommand(nCmdID); return S_OK; -} +} \ No newline at end of file diff --git a/mozilla/embedding/browser/activex/src/control/MozillaControl.h b/mozilla/embedding/browser/activex/src/control/MozillaControl.h index 47700fce203..866d697bd0d 100644 --- a/mozilla/embedding/browser/activex/src/control/MozillaControl.h +++ b/mozilla/embedding/browser/activex/src/control/MozillaControl.h @@ -2,7 +2,7 @@ /* File created by MIDL compiler version 5.01.0164 */ -/* at Thu Nov 11 22:06:45 1999 +/* at Tue Dec 07 23:42:45 1999 */ /* Compiler settings for MozillaControl.idl: Oicf (OptLev=i2), W1, Zp8, env=Win32, ms_ext, c_ext @@ -85,6 +85,16 @@ void __RPC_USER MIDL_user_free( void __RPC_FAR * ); /* library MOZILLACONTROLLib */ /* [helpstring][version][uuid] */ +#ifndef __exdisp_h__ +#define __exdisp_h__ +typedef /* [helpstring][uuid] */ +enum CommandStateChangeConstants + { CSC_UPDATECOMMANDS = 0xffffffff, + CSC_NAVIGATEFORWARD = 0x1, + CSC_NAVIGATEBACK = 0x2 + } CommandStateChangeConstants; + +#endif EXTERN_C const IID LIBID_MOZILLACONTROLLib; diff --git a/mozilla/embedding/browser/activex/src/control/MozillaControl.idl b/mozilla/embedding/browser/activex/src/control/MozillaControl.idl index ff83be352cf..5c19af65e16 100644 --- a/mozilla/embedding/browser/activex/src/control/MozillaControl.idl +++ b/mozilla/embedding/browser/activex/src/control/MozillaControl.idl @@ -23,9 +23,14 @@ library MOZILLACONTROLLib importlib("stdole32.tlb"); importlib("stdole2.tlb"); + // Stop interfaces and other bits from being redefined by the IE header file + + cpp_quote("#ifndef __exdisp_h__") + cpp_quote("#define __exdisp_h__") + // NOTE: There is a very specific reason for repeating the IWebBrowser - // verbatim rather than import'ing exdisp.idl - it stops MIDL - // failing with a MIDL2020 error! + // and other bits verbatim rather than import'ing exdisp.idl - + // MIDL fails with a MIDL2020 error if we try that! [ uuid(EAB22AC1-30C1-11CF-A7EB-0000C05BAE0B), // IID_IWebBrowser @@ -423,4 +428,6 @@ library MOZILLACONTROLLib [source] dispinterface DWebBrowserEvents; [default, source] dispinterface DWebBrowserEvents2; }; + + cpp_quote("#endif") }; diff --git a/mozilla/embedding/browser/activex/src/control/StdAfx,h b/mozilla/embedding/browser/activex/src/control/StdAfx,h new file mode 100644 index 00000000000..e69de29bb2d diff --git a/mozilla/embedding/browser/activex/src/control/StdAfx.h b/mozilla/embedding/browser/activex/src/control/StdAfx.h index 78996a02cce..8ac56b296da 100644 --- a/mozilla/embedding/browser/activex/src/control/StdAfx.h +++ b/mozilla/embedding/browser/activex/src/control/StdAfx.h @@ -37,15 +37,6 @@ #define _ATL_APARTMENT_THREADED #define _ATL_STATIC_REGISTRY -// Comment these out as appropriate -#ifdef MOZ_ACTIVEX_CONTROL_SUPPORT -#define USE_CONTROL -#endif - -#ifdef MOZ_ACTIVEX_PLUGIN_SUPPORT -#define USE_PLUGIN -#endif - // ATL headers #include //You may derive a class from CComModule and use it if you want to override @@ -75,7 +66,6 @@ typedef long int32; // Mozilla headers -#ifdef USE_CONTROL #include "xp_core.h" #include "jscompat.h" @@ -90,6 +80,8 @@ typedef long int32; #include "nsViewsCID.h" #include "nsString.h" #include "nsCOMPtr.h" +#include "nsXPIDLString.h" +#include "nsICookieService.h" #include "nsIHTTPChannel.h" @@ -122,7 +114,6 @@ typedef long int32; #include "nsIDOMDocument.h" #include "nsIDOMDocumentType.h" #include "nsIDOMElement.h" -#endif // Mozilla control headers #include "resource.h" @@ -139,24 +130,12 @@ typedef long int32; #include "ControlSite.h" #include "ControlSiteIPFrame.h" -#ifdef USE_CONTROL #include "IEHtmlDocument.h" #include "CPMozillaControl.h" #include "MozillaBrowser.h" #include "WebShellContainer.h" #include "DropTarget.h" #include "guids.h" -#endif - -#ifdef USE_PLUGIN -#include "npapi.h" -#include "nsIFactory.h" -#include "nsIPlugin.h" -#include "nsIPluginInstance.h" -#include "ActiveXPlugin.h" -#include "ActiveXPluginInstance.h" -#include "ActiveScriptSite.h" -#endif //{{AFX_INSERT_LOCATION}} // Microsoft Developer Studio will insert additional declarations immediately before the previous line. diff --git a/mozilla/embedding/browser/activex/src/control/WebShellContainer.cpp b/mozilla/embedding/browser/activex/src/control/WebShellContainer.cpp index 17ee080d06e..fac24915c68 100644 --- a/mozilla/embedding/browser/activex/src/control/WebShellContainer.cpp +++ b/mozilla/embedding/browser/activex/src/control/WebShellContainer.cpp @@ -183,12 +183,19 @@ CWebShellContainer::GetChrome(PRUint32& aChromeMaskResult) NS_IMETHODIMP CWebShellContainer::SetTitle(const PRUnichar* aTitle) { + //Fire a title change event + USES_CONVERSION; + LPOLESTR pszConvertedLocationName = W2OLE(const_cast(aTitle)); + BSTR __RPC_FAR LocationName = SysAllocString(pszConvertedLocationName); + m_pEvents1->Fire_TitleChange(LocationName); + m_pEvents2->Fire_TitleChange(LocationName); + return NS_OK; } NS_IMETHODIMP -CWebShellContainer::GetTitle(const PRUnichar** aResult) +CWebShellContainer::GetTitle(PRUnichar** aResult) { NG_TRACE_METHOD(CWebShellContainer::GetTitle); *aResult = nsnull; @@ -199,8 +206,10 @@ CWebShellContainer::GetTitle(const PRUnichar** aResult) 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); @@ -237,6 +246,7 @@ NS_IMETHODIMP CWebShellContainer::SetProgress(PRInt32 aProgress, PRInt32 aProgressMax) { NG_TRACE_METHOD(CWebShellContainer::SetProgress); + return NS_OK; } @@ -285,10 +295,6 @@ CWebShellContainer::BeginLoadURL(nsIWebShell* aShell, const PRUnichar* aURL) USES_CONVERSION; NG_TRACE(_T("CWebShellContainer::BeginLoadURL(..., \"%s\")\n"), W2T(aURL)); - // Fire a DownloadBegin - m_pEvents1->Fire_DownloadBegin(); - m_pEvents2->Fire_DownloadBegin(); - // Fire a BeforeNavigate event OLECHAR *pszURL = W2OLE((WCHAR *)aURL); BSTR bstrURL = SysAllocString(pszURL); @@ -320,6 +326,20 @@ CWebShellContainer::BeginLoadURL(nsIWebShell* aShell, const PRUnichar* aURL) { 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; } @@ -367,13 +387,12 @@ CWebShellContainer::EndLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, nsres CComVariant vURL(bstrURL); m_pEvents2->Fire_NavigateComplete2(m_pOwner, &vURL); - // Fire the new NavigateForward state + // 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 @@ -382,7 +401,6 @@ CWebShellContainer::EndLoadURL(nsIWebShell* aShell, const PRUnichar* aURL, nsres { bEnableBack = VARIANT_TRUE; } - m_pEvents2->Fire_CommandStateChange(CSC_NAVIGATEBACK, bEnableBack); m_pOwner->m_bBusy = FALSE; @@ -460,7 +478,7 @@ CWebShellContainer::OnStartRequest(nsIChannel* aChannel, nsISupports* aContext) { USES_CONVERSION; NG_TRACE(_T("CWebShellContainer::OnStartRequest(...)\n")); - + return NS_OK; } @@ -484,7 +502,16 @@ CWebShellContainer::OnStopRequest(nsIChannel* aChannel, nsISupports* aContext, n 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; } @@ -492,6 +519,12 @@ CWebShellContainer::OnStartDocumentLoad(nsIDocumentLoader* loader, nsIURI* aURL, NS_IMETHODIMP CWebShellContainer::OnEndDocumentLoad(nsIDocumentLoader* loader, nsIChannel *aChannel, nsresult aStatus, nsIDocumentLoaderObserver * aObserver) { + NG_TRACE(_T("CWebShellContainer::OnEndDocumentLoad(..., \"\")\n")); + + //Fire a DownloadComplete + m_pEvents1->Fire_DownloadComplete(); + m_pEvents2->Fire_DownloadComplete(); + char* aString = nsnull; nsIURI* uri = nsnull; @@ -504,7 +537,7 @@ CWebShellContainer::OnEndDocumentLoad(nsIDocumentLoader* loader, nsIChannel *aCh return NS_ERROR_NULL_POINTER; } - USES_CONVERSION; + USES_CONVERSION; BSTR bstrURL = SysAllocString(A2OLE((CHAR *) aString)); delete [] aString; // clean up. @@ -514,12 +547,21 @@ CWebShellContainer::OnEndDocumentLoad(nsIDocumentLoader* loader, nsIChannel *aCh 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, nsIContentViewer* aViewer) { + NG_TRACE(_T("CWebShellContainer::OnStartURLLoad(..., \"\")\n")); + + //NOTE: This appears to get fired once for each individual item on a page. + return NS_OK; } @@ -532,10 +574,16 @@ CWebShellContainer::OnProgressURLLoad(nsIDocumentLoader* loader, nsIChannel* aCh return NS_OK; } -// we don't care about these. 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; } @@ -543,6 +591,10 @@ CWebShellContainer::OnStatusURLLoad(nsIDocumentLoader* loader, nsIChannel* aChan 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; } @@ -551,5 +603,4 @@ NS_IMETHODIMP CWebShellContainer::HandleUnknownContentType(nsIDocumentLoader* loader, nsIChannel *aChannel, const char *aContentType, const char *aCommand ) { return NS_OK; -} - +} \ No newline at end of file diff --git a/mozilla/embedding/browser/activex/src/control/WebShellContainer.h b/mozilla/embedding/browser/activex/src/control/WebShellContainer.h index c5afffb70df..6d52dc77d81 100644 --- a/mozilla/embedding/browser/activex/src/control/WebShellContainer.h +++ b/mozilla/embedding/browser/activex/src/control/WebShellContainer.h @@ -67,7 +67,7 @@ public: NS_IMETHOD SetChrome(PRUint32 aNewChromeMask); NS_IMETHOD GetChrome(PRUint32& aChromeMaskResult); NS_IMETHOD SetTitle(const PRUnichar* aTitle); - NS_IMETHOD GetTitle(const PRUnichar** aResult); + NS_IMETHOD GetTitle(PRUnichar** aResult); NS_IMETHOD SetStatus(const PRUnichar* aStatus); NS_IMETHOD GetStatus(const PRUnichar** aResult); NS_IMETHOD SetDefaultStatus(const PRUnichar* aStatus); diff --git a/mozilla/embedding/browser/activex/src/control/guids.cpp b/mozilla/embedding/browser/activex/src/control/guids.cpp index 624f187a3bd..b49fced78fb 100644 --- a/mozilla/embedding/browser/activex/src/control/guids.cpp +++ b/mozilla/embedding/browser/activex/src/control/guids.cpp @@ -25,6 +25,7 @@ // Class IDs NS_DEFINE_IID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); NS_DEFINE_IID(kHTMLEditorCID, NS_HTMLEDITOR_CID); +NS_DEFINE_CID(kCookieServiceCID, NS_COOKIESERVICE_CID); // Interface IDs NS_DEFINE_IID(kIBrowserWindowIID, NS_IBROWSER_WINDOW_IID); diff --git a/mozilla/embedding/browser/activex/src/control/guids.h b/mozilla/embedding/browser/activex/src/control/guids.h index a6e68d588d2..1da347ccf28 100644 --- a/mozilla/embedding/browser/activex/src/control/guids.h +++ b/mozilla/embedding/browser/activex/src/control/guids.h @@ -28,6 +28,7 @@ // Class IDs NS_EXTERN_IID(kEventQueueServiceCID); NS_EXTERN_IID(kHTMLEditorCID); +NS_EXTERN_IID(kCookieServiceCID); // Interface IDs NS_EXTERN_IID(kIBrowserWindowIID); diff --git a/mozilla/embedding/browser/activex/src/control/makefile.win b/mozilla/embedding/browser/activex/src/control/makefile.win index 59f2ec2cb93..669a4a92077 100644 --- a/mozilla/embedding/browser/activex/src/control/makefile.win +++ b/mozilla/embedding/browser/activex/src/control/makefile.win @@ -75,7 +75,7 @@ LINCS= \ $(NULL) LLIBS= \ -# $(DIST)\lib\gkgfxwin.lib \ + $(DIST)\lib\gkgfxwin.lib \ # $(DIST)\lib\gkweb.lib \ $(DIST)\lib\xpcom.lib \ $(LIBNSPR) \ diff --git a/mozilla/embedding/browser/activex/src/control/mkctldef.bat b/mozilla/embedding/browser/activex/src/control/mkctldef.bat index 6268d32e8b5..9b4302a3f26 100755 --- a/mozilla/embedding/browser/activex/src/control/mkctldef.bat +++ b/mozilla/embedding/browser/activex/src/control/mkctldef.bat @@ -6,7 +6,7 @@ REM what has been set to go into it echo ; mozctl.def : Declares the module parameters. > %1 echo ; This file was autogenerated by mkctldef.bat! >> %1 echo. >> %1 -echo LIBRARY "npmozctl.DLL" >> %1 +echo LIBRARY "mozctl.DLL" >> %1 echo EXPORTS >> %1 echo ; ActiveX exports >> %1 echo DllCanUnloadNow @100 PRIVATE >> %1 @@ -14,17 +14,3 @@ echo DllGetClassObject @101 PRIVATE >> %1 echo DllRegisterServer @102 PRIVATE >> %1 echo DllUnregisterServer @103 PRIVATE >> %1 echo. >> %1 - -:test_plugin -if NOT "%MOZ_ACTIVEX_PLUGIN_SUPPORT%"=="1" goto test_control -echo ; Plugin exports >> %1 -echo NP_GetEntryPoints @1 >> %1 -echo NP_Initialize @2 >> %1 -echo NP_Shutdown @3 >> %1 -echo ; NSGetFactory @10 >> %1 - -:test_control -if NOT "%MOT_ACTIVEX_CONTROL_SUPPORT%"=="1" goto end - - -:end \ No newline at end of file