diff --git a/k-meleon/KMeleon10.sln b/k-meleon/KMeleon10.sln index 40711480..10e59b7e 100644 --- a/k-meleon/KMeleon10.sln +++ b/k-meleon/KMeleon10.sln @@ -32,6 +32,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "login", "kplugins\login\log EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "spellcheck", "kplugins\spellcheck\spellcheck.vcxproj", "{3D4DAD90-C0B3-4741-B9C1-6A3C5AD57F7E}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "winEmbed", "winEmbed\winEmbed.vcxproj", "{C938963C-0912-4455-B008-9F385023ECDB}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -129,6 +131,12 @@ Global {3D4DAD90-C0B3-4741-B9C1-6A3C5AD57F7E}.Release Static MFC|Win32.Build.0 = Release|Win32 {3D4DAD90-C0B3-4741-B9C1-6A3C5AD57F7E}.Release|Win32.ActiveCfg = Release|Win32 {3D4DAD90-C0B3-4741-B9C1-6A3C5AD57F7E}.Release|Win32.Build.0 = Release|Win32 + {C938963C-0912-4455-B008-9F385023ECDB}.Debug|Win32.ActiveCfg = Debug|Win32 + {C938963C-0912-4455-B008-9F385023ECDB}.Debug|Win32.Build.0 = Debug|Win32 + {C938963C-0912-4455-B008-9F385023ECDB}.Release Static MFC|Win32.ActiveCfg = Release Static MFC|Win32 + {C938963C-0912-4455-B008-9F385023ECDB}.Release Static MFC|Win32.Build.0 = Release Static MFC|Win32 + {C938963C-0912-4455-B008-9F385023ECDB}.Release|Win32.ActiveCfg = Release|Win32 + {C938963C-0912-4455-B008-9F385023ECDB}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/k-meleon/app/nsProfileDirServiceProvider.cpp b/k-meleon/app/nsProfileDirServiceProvider.cpp index 8def4338..00bf7b50 100644 --- a/k-meleon/app/nsProfileDirServiceProvider.cpp +++ b/k-meleon/app/nsProfileDirServiceProvider.cpp @@ -3,8 +3,12 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#ifndef _NONAFX #include "StdAfx.h" -//#include "nsProfileDirServiceProvider.h" +#else +#include "winEmbed.h" +#endif +#include "nsProfileDirServiceProvider.h" #include "nsProfileStringTypes.h" #include "nsProfileLock.h" #include "nsIFile.h" @@ -138,7 +142,7 @@ nsProfileDirServiceProvider::Shutdown() // nsProfileDirServiceProvider::nsISupports //***************************************************************************** -NS_IMPL_ISUPPORTS1(nsProfileDirServiceProvider, +NS_IMPL_ISUPPORTS(nsProfileDirServiceProvider, nsIDirectoryServiceProvider) //***************************************************************************** @@ -229,7 +233,9 @@ nsProfileDirServiceProvider::GetFile(const char *prop, bool *persistant, nsIFile if (localFile && NS_SUCCEEDED(rv)) - return CallQueryInterface(localFile, _retval); + return localFile->QueryInterface(NS_GET_IID(nsIFile), (void**)_retval); + // return CallQueryInterface(localFile, _retval); + return rv; } diff --git a/k-meleon/app/nsProfileLock.cpp b/k-meleon/app/nsProfileLock.cpp index cc968e1d..04634769 100644 --- a/k-meleon/app/nsProfileLock.cpp +++ b/k-meleon/app/nsProfileLock.cpp @@ -3,7 +3,11 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#ifndef _NONAFX #include "StdAfx.h" +#else +#include "winEmbed.h" +#endif #include "nsProfileStringTypes.h" #include "nsProfileLock.h" #include "nsCOMPtr.h" diff --git a/k-meleon/winEmbed/Makefile.in b/k-meleon/winEmbed/Makefile.in new file mode 100644 index 00000000..ed8ec61f --- /dev/null +++ b/k-meleon/winEmbed/Makefile.in @@ -0,0 +1,100 @@ +# ***** BEGIN LICENSE BLOCK ***** +# Version: Mozilla-sample-code 1.0 +# +# Copyright (c) 2002 Netscape Communications Corporation and +# other contributors +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this Mozilla sample software and associated documentation files +# (the "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to permit +# persons to whom the Software is furnished to do so, subject to the +# following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# +# Contributor(s): +# +# ***** END LICENSE BLOCK ***** + +DEPTH = ../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +XPI_NAME = winembed + +PROGRAM = winEmbed$(BIN_SUFFIX) +RESFILE = winEmbed.res + +MODULE = winEmbed + +REQUIRES = xpcom \ + string \ + embed_base \ + webbrwsr \ + webshell \ + windowwatcher \ + profile \ + necko \ + docshell \ + dom \ + widget \ + uriloader \ + shistory \ + webbrowserpersist \ + profdirserviceprovider \ + xulapp \ + $(NULL) + +CPPSRCS = \ + winEmbed.cpp \ + WebBrowserChrome.cpp \ + WindowCreator.cpp \ + $(NULL) + +LIBS = \ + $(DEPTH)/profile/dirserviceprovider/standalone/$(LIB_PREFIX)profdirserviceprovidersa_s.$(LIB_SUFFIX) \ + $(XPCOM_STANDALONE_GLUE_LDOPTS) \ + $(NULL) + +LOCAL_INCLUDES = -I$(srcdir) + +DEFINES += -DXPCOM_GLUE + +OS_LIBS += $(call EXPAND_LIBNAME,ole32 comdlg32 shell32 version) + +include $(topsrcdir)/config/config.mk + +include $(topsrcdir)/config/rules.mk + +# +# Control the default heap size. +# This is the heap returned by GetProcessHeap(). +# As we use the CRT heap, the default size is too large and wastes VM. +# +# The default heap size is 1MB on Win32. +# The heap will grow if need be. +# +# Set it to 256k. See bug 127069. +# +ifndef GNU_CC +LDFLAGS += /HEAP:0x40000 +endif + +# Get rid of console window +ifdef GNU_CC +LDFLAGS += -mwindows +endif diff --git a/k-meleon/winEmbed/SMALL.ICO b/k-meleon/winEmbed/SMALL.ICO new file mode 100644 index 00000000..ec288075 Binary files /dev/null and b/k-meleon/winEmbed/SMALL.ICO differ diff --git a/k-meleon/winEmbed/WebBrowserChrome.cpp b/k-meleon/winEmbed/WebBrowserChrome.cpp new file mode 100644 index 00000000..8afb8d03 --- /dev/null +++ b/k-meleon/winEmbed/WebBrowserChrome.cpp @@ -0,0 +1,590 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: Mozilla-sample-code 1.0 + * + * Copyright (c) 2002 Netscape Communications Corporation and + * other contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this Mozilla sample software and associated documentation files + * (the "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to permit + * persons to whom the Software is furnished to do so, subject to the + * following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Contributor(s): + * + * ***** END LICENSE BLOCK ***** */ + +// Local includes +#include "resource.h" +#include "winEmbed.h" +#include "WebBrowserChrome.h" + +// OS headers +#include + +// Frozen APIs + +#include "nsStringAPI.h" +#include "nsIComponentManager.h" +#include "nsIDOMWindow.h" +//#include "nsIGenericFactory.h" +#include "nsIInterfaceRequestor.h" +#include "nsIRequest.h" +#include "nsIURI.h" +#include "nsIWebProgress.h" +#include "nsCWebBrowser.h" +//#include "nsIProfileChangeStatus.h" +#include "nsIXPConnect.h" +#include "nsIScriptGlobalObject.h" + +// Glue APIs (not frozen, but safe to use because they are statically linked) +#include "nsComponentManagerUtils.h" + +// NON-FROZEN APIS! +#include "nsIWebNavigation.h" + +WebBrowserChrome::WebBrowserChrome() +{ + mNativeWindow = nullptr; + mSizeSet = PR_FALSE; +} + +WebBrowserChrome::~WebBrowserChrome() +{ + WebBrowserChromeUI::Destroyed(this); +} + +nsresult WebBrowserChrome::CreateBrowser(PRInt32 aX, PRInt32 aY, + PRInt32 aCX, PRInt32 aCY, + nsIWebBrowser **aBrowser) +{ + NS_ENSURE_ARG_POINTER(aBrowser); + *aBrowser = nullptr; + + mWebBrowser = do_CreateInstance(NS_WEBBROWSER_CONTRACTID); + + if (!mWebBrowser) + return NS_ERROR_FAILURE; + + (void)mWebBrowser->SetContainerWindow(static_cast(this)); + + nsCOMPtr browserBaseWindow = do_QueryInterface(mWebBrowser); + + mNativeWindow = WebBrowserChromeUI::CreateNativeWindow(static_cast(this)); + + if (!mNativeWindow) + return NS_ERROR_FAILURE; + + browserBaseWindow->InitWindow( mNativeWindow, + nullptr, + aX, aY, aCX, aCY); + browserBaseWindow->Create(); + + nsCOMPtr listener(static_cast(this)); + nsCOMPtr thisListener(do_GetWeakReference(listener)); + (void)mWebBrowser->AddWebBrowserListener(thisListener, + NS_GET_IID(nsIWebProgressListener)); + + // The window has been created. Now register for history notifications + mWebBrowser->AddWebBrowserListener(thisListener, NS_GET_IID(nsISHistoryListener)); + + if (mWebBrowser) + { + *aBrowser = mWebBrowser; + NS_ADDREF(*aBrowser); + return NS_OK; + } + return NS_ERROR_FAILURE; +} + +//***************************************************************************** +// WebBrowserChrome::nsISupports +//***************************************************************************** + +NS_IMPL_ADDREF(WebBrowserChrome) +NS_IMPL_RELEASE(WebBrowserChrome) + +NS_INTERFACE_MAP_BEGIN(WebBrowserChrome) + NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIWebBrowserChrome) + NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor) + NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChrome) + NS_INTERFACE_MAP_ENTRY(nsIEmbeddingSiteWindow) + NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener) // optional + NS_INTERFACE_MAP_ENTRY(nsISHistoryListener) + NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) + NS_INTERFACE_MAP_ENTRY(nsIObserver) + NS_INTERFACE_MAP_ENTRY(nsIContextMenuListener) + NS_INTERFACE_MAP_ENTRY(nsITooltipListener) +NS_INTERFACE_MAP_END + +//***************************************************************************** +// WebBrowserChrome::nsIInterfaceRequestor +//***************************************************************************** + +NS_IMETHODIMP WebBrowserChrome::GetInterface(const nsIID &aIID, void** aInstancePtr) +{ + NS_ENSURE_ARG_POINTER(aInstancePtr); + + *aInstancePtr = 0; + if (aIID.Equals(NS_GET_IID(nsIDOMWindow))) + { + if (mWebBrowser) + { + return mWebBrowser->GetContentDOMWindow((nsIDOMWindow **) aInstancePtr); + } + return NS_ERROR_NOT_INITIALIZED; + } + return QueryInterface(aIID, aInstancePtr); +} + +//***************************************************************************** +// WebBrowserChrome::nsIWebBrowserChrome +//***************************************************************************** + +NS_IMETHODIMP WebBrowserChrome::SetStatus(PRUint32 aType, const PRUnichar* aStatus) +{ + WebBrowserChromeUI::UpdateStatusBarText(this, aStatus); + return NS_OK; +} + +NS_IMETHODIMP WebBrowserChrome::GetWebBrowser(nsIWebBrowser** aWebBrowser) +{ + NS_ENSURE_ARG_POINTER(aWebBrowser); + *aWebBrowser = mWebBrowser; + NS_IF_ADDREF(*aWebBrowser); + return NS_OK; +} + +NS_IMETHODIMP WebBrowserChrome::SetWebBrowser(nsIWebBrowser* aWebBrowser) +{ + mWebBrowser = aWebBrowser; + return NS_OK; +} + +NS_IMETHODIMP WebBrowserChrome::GetChromeFlags(PRUint32* aChromeMask) +{ + *aChromeMask = mChromeFlags; + return NS_OK; +} + +NS_IMETHODIMP WebBrowserChrome::SetChromeFlags(PRUint32 aChromeMask) +{ + mChromeFlags = aChromeMask; + return NS_OK; +} + +NS_IMETHODIMP WebBrowserChrome::DestroyBrowserWindow(void) +{ + WebBrowserChromeUI::Destroy(this); + return NS_OK; +} + + +// IN: The desired browser client area dimensions. +NS_IMETHODIMP WebBrowserChrome::SizeBrowserTo(PRInt32 aWidth, PRInt32 aHeight) +{ + /* This isn't exactly correct: we're setting the whole window to + the size requested for the browser. At time of writing, though, + it's fine and useful for winEmbed's purposes. */ + WebBrowserChromeUI::SizeTo(this, aWidth, aHeight); + mSizeSet = PR_TRUE; + return NS_OK; +} + + +NS_IMETHODIMP WebBrowserChrome::ShowAsModal(void) +{ + if (mDependentParent) + AppCallbacks::EnableChromeWindow(mDependentParent, PR_FALSE); + + mContinueModalLoop = PR_TRUE; + AppCallbacks::RunEventLoop(mContinueModalLoop); + + if (mDependentParent) + AppCallbacks::EnableChromeWindow(mDependentParent, PR_TRUE); + + return NS_OK; +} + +NS_IMETHODIMP WebBrowserChrome::IsWindowModal(bool *retval) +{ + *retval = PR_FALSE; + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP WebBrowserChrome::ExitModalEventLoop(nsresult aStatus) +{ + mContinueModalLoop = PR_FALSE; + return NS_OK; +} + +//***************************************************************************** +// WebBrowserChrome::nsIWebBrowserChromeFocus +//***************************************************************************** + +NS_IMETHODIMP WebBrowserChrome::FocusNextElement() +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP WebBrowserChrome::FocusPrevElement() +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +//***************************************************************************** +// WebBrowserChrome::nsIWebProgressListener +//***************************************************************************** + +NS_IMETHODIMP WebBrowserChrome::OnProgressChange(nsIWebProgress *progress, nsIRequest *request, + PRInt32 curSelfProgress, PRInt32 maxSelfProgress, + PRInt32 curTotalProgress, PRInt32 maxTotalProgress) +{ + WebBrowserChromeUI::UpdateProgress(this, curTotalProgress, maxTotalProgress); + return NS_OK; +} + +NS_IMETHODIMP WebBrowserChrome::OnStateChange(nsIWebProgress *progress, nsIRequest *request, + PRUint32 progressStateFlags, nsresult status) +{ + if ((progressStateFlags & STATE_START) && (progressStateFlags & STATE_IS_DOCUMENT)) + { + WebBrowserChromeUI::UpdateBusyState(this, PR_TRUE); + } + + if ((progressStateFlags & STATE_STOP) && (progressStateFlags & STATE_IS_DOCUMENT)) + { + WebBrowserChromeUI::UpdateBusyState(this, PR_FALSE); + WebBrowserChromeUI::UpdateProgress(this, 0, 100); + WebBrowserChromeUI::UpdateStatusBarText(this, nullptr); + ContentFinishedLoading(); + } + + return NS_OK; +} + + +NS_IMETHODIMP WebBrowserChrome::OnLocationChange(nsIWebProgress* aWebProgress, + nsIRequest* aRequest, + nsIURI *location, uint32_t aFlags) +{ + PRBool isSubFrameLoad = PR_FALSE; // Is this a subframe load + if (aWebProgress) { + nsCOMPtr domWindow; + nsCOMPtr topDomWindow; + aWebProgress->GetDOMWindow(getter_AddRefs(domWindow)); + if (domWindow) { // Get root domWindow + domWindow->GetTop(getter_AddRefs(topDomWindow)); + } + if (domWindow != topDomWindow) + isSubFrameLoad = PR_TRUE; + } + if (!isSubFrameLoad) + WebBrowserChromeUI::UpdateCurrentURI(this); + return NS_OK; +} + +NS_IMETHODIMP +WebBrowserChrome::OnStatusChange(nsIWebProgress* aWebProgress, + nsIRequest* aRequest, + nsresult aStatus, + const PRUnichar* aMessage) +{ + WebBrowserChromeUI::UpdateStatusBarText(this, aMessage); + return NS_OK; +} + + + +NS_IMETHODIMP +WebBrowserChrome::OnSecurityChange(nsIWebProgress *aWebProgress, + nsIRequest *aRequest, + PRUint32 state) +{ + return NS_OK; +} + +//***************************************************************************** +// WebBrowserChrome::nsISHistoryListener +//***************************************************************************** + +NS_IMETHODIMP +WebBrowserChrome::OnHistoryNewEntry(nsIURI * aNewURI) +{ + return SendHistoryStatusMessage(aNewURI, "add"); +} + +NS_IMETHODIMP WebBrowserChrome::OnHistoryGoBack(nsIURI *aBackURI, bool *aContinue) +{ + // For now, let the operation continue + *aContinue = PR_TRUE; + return SendHistoryStatusMessage(aBackURI, "back"); +} + + +NS_IMETHODIMP +WebBrowserChrome::OnHistoryGoForward(nsIURI * aForwardURI, bool * aContinue) +{ + // For now, let the operation continue + *aContinue = PR_TRUE; + return SendHistoryStatusMessage(aForwardURI, "forward"); +} + + +NS_IMETHODIMP +WebBrowserChrome::OnHistoryReplaceEntry(PRInt32 aIndex) +{ + // For now, let the operation continue + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +WebBrowserChrome::Blur(void) +{ + // For now, let the operation continue + return NS_OK; +} + +NS_IMETHODIMP +WebBrowserChrome::OnHistoryGotoIndex(PRInt32 aIndex, nsIURI * aGotoURI, bool * aContinue) +{ + // For now, let the operation continue + *aContinue = PR_TRUE; + return SendHistoryStatusMessage(aGotoURI, "goto", aIndex); +} + +NS_IMETHODIMP +WebBrowserChrome::OnHistoryReload(nsIURI * aURI, PRUint32 aReloadFlags, bool * aContinue) +{ + // For now, let the operation continue + *aContinue = PR_TRUE; + return SendHistoryStatusMessage(aURI, "reload", 0 /* no info to pass here */, aReloadFlags); +} + +NS_IMETHODIMP +WebBrowserChrome::OnHistoryPurge(PRInt32 aNumEntries, bool *aContinue) +{ + // For now let the operation continue + *aContinue = PR_FALSE; + return SendHistoryStatusMessage(nullptr, "purge", aNumEntries); +} + +static void +AppendIntToCString(PRInt32 info1, nsCString& aResult) +{ + char intstr[10]; + _snprintf(intstr, sizeof(intstr) - 1, "%i", info1); + intstr[sizeof(intstr) - 1] = '\0'; + aResult.Append(intstr); +} + +nsresult +WebBrowserChrome::SendHistoryStatusMessage(nsIURI * aURI, char * operation, PRInt32 info1, PRUint32 aReloadFlags) +{ + nsCString uriSpec; + if (aURI) + { + aURI->GetSpec(uriSpec); + } + + nsCString status; + + if(!(strcmp(operation, "back"))) + { + status.Assign("Going back to url: "); + status.Append(uriSpec); + } + else if (!(strcmp(operation, "forward"))) + { + // Going forward. XXX Get string from a resource file + status.Assign("Going forward to url: "); + status.Append(uriSpec); + } + else if (!(strcmp(operation, "reload"))) + { + // Reloading. XXX Get string from a resource file + if (aReloadFlags & nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY && + aReloadFlags & nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE) + { + status.Assign("Reloading url, (bypassing proxy and cache): "); + } + else if (aReloadFlags & nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY) + { + status.Assign("Reloading url, (bypassing proxy): "); + } + else if (aReloadFlags & nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE) + { + status.Assign("Reloading url, (bypassing cache): "); + } + else + { + status.Assign("Reloading url, (normal): "); + } + status.Append(uriSpec); + } + else if (!(strcmp(operation, "add"))) + { + status.Assign(uriSpec); + status.Append(" added to session History"); + } + else if (!(strcmp(operation, "goto"))) + { + status.Assign("Going to HistoryIndex: "); + + AppendIntToCString(info1, status); + + status.Append(" Url: "); + status.Append(uriSpec); + } + else if (!(strcmp(operation, "purge"))) + { + AppendIntToCString(info1, status); + status.Append(" purged from Session History"); + } + + nsString wstatus; + NS_CStringToUTF16(status, NS_CSTRING_ENCODING_UTF8, wstatus); + WebBrowserChromeUI::UpdateStatusBarText(this, wstatus.get()); + + return NS_OK; +} + +void WebBrowserChrome::ContentFinishedLoading() +{ + // if it was a chrome window and no one has already specified a size, + // size to content + if (mWebBrowser && !mSizeSet && + (mChromeFlags & nsIWebBrowserChrome::CHROME_OPENAS_CHROME)) { + nsCOMPtr contentWin; + mWebBrowser->GetContentDOMWindow(getter_AddRefs(contentWin)); + if (contentWin) + contentWin->SizeToContent(); + WebBrowserChromeUI::ShowWindow(this, PR_TRUE); + } +} + + +//***************************************************************************** +// WebBrowserChrome::nsIEmbeddingSiteWindow +//***************************************************************************** + +NS_IMETHODIMP WebBrowserChrome::SetDimensions(PRUint32 aFlags, PRInt32 x, PRInt32 y, PRInt32 cx, PRInt32 cy) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP WebBrowserChrome::GetDimensions(PRUint32 aFlags, PRInt32 *x, PRInt32 *y, PRInt32 *cx, PRInt32 *cy) +{ + if (aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION) + { + *x = 0; + *y = 0; + } + if (aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER || + aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER) + { + *cx = 0; + *cy = 0; + } + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* void setFocus (); */ +NS_IMETHODIMP WebBrowserChrome::SetFocus() +{ + WebBrowserChromeUI::SetFocus(this); + return NS_OK; +} + +/* attribute wstring title; */ +NS_IMETHODIMP WebBrowserChrome::GetTitle(PRUnichar * *aTitle) +{ + NS_ENSURE_ARG_POINTER(aTitle); + + *aTitle = nullptr; + + return NS_ERROR_NOT_IMPLEMENTED; +} +NS_IMETHODIMP WebBrowserChrome::SetTitle(const PRUnichar * aTitle) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* attribute boolean visibility; */ +NS_IMETHODIMP WebBrowserChrome::GetVisibility(bool * aVisibility) +{ + NS_ENSURE_ARG_POINTER(aVisibility); + *aVisibility = PR_TRUE; + return NS_OK; +} +NS_IMETHODIMP WebBrowserChrome::SetVisibility(bool aVisibility) +{ + return NS_OK; +} + +/* attribute nativeSiteWindow siteWindow */ +NS_IMETHODIMP WebBrowserChrome::GetSiteWindow(void * *aSiteWindow) +{ + NS_ENSURE_ARG_POINTER(aSiteWindow); + + *aSiteWindow = mNativeWindow; + return NS_OK; +} + + +//***************************************************************************** +// WebBrowserChrome::nsIObserver +//***************************************************************************** + +NS_IMETHODIMP WebBrowserChrome::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *someData) +{ + nsresult rv = NS_OK; + if (strcmp(aTopic, "profile-change-teardown") == 0) + { + // A profile change means death for this window + WebBrowserChromeUI::Destroy(this); + } + return rv; +} + +//***************************************************************************** +// WebBrowserChrome::nsIContextMenuListener +//***************************************************************************** + +/* void OnShowContextMenu (in unsigned long aContextFlags, in nsIDOMEvent aEvent, in nsIDOMNode aNode); */ +NS_IMETHODIMP WebBrowserChrome::OnShowContextMenu(PRUint32 aContextFlags, nsIDOMEvent *aEvent, nsIDOMNode *aNode) +{ + WebBrowserChromeUI::ShowContextMenu(this, aContextFlags, aEvent, aNode); + return NS_OK; +} + +//***************************************************************************** +// WebBrowserChrome::nsITooltipListener +//***************************************************************************** + +/* void OnShowTooltip (in long aXCoords, in long aYCoords, in wstring aTipText); */ +NS_IMETHODIMP WebBrowserChrome::OnShowTooltip(PRInt32 aXCoords, PRInt32 aYCoords, const PRUnichar *aTipText) +{ + WebBrowserChromeUI::ShowTooltip(this, aXCoords, aYCoords, aTipText); + return NS_OK; +} + +/* void OnHideTooltip (); */ +NS_IMETHODIMP WebBrowserChrome::OnHideTooltip() +{ + WebBrowserChromeUI::HideTooltip(this); + return NS_OK; +} diff --git a/k-meleon/winEmbed/WebBrowserChrome.h b/k-meleon/winEmbed/WebBrowserChrome.h new file mode 100644 index 00000000..feae69b9 --- /dev/null +++ b/k-meleon/winEmbed/WebBrowserChrome.h @@ -0,0 +1,124 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: Mozilla-sample-code 1.0 + * + * Copyright (c) 2002 Netscape Communications Corporation and + * other contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this Mozilla sample software and associated documentation files + * (the "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to permit + * persons to whom the Software is furnished to do so, subject to the + * following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Contributor(s): + * + * ***** END LICENSE BLOCK ***** */ + +#ifndef __WebBrowserChrome__ +#define __WebBrowserChrome__ + +// OS headers + +#include + +// FROZEN APIs + +#include "nsStringAPI.h" + +#include "nsIWebBrowserChrome.h" +#include "nsIWebBrowserChromeFocus.h" + +#include "nsIContextMenuListener.h" +#include "nsIEmbeddingSiteWindow.h" +#include "nsIInterfaceRequestor.h" +#include "nsIObserver.h" +#include "nsISHistoryListener.h" +#include "nsITooltipListener.h" +#include "nsIWebProgressListener.h" +#include "nsIWebBrowser.h" + +// GLUE APIs (not frozen, but safe because we're statically linking them) +#include "nsCOMPtr.h" +#include "nsIInterfaceRequestorUtils.h" +#include "nsWeakReference.h" + +class WebBrowserChromeUI +{ +public: + static HWND CreateNativeWindow(nsIWebBrowserChrome* chrome); + static void Destroy(nsIWebBrowserChrome* chrome); + static void Destroyed(nsIWebBrowserChrome* chrome); + static void SetFocus(nsIWebBrowserChrome *chrome); + static void UpdateStatusBarText(nsIWebBrowserChrome *aChrome, const PRUnichar* aStatusText); + static void UpdateCurrentURI(nsIWebBrowserChrome *aChrome); + static void UpdateBusyState(nsIWebBrowserChrome *aChrome, PRBool aBusy); + static void UpdateProgress(nsIWebBrowserChrome *aChrome, PRInt32 aCurrent, PRInt32 aMax); + static void GetResourceStringById(PRInt32 aID, char ** aReturn); + static void ShowContextMenu(nsIWebBrowserChrome *aChrome, PRUint32 aContextFlags, nsIDOMEvent *aEvent, nsIDOMNode *aNode); + static void ShowTooltip(nsIWebBrowserChrome *aChrome, PRInt32 aXCoords, PRInt32 aYCoords, const PRUnichar *aTipText); + static void HideTooltip(nsIWebBrowserChrome *aChrome); + static void ShowWindow(nsIWebBrowserChrome *aChrome, PRBool aShow); + static void SizeTo(nsIWebBrowserChrome *aChrome, PRInt32 aWidth, PRInt32 aHeight); +}; + +class WebBrowserChrome : public nsIWebBrowserChrome, + public nsIWebBrowserChromeFocus, + public nsIWebProgressListener, + public nsIEmbeddingSiteWindow, + public nsIInterfaceRequestor, + public nsISHistoryListener, + public nsIObserver, + public nsIContextMenuListener, + public nsITooltipListener, + public nsSupportsWeakReference + +{ +public: + WebBrowserChrome(); + virtual ~WebBrowserChrome(); + + NS_DECL_ISUPPORTS + NS_DECL_NSIWEBBROWSERCHROME + NS_DECL_NSIWEBBROWSERCHROMEFOCUS + NS_DECL_NSIWEBPROGRESSLISTENER + NS_DECL_NSIEMBEDDINGSITEWINDOW + NS_DECL_NSIINTERFACEREQUESTOR + NS_DECL_NSISHISTORYLISTENER + NS_DECL_NSIOBSERVER + NS_DECL_NSICONTEXTMENULISTENER + NS_DECL_NSITOOLTIPLISTENER + + nsresult CreateBrowser(PRInt32 aX, PRInt32 aY, PRInt32 aCX, PRInt32 aCY, + nsIWebBrowser **aBrowser); + + void SetParent(nsIWebBrowserChrome *aParent) + { mDependentParent = aParent; } + +protected: + nsresult SendHistoryStatusMessage(nsIURI * aURI, char * operation, PRInt32 info1=0, PRUint32 info2=0); + + void ContentFinishedLoading(); + + HWND mNativeWindow; + PRUint32 mChromeFlags; + PRBool mContinueModalLoop; + PRBool mSizeSet; + + nsCOMPtr mWebBrowser; + nsCOMPtr mDependentParent; // opener (for dependent windows only) +}; + +#endif /* __WebBrowserChrome__ */ diff --git a/k-meleon/winEmbed/WindowCreator.cpp b/k-meleon/winEmbed/WindowCreator.cpp new file mode 100644 index 00000000..62e73566 --- /dev/null +++ b/k-meleon/winEmbed/WindowCreator.cpp @@ -0,0 +1,53 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: Mozilla-sample-code 1.0 + * + * Copyright (c) 2002 Netscape Communications Corporation and + * other contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this Mozilla sample software and associated documentation files + * (the "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to permit + * persons to whom the Software is furnished to do so, subject to the + * following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Contributor(s): + * + * ***** END LICENSE BLOCK ***** */ + +#include "winEmbed.h" +#include "nsIWebBrowserChrome.h" +#include "WindowCreator.h" + +WindowCreator::WindowCreator() +{ +} + +WindowCreator::~WindowCreator() +{ +} + +NS_IMPL_ISUPPORTS(WindowCreator, nsIWindowCreator) + +NS_IMETHODIMP +WindowCreator::CreateChromeWindow(nsIWebBrowserChrome *parent, + PRUint32 chromeFlags, + nsIWebBrowserChrome **_retval) +{ + NS_ENSURE_ARG_POINTER(_retval); + AppCallbacks::CreateBrowserWindow(PRInt32(chromeFlags), parent, _retval); + return *_retval ? NS_OK : NS_ERROR_FAILURE; +} diff --git a/k-meleon/winEmbed/WindowCreator.h b/k-meleon/winEmbed/WindowCreator.h new file mode 100644 index 00000000..d2c78e0c --- /dev/null +++ b/k-meleon/winEmbed/WindowCreator.h @@ -0,0 +1,48 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: Mozilla-sample-code 1.0 + * + * Copyright (c) 2002 Netscape Communications Corporation and + * other contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this Mozilla sample software and associated documentation files + * (the "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to permit + * persons to whom the Software is furnished to do so, subject to the + * following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Contributor(s): + * + * ***** END LICENSE BLOCK ***** */ + +#ifndef __WindowCreator_h_ +#define __WindowCreator_h_ + +#include "nsIWindowCreator.h" + +class WindowCreator : + public nsIWindowCreator +{ +public: + WindowCreator(); + virtual ~WindowCreator(); + + NS_DECL_ISUPPORTS + NS_DECL_NSIWINDOWCREATOR +}; + +#endif + diff --git a/k-meleon/winEmbed/resource.h b/k-meleon/winEmbed/resource.h new file mode 100644 index 00000000..326ddcf2 --- /dev/null +++ b/k-meleon/winEmbed/resource.h @@ -0,0 +1,69 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by winEmbed.rc +// +#define IDC_MYICON 2 +#define IDD_WINEMBED_DIALOG 102 +#define IDD_ABOUTBOX 103 +#define IDS_APP_TITLE 103 +#define IDM_ABOUT 104 +#define MOZ_OpenURI 104 +#define MOZ_GetURI 104 +#define IDM_EXIT 105 +#define IDS_HELLO 106 +#define IDI_WINEMBED 107 +#define IDS_ABOUT 107 +#define IDI_SMALL 108 +#define IDS_ABOUT_TITLE 108 +#define IDC_WINEMBED 109 +#define IDS_HIST_BACK 109 +#define IDS_HIST_FORWARD 110 +#define IDS_HIST_RELOAD_NORMAL 111 +#define IDS_HIST_RELOAD_BYPASSPROXY 112 +#define IDS_HIST_RELOAD_BYPASSCACHE 113 +#define IDS_HIST_ADDURL 114 +#define IDS_HIST_RELOAD_BYPASSPROXYANDCACHE 115 +#define IDS_HIST_PURGE 116 +#define IDS_HIST_GOTO 117 +#define IDS_HIST_URL 118 +#define IDR_MAINFRAME 128 +#define IDD_BROWSER 130 +#define IDD_BROWSER_NC 131 +#define IDD_CHOOSEPROFILE 132 +#define MOZ_EDIT_URI 1001 +#define IDC_GO 1003 +#define IDC_BROWSER 1004 +#define IDC_ADDRESS 1005 +#define IDC_STOP 1006 +#define IDC_STATUS 1007 +#define IDC_BACK 1008 +#define IDC_FORWARD 1009 +#define IDC_PROGRESS 1010 +#define IDC_RELOAD 1011 +#define IDC_PROFILELIST 1011 +#define MOZ_Open 32771 +#define MOZ_NewBrowser 32773 +#define MOZ_NewEditor 32774 +#define MOZ_Cut 32776 +#define MOZ_Copy 32777 +#define MOZ_Paste 32778 +#define MOZ_Delete 32779 +#define MOZ_SelectAll 32780 +#define MOZ_SelectNone 32781 +#define MOZ_GoBack 32782 +#define MOZ_GoForward 32783 +#define MOZ_About 32784 +#define ID_DEBUG_THISSPACEFORRENT 32786 +#define MOZ_SwitchProfile 32787 +#define IDC_STATIC -1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 133 +#define _APS_NEXT_COMMAND_VALUE 32788 +#define _APS_NEXT_CONTROL_VALUE 1012 +#define _APS_NEXT_SYMED_VALUE 110 +#endif +#endif diff --git a/k-meleon/winEmbed/winEmbed.ICO b/k-meleon/winEmbed/winEmbed.ICO new file mode 100644 index 00000000..b276a959 Binary files /dev/null and b/k-meleon/winEmbed/winEmbed.ICO differ diff --git a/k-meleon/winEmbed/winEmbed.cpp b/k-meleon/winEmbed/winEmbed.cpp new file mode 100644 index 00000000..40242e69 --- /dev/null +++ b/k-meleon/winEmbed/winEmbed.cpp @@ -0,0 +1,1180 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: Mozilla-sample-code 1.0 + * + * Copyright (c) 2002 Netscape Communications Corporation and + * other contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this Mozilla sample software and associated documentation files + * (the "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to permit + * persons to whom the Software is furnished to do so, subject to the + * following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Contributor(s): + * Doug Turner + * Adam Lock + * + * ***** END LICENSE BLOCK ***** */ + +#pragma comment(lib, "mozjs.lib") +#pragma comment(lib, "xpcomglue.lib") +#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup") + +// C RunTime Header Files +#include +#include +#include +#include +#include + +// Win32 header files +#include +#include +#include + +#include "winEmbed.h" + +// Mozilla Frozen APIs + +XRE_InitEmbedding2Type XRE_InitEmbedding2 = 0; +XRE_TermEmbeddingType XRE_TermEmbedding = 0; + +#include "nsAppDirectoryServiceDefs.h" +#include "nsDirectoryServiceDefs.h" +#include "nsProfileDirServiceProvider.h" +#include "nsStringAPI.h" +#include "nsXPCOMGlue.h" + +#include "nsIClipboardCommands.h" +#include "nsIInterfaceRequestor.h" +#include "nsIObserverService.h" +#include "nsIObserver.h" +#include "nsIURI.h" +#include "nsIWebBrowserFocus.h" +#include "nsIWindowWatcher.h" + +// NON-FROZEN APIs! +#include "nsIBaseWindow.h" +#include "nsIWebNavigation.h" + +// Local header files +#include "WebBrowserChrome.h" +#include "WindowCreator.h" +#include "resource.h" + +#define MAX_LOADSTRING 100 + +const TCHAR *szWindowClass = _T("WINEMBED"); + +// Foward declarations of functions included in this code module: +static ATOM MyRegisterClass(HINSTANCE hInstance); +static LRESULT CALLBACK BrowserWndProc(HWND, UINT, WPARAM, LPARAM); +static INT_PTR CALLBACK BrowserDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); + +static nsresult InitializeWindowCreator(); +static nsresult OpenWebPage(const char * url); +static nsresult ResizeEmbedding(nsIWebBrowserChrome* chrome); + +// Profile chooser stuff +static nsresult StartupProfile(); + +// Global variables +static UINT gDialogCount = 0; +static HINSTANCE ghInstanceApp = NULL; +static char gFirstURL[1024]; + +// like strpbrk but finds the *last* char, not the first +static char* +ns_strrpbrk(char *string, const char *strCharSet) +{ + char *found = NULL; + for (; *string; ++string) { + for (const char *search = strCharSet; *search; ++search) { + if (*search == *string) { + found = string; + // Since we're looking for the last char, we save "found" + // until we're at the end of the string. + } + } + } + + return found; +} + +// A list of URLs to populate the URL drop down list with +static const TCHAR *gDefaultURLs[] = +{ + _T("http://www.mozilla.org/"), + _T("http://www.netscape.com/"), + _T("http://browsertest.web.aol.com/tests/javascript/javascpt/index.htm"), + _T("http://127.0.0.1/"), + _T("http://www.yahoo.com/"), + _T("http://www.travelocity.com/"), + _T("http://www.disney.com/"), + _T("http://www.go.com/"), + _T("http://www.google.com/"), + _T("http://www.ebay.com/"), + _T("http://www.shockwave.com/"), + _T("http://www.slashdot.org/"), + _T("http://www.quicken.com/"), + _T("http://www.hotmail.com/"), + _T("http://www.cnn.com/"), + _T("http://www.javasoft.com/") +}; + +int main(int argc, char *argv[]) +{ + nsresult rv; + /* + printf("You are embedded, man!\n\n"); + printf("******************************************************************\n"); + printf("* *\n"); + printf("* IMPORTANT NOTE: *\n"); + printf("* *\n"); + printf("* WinEmbed is not supported!!! Do not raise bugs on it unless *\n"); + printf("* it is badly broken (e.g. crash on start/exit, build errors) *\n"); + printf("* or you have the patch to make it better! MFCEmbed is now our *\n"); + printf("* embedding test application on Win32 and all testing should *\n"); + printf("* be done on that. *\n"); + printf("* *\n"); + printf("******************************************************************\n"); + printf("\n\n"); + */ + // Sophisticated command-line parsing in action + char *szFirstURL = "http://www.mozilla.org/projects/embedding/"; + int argn; + for (argn = 1; argn < argc; argn++) + { + szFirstURL = argv[argn]; + } + strncpy(gFirstURL, szFirstURL, sizeof(gFirstURL) - 1); + + ghInstanceApp = GetModuleHandle(NULL); + + // Initialize global strings + TCHAR szTitle[MAX_LOADSTRING]; + LoadString(ghInstanceApp, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); + MyRegisterClass(ghInstanceApp); + + // Find the GRE (libxul). We are only using frozen interfaces, so we + // should be compatible all the way up to (but not including) mozilla 2.0 + /*static const GREVersionRange vr = { + "1.8a1", + PR_TRUE, + "2.0", + PR_FALSE + };*/ + + char xpcomPath[_MAX_PATH]; + /*rv = GRE_GetGREPathWithProperties(&vr, 1, nullptr, 0, + xpcomPath, sizeof(xpcomPath));*/ + HMODULE hModule = nullptr; + hModule = ::GetModuleHandle(NULL); + if (!(hModule)) + return 1; + ::GetModuleFileNameA(hModule, xpcomPath, _MAX_PATH); + + char *lastslash = ns_strrpbrk(xpcomPath, "/\\"); + if (!lastslash) + return 2; + + rv = XPCOMGlueStartup(xpcomPath); + if (NS_FAILED(rv)) + return 3; + + *lastslash = '\0'; + + char xulPath[_MAX_PATH]; + _snprintf(xulPath, sizeof(xulPath), "%s\\xul.dll", xpcomPath); + xulPath[sizeof(xulPath) - 1] = '\0'; + + HINSTANCE xulModule = LoadLibraryExA(xulPath, NULL, 0); + if (!xulModule) + return 4; + + char temp[_MAX_PATH]; + GetModuleFileNameA(xulModule, temp, sizeof(temp)); + + /*XRE_InitEmbedding = + (XRE_InitEmbeddingType) GetProcAddress(xulModule, "XRE_InitEmbedding"); + if (!XRE_InitEmbedding) { + fprintf(stderr, "Error: %i\n", GetLastError()); + return 5; + } + + XRE_TermEmbedding = + (XRE_TermEmbeddingType) GetProcAddress(xulModule, "XRE_TermEmbedding"); + if (!XRE_TermEmbedding) { + fprintf(stderr, "Error: %i\n", GetLastError()); + return 5; + }*/ + nsDynamicFunctionLoad nsFuncs[] = { + { "XRE_InitEmbedding2", (NSFuncPtr*)&XRE_InitEmbedding2 }, + { "XRE_TermEmbedding", (NSFuncPtr*)&XRE_TermEmbedding }, + { 0, 0 } + }; + + rv = XPCOMGlueLoadXULFunctions(nsFuncs); + + // Scope all the XPCOM stuff + { + nsCOMPtr xuldir; + rv = NS_NewNativeLocalFile(nsCString(xpcomPath), PR_FALSE, + getter_AddRefs(xuldir)); + if (NS_FAILED(rv)) + return 6; + + char self[_MAX_PATH]; + GetModuleFileNameA(ghInstanceApp, self, sizeof(self)); + lastslash = ns_strrpbrk(xpcomPath, "/\\"); + if (!lastslash) + return 7; + + *lastslash = '\0'; + + nsCOMPtr appdir; + rv = NS_NewNativeLocalFile(nsCString(self), PR_FALSE, + getter_AddRefs(appdir)); + if (NS_FAILED(rv)) + return 8; + + rv = XRE_InitEmbedding2(xuldir, appdir, 0); + if (NS_FAILED(rv)) + return 9; + + int result = 0; + if (NS_FAILED(StartupProfile())) { + result = 8; + } + else { + InitializeWindowCreator(); + + // Open the initial browser window + OpenWebPage(gFirstURL); + + // Main message loop. + // NOTE: We use a fake event and a timeout in order to process idle stuff for + // Mozilla every 1/10th of a second. + PRBool runCondition = PR_TRUE; + + rv = (nsresult)AppCallbacks::RunEventLoop(runCondition); + } + } + XRE_TermEmbedding(); + + return (int)rv; +} + +/* InitializeWindowCreator creates and hands off an object with a callback + to a window creation function. This is how all new windows are opened, + except any created directly by the embedding app. */ +nsresult +InitializeWindowCreator() +{ + // create an nsWindowCreator and give it to the WindowWatcher service + nsCOMPtr creator(new WindowCreator()); + if (!creator) + return NS_ERROR_OUT_OF_MEMORY; + + nsCOMPtr wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID)); + if (!wwatch) + return NS_ERROR_UNEXPECTED; + + return wwatch->SetWindowCreator(creator); +} + +//----------------------------------------------------------------------------- + +// +// FUNCTION: OpenWebPage() +// +// PURPOSE: Opens a new browser dialog and starts it loading to the +// specified url. +// +nsresult OpenWebPage(const char *url) +{ + nsresult rv; + + // Create the chrome object. Note that it leaves this function + // with an extra reference so that it can released correctly during + // destruction (via Win32UI::Destroy) + + nsCOMPtr chrome; + rv = AppCallbacks::CreateBrowserWindow(nsIWebBrowserChrome::CHROME_ALL, + nullptr, getter_AddRefs(chrome)); + if (NS_SUCCEEDED(rv)) + { + // Start loading a page + nsCOMPtr newBrowser; + chrome->GetWebBrowser(getter_AddRefs(newBrowser)); + nsCOMPtr webNav(do_QueryInterface(newBrowser)); + + return webNav->LoadURI(NS_ConvertASCIItoUTF16(url).get(), + nsIWebNavigation::LOAD_FLAGS_NONE, + nullptr, + nullptr, + nullptr); + } + + return rv; +} + +// +// FUNCTION: GetBrowserFromChrome() +// +// PURPOSE: Returns the HWND for the webbrowser container associated +// with the specified chrome. +// +HWND GetBrowserFromChrome(nsIWebBrowserChrome *aChrome) +{ + if (!aChrome) + { + return NULL; + } + nsCOMPtr baseWindow = do_QueryInterface(aChrome); + HWND hwnd = NULL; + baseWindow->GetSiteWindow((void **) & hwnd); + return hwnd; +} + + +// +// FUNCTION: GetBrowserDlgFromChrome() +// +// PURPOSE: Returns the HWND for the browser dialog associated with +// the specified chrome. +// +HWND GetBrowserDlgFromChrome(nsIWebBrowserChrome *aChrome) +{ + return GetParent(GetBrowserFromChrome(aChrome)); +} + + +// +// FUNCTION: ResizeEmbedding() +// +// PURPOSE: Resizes the webbrowser window to fit its container. +// +nsresult ResizeEmbedding(nsIWebBrowserChrome* chrome) +{ + if (!chrome) { +// MessageBoxA(NULL, "no chrome", "WinEmbed", 0); + return NS_ERROR_FAILURE; + } + nsCOMPtr embeddingSite = do_QueryInterface(chrome); + HWND hWnd; + embeddingSite->GetSiteWindow((void **)& hWnd); + + if (!hWnd) { + MessageBoxA(NULL, "no hWnd", "WinEmbed", 0); + return NS_ERROR_NULL_POINTER; + } + RECT rect; + GetClientRect(hWnd, &rect); + + // Make sure the browser is visible and sized + nsCOMPtr webBrowser; + chrome->GetWebBrowser(getter_AddRefs(webBrowser)); + nsCOMPtr webBrowserAsWin = do_QueryInterface(webBrowser); + if (webBrowserAsWin) + { + webBrowserAsWin->SetPositionAndSize(rect.left, + rect.top, + rect.right - rect.left, + rect.bottom - rect.top, + PR_TRUE); + webBrowserAsWin->SetVisibility(PR_TRUE); + } + + return NS_OK; +} + + +// +// FUNCTION: MyRegisterClass() +// +// PURPOSE: Registers the window class. +// +// COMMENTS: +// +// This function and its usage is only necessary if you want this code +// to be compatible with Win32 systems prior to the 'RegisterClassEx' +// function that was added to Windows 95. It is important to call this function +// so that the application will get 'well formed' small icons associated +// with it. +// +ATOM MyRegisterClass(HINSTANCE hInstance) +{ + WNDCLASSEX wcex; + + memset(&wcex, 0, sizeof(wcex)); + wcex.cbSize = sizeof(WNDCLASSEX); + + wcex.style = CS_HREDRAW | CS_VREDRAW; + wcex.lpfnWndProc = (WNDPROC) BrowserWndProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = 0; + wcex.hInstance = hInstance; + wcex.hIcon = LoadIcon(ghInstanceApp, (LPCTSTR)IDI_WINEMBED); + wcex.hCursor = LoadCursor(NULL, IDC_ARROW); + wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); + wcex.lpszClassName = szWindowClass; + wcex.hIconSm = LoadIcon(ghInstanceApp, (LPCTSTR)IDI_SMALL); + + return RegisterClassEx(&wcex); +} + + +// +// FUNCTION: UpdateUI() +// +// PURPOSE: Refreshes the buttons and menu items in the browser dialog +// +void UpdateUI(nsIWebBrowserChrome *aChrome) +{ + HWND hwndDlg = GetBrowserDlgFromChrome(aChrome); + nsCOMPtr webBrowser; + nsCOMPtr webNavigation; + aChrome->GetWebBrowser(getter_AddRefs(webBrowser)); + webNavigation = do_QueryInterface(webBrowser); + + bool canGoBack = PR_FALSE; + bool canGoForward = PR_FALSE; + if (webNavigation) + { + webNavigation->GetCanGoBack(&canGoBack); + webNavigation->GetCanGoForward(&canGoForward); + } + + bool canCutSelection = PR_FALSE; + bool canCopySelection = PR_FALSE; + bool canPaste = PR_FALSE; + + nsCOMPtr clipCmds = do_GetInterface(webBrowser); + if (clipCmds) + { + clipCmds->CanCutSelection(&canCutSelection); + clipCmds->CanCopySelection(&canCopySelection); + clipCmds->CanPaste(&canPaste); + } + + HMENU hmenu = GetMenu(hwndDlg); + if (hmenu) + { + EnableMenuItem(hmenu, MOZ_GoBack, MF_BYCOMMAND | + ((canGoBack) ? MF_ENABLED : (MF_DISABLED | MF_GRAYED))); + EnableMenuItem(hmenu, MOZ_GoForward, MF_BYCOMMAND | + ((canGoForward) ? MF_ENABLED : (MF_DISABLED | MF_GRAYED))); + + EnableMenuItem(hmenu, MOZ_Cut, MF_BYCOMMAND | + ((canCutSelection) ? MF_ENABLED : (MF_DISABLED | MF_GRAYED))); + EnableMenuItem(hmenu, MOZ_Copy, MF_BYCOMMAND | + ((canCopySelection) ? MF_ENABLED : (MF_DISABLED | MF_GRAYED))); + EnableMenuItem(hmenu, MOZ_Paste, MF_BYCOMMAND | + ((canPaste) ? MF_ENABLED : (MF_DISABLED | MF_GRAYED))); + } + + HWND button; + button = GetDlgItem(hwndDlg, IDC_BACK); + if (button) + EnableWindow(button, canGoBack); + button = GetDlgItem(hwndDlg, IDC_FORWARD); + if (button) + EnableWindow(button, canGoForward); +} + + +// +// FUNCTION: BrowserDlgProc() +// +// PURPOSE: Browser dialog windows message handler. +// +// COMMENTS: +// +// The code for handling buttons and menu actions is here. +// +INT_PTR CALLBACK BrowserDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + // Get the browser and other pointers since they are used a lot below + HWND hwndBrowser = GetDlgItem(hwndDlg, IDC_BROWSER); + nsIWebBrowserChrome *chrome = nullptr ; + if (hwndBrowser) + { + chrome = (nsIWebBrowserChrome *) GetWindowLongPtr(hwndBrowser, GWLP_USERDATA); + } + nsCOMPtr webBrowser; + nsCOMPtr webNavigation; + if (chrome) + { + chrome->GetWebBrowser(getter_AddRefs(webBrowser)); + webNavigation = do_QueryInterface(webBrowser); + } + + // Test the message + switch (uMsg) + { + case WM_INITDIALOG: + return TRUE; + + case WM_INITMENU: + UpdateUI(chrome); + return TRUE; + + case WM_SYSCOMMAND: + if (wParam == SC_CLOSE) + { + WebBrowserChromeUI::Destroy(chrome); + return TRUE; + } + break; + + case WM_DESTROY: + return TRUE; + + case WM_COMMAND: + if (!webBrowser) + { + return TRUE; + } + + // Test which command was selected + switch (LOWORD(wParam)) + { + case IDC_ADDRESS: + if (HIWORD(wParam) == CBN_EDITCHANGE || HIWORD(wParam) == CBN_SELCHANGE) + { + // User has changed the address field so enable the Go button + EnableWindow(GetDlgItem(hwndDlg, IDC_GO), TRUE); + } + break; + + case IDC_GO: + { + wchar_t szURL[2048]; + memset(szURL, 0, sizeof(szURL)); + GetDlgItemText(hwndDlg, IDC_ADDRESS, szURL, + sizeof(szURL) / sizeof(szURL[0]) - 1); + webNavigation->LoadURI( +// NS_ConvertASCIItoUTF16(szURL).get(), + szURL, + nsIWebNavigation::LOAD_FLAGS_NONE, + nullptr, + nullptr, + nullptr); + } + break; + + case IDC_STOP: + webNavigation->Stop(nsIWebNavigation::STOP_ALL); + UpdateUI(chrome); + break; + + case IDC_RELOAD: + webNavigation->Reload(nsIWebNavigation::LOAD_FLAGS_NONE); + break; + + case IDM_EXIT: + PostMessage(hwndDlg, WM_SYSCOMMAND, SC_CLOSE, 0); + break; + + // File menu commands + + case MOZ_NewBrowser: + OpenWebPage(gFirstURL); + break; + + // Edit menu commands + + case MOZ_Cut: + { + nsCOMPtr clipCmds = do_GetInterface(webBrowser); + clipCmds->CutSelection(); + } + break; + + case MOZ_Copy: + { + nsCOMPtr clipCmds = do_GetInterface(webBrowser); + clipCmds->CopySelection(); + } + break; + + case MOZ_Paste: + { + nsCOMPtr clipCmds = do_GetInterface(webBrowser); + clipCmds->Paste(); + } + break; + + case MOZ_SelectAll: + { + nsCOMPtr clipCmds = do_GetInterface(webBrowser); + clipCmds->SelectAll(); + } + break; + + case MOZ_SelectNone: + { + nsCOMPtr clipCmds = do_GetInterface(webBrowser); + clipCmds->SelectNone(); + } + break; + + // Go menu commands + case IDC_BACK: + case MOZ_GoBack: + webNavigation->GoBack(); + UpdateUI(chrome); + break; + + case IDC_FORWARD: + case MOZ_GoForward: + webNavigation->GoForward(); + UpdateUI(chrome); + break; + + // Help menu commands + case MOZ_About: + { + TCHAR szAboutTitle[MAX_LOADSTRING]; + TCHAR szAbout[MAX_LOADSTRING]; + LoadString(ghInstanceApp, IDS_ABOUT_TITLE, szAboutTitle, MAX_LOADSTRING); + LoadString(ghInstanceApp, IDS_ABOUT, szAbout, MAX_LOADSTRING); + MessageBox(NULL, szAbout, szAboutTitle, MB_OK); + } + break; + } + + return TRUE; + + case WM_ACTIVATE: + { + nsCOMPtr focus(do_GetInterface(webBrowser)); + if(focus) + { + switch (wParam) + { + case WA_ACTIVE: + focus->Activate(); + break; + case WA_INACTIVE: + focus->Deactivate(); + break; + default: + break; + } + } + } + break; + + case WM_SIZE: + { + UINT newDlgWidth = LOWORD(lParam); + UINT newDlgHeight = HIWORD(lParam); + + // TODO Reposition the control bar - for the moment it's fixed size + + // Reposition the status area. Status bar + // gets any space that the fixed size progress bar doesn't use. + int progressWidth; + int statusWidth; + int statusHeight; + HWND hwndStatus = GetDlgItem(hwndDlg, IDC_STATUS); + if (hwndStatus) { + RECT rcStatus; + GetWindowRect(hwndStatus, &rcStatus); + statusHeight = rcStatus.bottom - rcStatus.top; + } else + statusHeight = 0; + + HWND hwndProgress = GetDlgItem(hwndDlg, IDC_PROGRESS); + if (hwndProgress) { + RECT rcProgress; + GetWindowRect(hwndProgress, &rcProgress); + progressWidth = rcProgress.right - rcProgress.left; + } else + progressWidth = 0; + statusWidth = newDlgWidth - progressWidth; + + if (hwndStatus) + SetWindowPos(hwndStatus, + HWND_TOP, + 0, newDlgHeight - statusHeight, + statusWidth, + statusHeight, + SWP_NOZORDER); + if (hwndProgress) + SetWindowPos(hwndProgress, + HWND_TOP, + statusWidth, newDlgHeight - statusHeight, + 0, 0, + SWP_NOSIZE | SWP_NOZORDER); + + // Resize the browser area (assuming the browse is + // sandwiched between the control bar and status area) + RECT rcBrowser; + POINT ptBrowser; + GetWindowRect(hwndBrowser, &rcBrowser); + ptBrowser.x = rcBrowser.left; + ptBrowser.y = rcBrowser.top; + ScreenToClient(hwndDlg, &ptBrowser); + int browserHeight = newDlgHeight - ptBrowser.y - statusHeight; + if (browserHeight < 1) + { + browserHeight = 1; + } + SetWindowPos(hwndBrowser, + HWND_TOP, + 0, 0, + newDlgWidth, + newDlgHeight - ptBrowser.y - statusHeight, + SWP_NOMOVE | SWP_NOZORDER); + } + return TRUE; + } + return FALSE; +} + + +// +// FUNCTION: BrowserWndProc(HWND, unsigned, WORD, LONG) +// +// PURPOSE: Processes messages for the browser container window. +// +LRESULT CALLBACK BrowserWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + nsIWebBrowserChrome *chrome = (nsIWebBrowserChrome *) GetWindowLongPtr(hWnd, GWLP_USERDATA); + switch (message) + { + case WM_SIZE: + // Resize the embedded browser + ResizeEmbedding(chrome); + return 0; + case WM_ERASEBKGND: + // Reduce flicker by not painting the non-visible background + return 1; + } + return DefWindowProc(hWnd, message, wParam, lParam); +} + +// +// FUNCTION: StartupProfile() +// +// PURPOSE: +// +nsresult StartupProfile() +{ + + nsCOMPtr appDataDir; + nsresult rv = NS_GetSpecialDirectory(NS_APP_APPLICATION_REGISTRY_DIR, getter_AddRefs(appDataDir)); + if (NS_FAILED(rv)) + return rv; + + appDataDir->AppendNative(nsCString("winembed")); + nsCOMPtr localAppDataDir(do_QueryInterface(appDataDir)); + + nsCOMPtr locProvider; + NS_NewProfileDirServiceProvider(PR_TRUE, getter_AddRefs(locProvider)); + if (!locProvider) + return NS_ERROR_FAILURE; + + rv = locProvider->Register(); + if (NS_FAILED(rv)) + return rv; + + return locProvider->SetProfileDir(localAppDataDir); + +} + + +/////////////////////////////////////////////////////////////////////////////// +// WebBrowserChromeUI + +// +// FUNCTION: CreateNativeWindow() +// +// PURPOSE: Creates a new browser dialog. +// +// COMMENTS: +// +// This function loads the browser dialog from a resource template +// and returns the HWND for the webbrowser container dialog item +// to the caller. +// +HWND WebBrowserChromeUI::CreateNativeWindow(nsIWebBrowserChrome* chrome) +{ + // Load the browser dialog from resource + HWND hwndDialog; + PRUint32 chromeFlags; + + chrome->GetChromeFlags(&chromeFlags); + if ((chromeFlags & nsIWebBrowserChrome::CHROME_ALL) == nsIWebBrowserChrome::CHROME_ALL) + hwndDialog = CreateDialog(ghInstanceApp, + MAKEINTRESOURCE(IDD_BROWSER), + NULL, + BrowserDlgProc); + else + hwndDialog = CreateDialog(ghInstanceApp, + MAKEINTRESOURCE(IDD_BROWSER_NC), + NULL, + BrowserDlgProc); + if (!hwndDialog) + return NULL; + + // Stick a menu onto it + if (chromeFlags & nsIWebBrowserChrome::CHROME_MENUBAR) { + HMENU hmenuDlg = LoadMenu(ghInstanceApp, MAKEINTRESOURCE(IDC_WINEMBED)); + SetMenu(hwndDialog, hmenuDlg); + } else + SetMenu(hwndDialog, 0); + + // Add some interesting URLs to the address drop down + HWND hwndAddress = GetDlgItem(hwndDialog, IDC_ADDRESS); + if (hwndAddress) { + for (int i = 0; i < sizeof(gDefaultURLs) / sizeof(gDefaultURLs[0]); i++) + { + SendMessage(hwndAddress, CB_ADDSTRING, 0, (LPARAM) gDefaultURLs[i]); + } + } + + // Fetch the browser window handle + HWND hwndBrowser = GetDlgItem(hwndDialog, IDC_BROWSER); + SetWindowLongPtr(hwndBrowser, GWLP_USERDATA, (LONG_PTR)chrome); // save the browser LONG_PTR. + SetWindowLongPtr(hwndBrowser, GWL_STYLE, GetWindowLongPtr(hwndBrowser, GWL_STYLE) | WS_CLIPCHILDREN); + + // Activate the window + PostMessage(hwndDialog, WM_ACTIVATE, WA_ACTIVE, 0); + + gDialogCount++; + + return hwndBrowser; +} + + +// +// FUNCTION: Destroy() +// +// PURPOSE: Destroy the window specified by the chrome +// +void WebBrowserChromeUI::Destroy(nsIWebBrowserChrome* chrome) +{ + nsCOMPtr webBrowser; + nsCOMPtr webNavigation; + + chrome->GetWebBrowser(getter_AddRefs(webBrowser)); + webNavigation = do_QueryInterface(webBrowser); + if (webNavigation) + webNavigation->Stop(nsIWebNavigation::STOP_ALL); + + chrome->ExitModalEventLoop(NS_OK); + + HWND hwndDlg = GetBrowserDlgFromChrome(chrome); + if (hwndDlg == NULL) + return; + + // Explicitly destroy the embedded browser and then the chrome + + // First the browser + nsCOMPtr browser = nullptr; + chrome->GetWebBrowser(getter_AddRefs(browser)); + nsCOMPtr browserAsWin = do_QueryInterface(browser); + if (browserAsWin) + browserAsWin->Destroy(); + + // Now the chrome + chrome->SetWebBrowser(nullptr); + NS_RELEASE(chrome); +} + + +// +// FUNCTION: Called as the final act of a chrome object during its destructor +// +void WebBrowserChromeUI::Destroyed(nsIWebBrowserChrome* chrome) +{ + HWND hwndDlg = GetBrowserDlgFromChrome(chrome); + if (hwndDlg == NULL) + { + return; + } + + // Clear the window user data + HWND hwndBrowser = GetDlgItem(hwndDlg, IDC_BROWSER); + SetWindowLong(hwndBrowser, GWL_USERDATA, 0); + DestroyWindow(hwndBrowser); + DestroyWindow(hwndDlg); + + --gDialogCount; + if (gDialogCount == 0) + { + // Quit when there are no more browser objects + PostQuitMessage(0); + } +} + + +// +// FUNCTION: Set the input focus onto the browser window +// +void WebBrowserChromeUI::SetFocus(nsIWebBrowserChrome *chrome) +{ + HWND hwndDlg = GetBrowserDlgFromChrome(chrome); + if (hwndDlg == NULL) + { + return; + } + + HWND hwndBrowser = GetDlgItem(hwndDlg, IDC_BROWSER); + ::SetFocus(hwndBrowser); +} + +// +// FUNCTION: UpdateStatusBarText() +// +// PURPOSE: Set the status bar text. +// +void WebBrowserChromeUI::UpdateStatusBarText(nsIWebBrowserChrome *aChrome, const PRUnichar* aStatusText) +{ + HWND hwndDlg = GetBrowserDlgFromChrome(aChrome); + nsCString status; + if (aStatusText) { + nsString wStatusText(aStatusText); + NS_UTF16ToCString(wStatusText, NS_CSTRING_ENCODING_NATIVE_FILESYSTEM, + status); + } + + SetDlgItemTextA(hwndDlg, IDC_STATUS, status.get()); +} + + +// +// FUNCTION: UpdateCurrentURI() +// +// PURPOSE: Updates the URL address field +// +void WebBrowserChromeUI::UpdateCurrentURI(nsIWebBrowserChrome *aChrome) +{ + nsCOMPtr webBrowser; + nsCOMPtr webNavigation; + aChrome->GetWebBrowser(getter_AddRefs(webBrowser)); + webNavigation = do_QueryInterface(webBrowser); + + nsCOMPtr currentURI; + webNavigation->GetCurrentURI(getter_AddRefs(currentURI)); + if (currentURI) + { + nsCString uriString; + currentURI->GetAsciiSpec(uriString); + HWND hwndDlg = GetBrowserDlgFromChrome(aChrome); + SetDlgItemTextA(hwndDlg, IDC_ADDRESS, uriString.get()); + } +} + + +// +// FUNCTION: UpdateBusyState() +// +// PURPOSE: Refreshes the stop/go buttons in the browser dialog +// +void WebBrowserChromeUI::UpdateBusyState(nsIWebBrowserChrome *aChrome, PRBool aBusy) +{ + HWND hwndDlg = GetBrowserDlgFromChrome(aChrome); + HWND button; + button = GetDlgItem(hwndDlg, IDC_STOP); + if (button) + EnableWindow(button, aBusy); + button = GetDlgItem(hwndDlg, IDC_GO); + if (button) + EnableWindow(button, !aBusy); + UpdateUI(aChrome); +} + + +// +// FUNCTION: UpdateProgress() +// +// PURPOSE: Refreshes the progress bar in the browser dialog +// +void WebBrowserChromeUI::UpdateProgress(nsIWebBrowserChrome *aChrome, PRInt32 aCurrent, PRInt32 aMax) +{ + HWND hwndDlg = GetBrowserDlgFromChrome(aChrome); + HWND hwndProgress = GetDlgItem(hwndDlg, IDC_PROGRESS); + if (aCurrent < 0) + { + aCurrent = 0; + } + if (aCurrent > aMax) + { + aMax = aCurrent + 20; // What to do? + } + if (hwndProgress) + { + SendMessage(hwndProgress, PBM_SETRANGE, 0, MAKELPARAM(0, aMax)); + SendMessage(hwndProgress, PBM_SETPOS, aCurrent, 0); + } +} + +// +// FUNCTION: ShowContextMenu() +// +// PURPOSE: Display a context menu for the given node +// +void WebBrowserChromeUI::ShowContextMenu(nsIWebBrowserChrome *aChrome, PRUint32 aContextFlags, nsIDOMEvent *aEvent, nsIDOMNode *aNode) +{ + // TODO code to test context flags and display a popup menu should go here +} + +// +// FUNCTION: ShowTooltip() +// +// PURPOSE: Show a tooltip +// +void WebBrowserChromeUI::ShowTooltip(nsIWebBrowserChrome *aChrome, PRInt32 aXCoords, PRInt32 aYCoords, const PRUnichar *aTipText) +{ + // TODO code to show a tooltip should go here +} + +// +// FUNCTION: HideTooltip() +// +// PURPOSE: Hide the tooltip +// +void WebBrowserChromeUI::HideTooltip(nsIWebBrowserChrome *aChrome) +{ + // TODO code to hide a tooltip should go here +} + +void WebBrowserChromeUI::ShowWindow(nsIWebBrowserChrome *aChrome, PRBool aShow) +{ + HWND win = GetBrowserDlgFromChrome(aChrome); + ::ShowWindow(win, aShow ? SW_RESTORE : SW_HIDE); +} + +void WebBrowserChromeUI::SizeTo(nsIWebBrowserChrome *aChrome, PRInt32 aWidth, PRInt32 aHeight) +{ + HWND hchrome = GetBrowserDlgFromChrome(aChrome); + HWND hbrowser = GetBrowserFromChrome(aChrome); + RECT chromeRect, browserRect; + + ::GetWindowRect(hchrome, &chromeRect); + ::GetWindowRect(hbrowser, &browserRect); + + PRInt32 decoration_x = (browserRect.left - chromeRect.left) + + (chromeRect.right - browserRect.right); + PRInt32 decoration_y = (browserRect.top - chromeRect.top) + + (chromeRect.bottom - browserRect.bottom); + + ::MoveWindow(hchrome, chromeRect.left, chromeRect.top, + aWidth+decoration_x, + aHeight+decoration_y, TRUE); +} + +// +// FUNCTION: GetResourceStringByID() +// +// PURPOSE: Get the resource string for the ID +// +void WebBrowserChromeUI::GetResourceStringById(PRInt32 aID, char ** aReturn) +{ + char resBuf[MAX_LOADSTRING]; + int retval = LoadString( ghInstanceApp, aID, (LPTSTR)resBuf, sizeof(resBuf) ); + if (retval != 0) + { + int resLen = strlen(resBuf); + *aReturn = (char *)calloc(resLen+1, sizeof(char *)); + if (!*aReturn) return; + strncpy(*aReturn, resBuf, resLen); + } + return; +} + +//----------------------------------------------------------------------------- +// AppCallbacks +//----------------------------------------------------------------------------- + +nsresult AppCallbacks::CreateBrowserWindow(PRUint32 aChromeFlags, + nsIWebBrowserChrome *aParent, + nsIWebBrowserChrome **aNewWindow) +{ + nsresult rv; + WebBrowserChrome * chrome = new WebBrowserChrome(); + if (!chrome) + return NS_ERROR_FAILURE; + + // the interface to return and one addref, which we assume will be + // immediately released +// CallQueryInterface(static_cast(chrome), aNewWindow); +// chrome->QueryInterface(NS_GET_IID(nsIWebBrowserChrome), (void**)aNewWindow); +// do_QueryInterface(static_cast(chrome), &rv); + chrome->QueryInterface(NS_GET_IID(nsIWebBrowserChrome), (void**)aNewWindow); + // now an extra addref; the window owns itself (to be released by + // WebBrowserChromeUI::Destroy) + NS_ADDREF(*aNewWindow); + + chrome->SetChromeFlags(aChromeFlags); + chrome->SetParent(aParent); + + // Insert the browser + nsCOMPtr newBrowser; + chrome->CreateBrowser(-1, -1, -1, -1, getter_AddRefs(newBrowser)); + if (!newBrowser) { + MessageBoxA(NULL, "no newBrowser", "WinEmbed", 0); + return NS_ERROR_FAILURE; + } + + // Place it where we want it. + ResizeEmbedding(static_cast(chrome)); + + // if opened as chrome, it'll be made visible after the chrome has loaded. + // otherwise, go ahead and show it now. + if (!(aChromeFlags & nsIWebBrowserChrome::CHROME_OPENAS_CHROME)) + WebBrowserChromeUI::ShowWindow(*aNewWindow, PR_TRUE); + + return NS_OK; +} + +void AppCallbacks::EnableChromeWindow(nsIWebBrowserChrome *aWindow, + PRBool aEnabled) +{ + HWND hwnd = GetBrowserDlgFromChrome(aWindow); + ::EnableWindow(hwnd, aEnabled ? TRUE : FALSE); +} + +PRUint32 AppCallbacks::RunEventLoop(PRBool &aRunCondition) +{ + MSG msg; + HANDLE hFakeEvent = ::CreateEventA(NULL, TRUE, FALSE, NULL); + + while (aRunCondition ) { + // Process pending messages + while (::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) { + if (!::GetMessageA(&msg, NULL, 0, 0)) { + // WM_QUIT + aRunCondition = PR_FALSE; + break; + } + + ::TranslateMessage(&msg); + ::DispatchMessage(&msg); + } + + // Do idle stuff + ::MsgWaitForMultipleObjects(1, &hFakeEvent, FALSE, 100, QS_ALLEVENTS); + } + ::CloseHandle(hFakeEvent); + return msg.wParam; +} diff --git a/k-meleon/winEmbed/winEmbed.h b/k-meleon/winEmbed/winEmbed.h new file mode 100644 index 00000000..386d1c6f --- /dev/null +++ b/k-meleon/winEmbed/winEmbed.h @@ -0,0 +1,89 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: Mozilla-sample-code 1.0 + * + * Copyright (c) 2002 Netscape Communications Corporation and + * other contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this Mozilla sample software and associated documentation files + * (the "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to permit + * persons to whom the Software is furnished to do so, subject to the + * following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Contributor(s): + * + * ***** END LICENSE BLOCK ***** */ + +#include "mozilla-config.h" +#define NS_ARRAY_LENGTH(array_) \ + (sizeof(array_)/sizeof(array_[0])) + + +#include +#define XPCOM_GLUE +#define INTERNAL_SIDEBAR +#define INTERNAL_SITEICONS + +#include "js-config.h" +#include "nsCOMPtr.h" + +#include "nsIURI.h" +#include "nsIFile.h" +#include "nsMemory.h" +#include "nsNetCID.h" +#include "nsEmbedCID.h" +#include "nsIObserver.h" +#include "nsEmbedString.h" +#include "nsWeakReference.h" +#include "nsIWindowCreator.h" +#include "nsIInterfaceRequestor.h" +#include "nsServiceManagerUtils.h" +#include "nsComponentManagerUtils.h" +#include "nsIInterfaceRequestorUtils.h" +#include "nsAppDirectoryServiceDefs.h" + +#if defined(THERECANBENODEBUG) +#define DEBUG +#endif + +#include "nsIDOMNode.h" +#include "nsIDOMWindow.h" +#include "nsIDOMElement.h" +#include "nsIDOMDocument.h" + +#include "nsIWebBrowser.h" +#include "nsIWebBrowserChrome.h" +#include "nsIWebProgressListener.h" + +#include "nsXPCOM.h" +#include "nsXPCOMGlue.h" +#include "nsXULAppAPI.h" + +#include "nsXPCOM.h" +#include "nsXPCOMGlue.h" + +class nsIWebBrowserChrome; + +namespace AppCallbacks { + nsresult CreateBrowserWindow(PRUint32 aChromeFlags, + nsIWebBrowserChrome *aParent, + nsIWebBrowserChrome **aNewWindow); + + void EnableChromeWindow(nsIWebBrowserChrome *aWindow, PRBool aEnabled); + + PRUint32 RunEventLoop(PRBool &aRunCondition); +} diff --git a/k-meleon/winEmbed/winEmbed.rc b/k-meleon/winEmbed/winEmbed.rc new file mode 100644 index 00000000..2a500e37 --- /dev/null +++ b/k-meleon/winEmbed/winEmbed.rc @@ -0,0 +1,265 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +#include "resource.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_WINEMBED ICON "winEmbed.ICO" +IDI_SMALL ICON "SMALL.ICO" + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDC_WINEMBED MENU +BEGIN + POPUP "&File" + BEGIN + MENUITEM "New Browser...", MOZ_NewBrowser + MENUITEM "E&xit", IDM_EXIT + END + POPUP "&Edit" + BEGIN + MENUITEM "Cu&t", MOZ_Cut + MENUITEM "&Copy", MOZ_Copy + MENUITEM "&Paste", MOZ_Paste + MENUITEM SEPARATOR + MENUITEM "Select All", MOZ_SelectAll + MENUITEM "Select None", MOZ_SelectNone + END + POPUP "&Go" + BEGIN + MENUITEM "&Back", MOZ_GoBack + MENUITEM "&Forward", MOZ_GoForward + END + POPUP "&Debug" + BEGIN + MENUITEM "&This space for rent", ID_DEBUG_THISSPACEFORRENT + , GRAYED + END + POPUP "&Help" + BEGIN + MENUITEM "&About winEmbed...", MOZ_About + END +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +2 TEXTINCLUDE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""resource.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDS_APP_TITLE "winEmbed" + IDS_HELLO "Embedding Mozilla is so much fun!!" + IDS_ABOUT "winEmbed - Gecko embedding sample" + IDS_ABOUT_TITLE "About winEmbed" + IDS_HIST_BACK "Going Back to: " + IDS_HIST_FORWARD "Going Forward to: " + IDS_HIST_RELOAD_NORMAL "Reloading url, (normal) :" +END + +STRINGTABLE +BEGIN + IDS_HIST_RELOAD_BYPASSPROXY "Reloading url, (bypassing Proxy) :" + IDS_HIST_RELOAD_BYPASSCACHE "Reloading url, (bypassing cache) :" + IDS_HIST_ADDURL " added to Session History" + IDS_HIST_RELOAD_BYPASSPROXYANDCACHE + "Reloading url, (bypassing Proxy and cache) :" + IDS_HIST_PURGE "purged from session history" + IDS_HIST_GOTO "Going to history index : " + IDS_HIST_URL " URL : " +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// English (U.K.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_BROWSER DIALOG 0, 0, 400, 217 +STYLE DS_SETFONT | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | + WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME +CAPTION "winEmbed sample - UNSUPPORTED" +MENU IDC_WINEMBED +FONT 8, "MS Sans Serif" +BEGIN + PUSHBUTTON "Back",IDC_BACK,1,1,21,13 + PUSHBUTTON "Forward",IDC_FORWARD,23,1,30,13 + PUSHBUTTON "Reload",IDC_RELOAD,57,1,28,13 + PUSHBUTTON "Stop",IDC_STOP,86,1,25,13 + LTEXT "Address:",IDC_STATIC,115,3,28,8 + COMBOBOX IDC_ADDRESS,145,1,193,52,CBS_DROPDOWN | CBS_AUTOHSCROLL | + WS_VSCROLL | WS_TABSTOP + DEFPUSHBUTTON "Go",IDC_GO,340,1,25,13 + CONTROL "Embedded Browser",IDC_BROWSER,"WINEMBED",WS_TABSTOP,0, + 16,400,192 + CONTROL "Status",IDC_STATUS,"Static",SS_LEFTNOWORDWRAP | + SS_SUNKEN | WS_GROUP,0,208,316,9 + CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER, + 316,208,84,9 +END + +IDD_BROWSER_NC DIALOG 0, 0, 400, 217 +STYLE DS_SETFONT | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | + WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME +CAPTION "winEmbed chromeless sample" +MENU IDC_WINEMBED +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "Embedded Browser",IDC_BROWSER,"WINEMBED",WS_TABSTOP,0,0, + 400,217 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_BROWSER, DIALOG + BEGIN + RIGHTMARGIN, 292 + BOTTOMMARGIN, 216 + END +END +#endif // APSTUDIO_INVOKED + +#endif // English (U.K.) resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// English (Ireland) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENI) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_EIRE +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_CHOOSEPROFILE DIALOG 0, 0, 186, 154 +STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | + WS_SYSMENU +CAPTION "Choose Profile" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "Available Profiles:",IDC_STATIC,7,7,56,8 + LISTBOX IDC_PROFILELIST,7,18,117,129,LBS_NOINTEGRALHEIGHT | + WS_VSCROLL | WS_TABSTOP + DEFPUSHBUTTON "Select",IDOK,129,18,50,14 + PUSHBUTTON "Cancel",IDCANCEL,129,36,50,14 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_CHOOSEPROFILE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 179 + TOPMARGIN, 7 + BOTTOMMARGIN, 147 + END +END +#endif // APSTUDIO_INVOKED + +#endif // English (Ireland) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/k-meleon/winEmbed/winEmbed.vcxproj b/k-meleon/winEmbed/winEmbed.vcxproj new file mode 100644 index 00000000..8e67be52 --- /dev/null +++ b/k-meleon/winEmbed/winEmbed.vcxproj @@ -0,0 +1,189 @@ + + + + + Debug + Win32 + + + Release Static MFC + Win32 + + + Release + Win32 + + + + {C938963C-0912-4455-B008-9F385023ECDB} + Win32Proj + winEmbed + + + + Application + true + v120_xp + Unicode + Dynamic + + + Application + false + true + Unicode + false + v120_xp + + + Application + false + true + Unicode + Static + v120_xp + + + + + + + + + + + + + + + + true + $(SolutionDir)..\$(Configuration)\ + $(SolutionDir)..\_$(Configuration)\kmeleon\app\ + + + false + $(SolutionDir)..\$(Configuration)\ + $(SolutionDir)..\_$(Configuration)\kmeleon\app\ + + + false + $(SolutionDir)..\release\ + $(SolutionDir)..\_release\kmeleon\app\ + + + + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + Level3 + EditAndContinue + Disabled + ../shared;..\..\xulrunner-sdk\include\nspr;..\..\xulrunner-sdk\include;%(AdditionalIncludeDirectories) + Use + NoExtensions + + + MachineX86 + true + Windows + ..\..\xulrunner-sdk\lib_$(Configuration);%(AdditionalLibraryDirectories) + true + true + + + + + WIN32;NDEBUG;_WINDOWS;_NONAFX;%(PreprocessorDefinitions) + MultiThreadedDLL + Level3 + ProgramDatabase + ../shared;..\..\xulrunner-sdk\include\nspr;..\..\xulrunner-sdk\include;..\..\kmeleon-source\k-meleon\winEmbed;D:\Test\kmeleon-source\k-meleon\winEmbed;%(AdditionalIncludeDirectories) + MinSpace + true + true + true + true + NotUsing + NoExtensions + 4800;4819;4996 + false + + + + MachineX86 + true + Windows + true + true + 0x40000 + true + UseLinkTimeCodeGeneration + ..\..\xulrunner-sdk\lib;%(AdditionalLibraryDirectories) + + + + + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDLL + Level3 + ProgramDatabase + ../shared;..\..\xulrunner-sdk\include\nspr;..\..\xulrunner-sdk\include;%(AdditionalIncludeDirectories) + MinSpace + true + true + true + true + Use + NoExtensions + + + MachineX86 + true + Windows + true + true + 0x40000 + true + UseLinkTimeCodeGeneration + ..\..\xulrunner-sdk\lib_release + + + + + winEmbed;..\winEmbed;../shared;..\..\xulrunner-sdk\include\nspr;..\..\xulrunner-sdk\include;D:\Test\kmeleon-source\k-meleon\winEmbed + NotUsing + + + + + winEmbed;..\winEmbed;../shared;..\..\xulrunner-sdk\include\nspr;..\..\xulrunner-sdk\include;D:\Test\kmeleon-source\k-meleon\winEmbed + NotUsing + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/k-meleon/winEmbed/winembed.dsp b/k-meleon/winEmbed/winembed.dsp new file mode 100644 index 00000000..c65893a7 --- /dev/null +++ b/k-meleon/winEmbed/winembed.dsp @@ -0,0 +1,141 @@ +# Microsoft Developer Studio Project File - Name="winembed" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) External Target" 0x0106 + +CFG=winembed - 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 "winembed.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 "winembed.mak" CFG="winembed - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "winembed - Win32 Release" (based on "Win32 (x86) External Target") +!MESSAGE "winembed - Win32 Debug" (based on "Win32 (x86) External Target") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" + +!IF "$(CFG)" == "winembed - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Cmd_Line "NMAKE /f winembed.mak" +# PROP BASE Rebuild_Opt "/a" +# PROP BASE Target_File "winembed.exe" +# PROP BASE Bsc_Name "winembed.bsc" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Cmd_Line "nmake /f makefile.win" +# PROP Rebuild_Opt "/a" +# PROP Target_File "win32_o.obj\winembed.exe" +# PROP Bsc_Name "" +# PROP Target_Dir "" + +!ELSEIF "$(CFG)" == "winembed - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Cmd_Line "NMAKE /f winembed.mak" +# PROP BASE Rebuild_Opt "/a" +# PROP BASE Target_File "winembed.exe" +# PROP BASE Bsc_Name "winembed.bsc" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Cmd_Line "nmake /f makefile.win" +# PROP Rebuild_Opt "/a" +# PROP Target_File "win32_d.obj\winembed.exe" +# PROP Bsc_Name "" +# PROP Target_Dir "" + +!ENDIF + +# Begin Target + +# Name "winembed - Win32 Release" +# Name "winembed - Win32 Debug" + +!IF "$(CFG)" == "winembed - Win32 Release" + +!ELSEIF "$(CFG)" == "winembed - Win32 Debug" + +!ENDIF + +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\WebBrowserChrome.cpp +# End Source File +# Begin Source File + +SOURCE=.\WindowCreator.cpp +# End Source File +# Begin Source File + +SOURCE=.\winEmbed.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\resource.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# Begin Source File + +SOURCE=.\WebBrowserChrome.h +# End Source File +# Begin Source File + +SOURCE=.\WindowCreator.h +# End Source File +# Begin Source File + +SOURCE=.\winEmbed.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\SMALL.ICO +# End Source File +# Begin Source File + +SOURCE=.\winEmbed.ICO +# End Source File +# Begin Source File + +SOURCE=.\winEmbed.rc +# End Source File +# End Group +# End Target +# End Project