branching from embedding/tests/winembed. Minor changes to make it more WinCE-ish. Needs lots of love to make it lovable. NOT PART OF BUILD

This commit is contained in:
dougt%meer.net 2005-02-17 06:59:10 +00:00
parent 3dbecc5057
commit 6800f8743c
15 changed files with 2389 additions and 0 deletions

View File

@ -0,0 +1,112 @@
# ***** 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
PROGRAM = winEmbed$(BIN_SUFFIX)
RESFILE = winEmbed.res
MODULE = winEmbed
PACKAGE_FILE = winembed.pkg
REQUIRES = xpcom \
string \
embed_base \
webbrwsr \
webshell \
windowwatcher \
profile \
necko \
docshell \
dom \
widget \
uriloader \
shistory \
webbrowserpersist \
gfx \
profdirserviceprovider \
$(NULL)
CPPSRCS = \
winEmbed.cpp \
WebBrowserChrome.cpp \
WindowCreator.cpp \
$(NULL)
EXTRA_DSO_LIBS = embed_base_s profdirserviceprovider_s
LIBS = \
$(EXTRA_DSO_LIBS) \
$(MOZ_UNICHARUTIL_LIBS) \
$(XPCOM_LIBS) \
$(NSPR_LIBS) \
$(MOZ_JS_LIBS) \
$(NULL)
LOCAL_INCLUDES = -I$(srcdir)
include $(topsrcdir)/config/config.mk
OS_LIBS += $(call EXPAND_LIBNAME, aygshell)
# Force applications to be built non-statically
# when building the mozcomps meta component
ifneq (,$(filter mozcomps,$(MOZ_META_COMPONENTS)))
BUILD_STATIC_LIBS=
BUILD_SHARED_LIBS=1
endif
ifdef BUILD_STATIC_LIBS
FINAL_LINK_COMPS=$(topsrcdir)/embedding/minimo/wince/minimo-link-comps
FINAL_LINK_COMP_NAMES=$(topsrcdir)/embedding/minimo/wince/minimo-link-names
include $(topsrcdir)/config/static-config.mk
EXTRA_DEPS += $(STATIC_EXTRA_DEPS)
EXTRA_DSO_LIBS += $(STATIC_EXTRA_DSO_LIBS)
EXTRA_LIBS += $(EXTRA_DSO_LIBS) $(STATIC_EXTRA_LIBS)
DEFINES += $(STATIC_DEFINES)
CPPSRCS += $(STATIC_CPPSRCS)
endif # BUILD_STATIC_LIBS
include $(topsrcdir)/config/rules.mk
ifdef BUILD_STATIC_LIBS
include $(topsrcdir)/config/static-rules.mk
endif # BUILD_STATIC_LIBS

BIN
embedding/minimo/wince/SMALL.ICO Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

View File

@ -0,0 +1,563 @@
/* ***** 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 ***** */
// Mozilla Includes
#include "nsIGenericFactory.h"
#include "nsIComponentManager.h"
#include "nsString.h"
#include "nsXPIDLString.h"
#include "nsIURI.h"
#include "nsIWebProgress.h"
#include "nsIDocShellTreeItem.h"
#include "nsIDOMWindow.h"
#include "nsIInterfaceRequestor.h"
#include "nsIRequest.h"
#include "nsCWebBrowser.h"
#include "nsIProfileChangeStatus.h"
// Local includes
#include "resource.h"
#include "winEmbed.h"
#include "WebBrowserChrome.h"
WebBrowserChrome::WebBrowserChrome()
{
mNativeWindow = nsnull;
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 = nsnull;
mWebBrowser = do_CreateInstance(NS_WEBBROWSER_CONTRACTID);
if (!mWebBrowser)
return NS_ERROR_FAILURE;
(void)mWebBrowser->SetContainerWindow(NS_STATIC_CAST(nsIWebBrowserChrome*, this));
nsCOMPtr<nsIDocShellTreeItem> dsti = do_QueryInterface(mWebBrowser);
dsti->SetItemType(nsIDocShellTreeItem::typeContentWrapper);
nsCOMPtr<nsIBaseWindow> browserBaseWindow = do_QueryInterface(mWebBrowser);
mNativeWindow = WebBrowserChromeUI::CreateNativeWindow(NS_STATIC_CAST(nsIWebBrowserChrome*, this));
if (!mNativeWindow)
return NS_ERROR_FAILURE;
browserBaseWindow->InitWindow( mNativeWindow,
nsnull,
aX, aY, aCX, aCY);
browserBaseWindow->Create();
nsCOMPtr<nsIWebProgressListener> listener(NS_STATIC_CAST(nsIWebProgressListener*, this));
nsCOMPtr<nsIWeakReference> 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(PRBool *_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, nsnull);
ContentFinishedLoading();
}
return NS_OK;
}
NS_IMETHODIMP WebBrowserChrome::OnLocationChange(nsIWebProgress* aWebProgress,
nsIRequest* aRequest,
nsIURI *location)
{
PRBool isSubFrameLoad = PR_FALSE; // Is this a subframe load
if (aWebProgress) {
nsCOMPtr<nsIDOMWindow> domWindow;
nsCOMPtr<nsIDOMWindow> 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, PRBool * aContinue)
{
// For now, let the operation continue
*aContinue = PR_TRUE;
return SendHistoryStatusMessage(aBackURI, "back");
}
NS_IMETHODIMP
WebBrowserChrome::OnHistoryGoForward(nsIURI * aForwardURI, PRBool * aContinue)
{
// For now, let the operation continue
*aContinue = PR_TRUE;
return SendHistoryStatusMessage(aForwardURI, "forward");
}
NS_IMETHODIMP
WebBrowserChrome::OnHistoryGotoIndex(PRInt32 aIndex, nsIURI * aGotoURI, PRBool * aContinue)
{
// For now, let the operation continue
*aContinue = PR_TRUE;
return SendHistoryStatusMessage(aGotoURI, "goto", aIndex);
}
NS_IMETHODIMP
WebBrowserChrome::OnHistoryReload(nsIURI * aURI, PRUint32 aReloadFlags, PRBool * 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, PRBool *aContinue)
{
// For now let the operation continue
*aContinue = PR_FALSE;
return SendHistoryStatusMessage(nsnull, "purge", aNumEntries);
}
nsresult
WebBrowserChrome::SendHistoryStatusMessage(nsIURI * aURI, char * operation, PRInt32 info1, PRUint32 aReloadFlags)
{
nsCAutoString uriCStr;
if (aURI)
{
aURI->GetSpec(uriCStr);
}
nsString uriAStr;
if(!(strcmp(operation, "back")))
{
// Going back. XXX Get string from a resource file
uriAStr.AppendLiteral("Going back to url:");
AppendUTF8toUTF16(uriCStr, uriAStr);
}
else if (!(strcmp(operation, "forward")))
{
// Going forward. XXX Get string from a resource file
uriAStr.AppendLiteral("Going forward to url:");
AppendUTF8toUTF16(uriCStr, uriAStr);
}
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)
{
uriAStr.Append(NS_LITERAL_STRING("Reloading url,(bypassing proxy and cache) :"));
}
else if (aReloadFlags & nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY)
{
uriAStr.Append(NS_LITERAL_STRING("Reloading url, (bypassing proxy):"));
}
else if (aReloadFlags & nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE)
{
uriAStr.Append(NS_LITERAL_STRING("Reloading url, (bypassing cache):"));
}
else
{
uriAStr.Append(NS_LITERAL_STRING("Reloading url, (normal):"));
}
AppendUTF8toUTF16(uriCStr, uriAStr);
}
else if (!(strcmp(operation, "add")))
{
// Adding new entry. XXX Get string from a resource file
AppendUTF8toUTF16(uriCStr, uriAStr);
uriAStr.AppendLiteral(" added to session History");
}
else if (!(strcmp(operation, "goto")))
{
// Goto. XXX Get string from a resource file
uriAStr.AppendLiteral("Going to HistoryIndex:");
uriAStr.AppendInt(info1);
uriAStr.AppendLiteral(" Url:");
AppendUTF8toUTF16(uriCStr, uriAStr);
}
else if (!(strcmp(operation, "purge")))
{
// Purging old entries
uriAStr.AppendInt(info1);
uriAStr.AppendLiteral(" purged from Session History");
}
WebBrowserChromeUI::UpdateStatusBarText(this, uriAStr.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<nsIDOMWindow> 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 = nsnull;
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP WebBrowserChrome::SetTitle(const PRUnichar * aTitle)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* attribute boolean visibility; */
NS_IMETHODIMP WebBrowserChrome::GetVisibility(PRBool * aVisibility)
{
NS_ENSURE_ARG_POINTER(aVisibility);
*aVisibility = PR_TRUE;
return NS_OK;
}
NS_IMETHODIMP WebBrowserChrome::SetVisibility(PRBool 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;
}

View File

@ -0,0 +1,117 @@
/* ***** 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__
#include "nsCOMPtr.h"
#include "nsString.h"
#include "nsIWebBrowserChrome.h"
#include "nsIWebBrowserChromeFocus.h"
#include "nsIBaseWindow.h"
#include "nsIEmbeddingSiteWindow.h"
#include "nsIWebNavigation.h"
#include "nsIWebProgressListener.h"
#include "nsIInterfaceRequestor.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIWebBrowser.h"
#include "nsIObserver.h"
#include "nsWeakReference.h"
#include "nsISHistoryListener.h"
#include "nsIContextMenuListener.h"
#include "nsITooltipListener.h"
class WebBrowserChromeUI
{
public:
static nativeWindow 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();
nativeWindow mNativeWindow;
PRUint32 mChromeFlags;
PRBool mContinueModalLoop;
PRBool mSizeSet;
nsCOMPtr<nsIWebBrowser> mWebBrowser;
nsCOMPtr<nsIWebBrowserChrome> mDependentParent; // opener (for dependent windows only)
};
#endif /* __WebBrowserChrome__ */

View File

@ -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 "nsIWebBrowserChrome.h"
#include "WindowCreator.h"
#include "winEmbed.h"
WindowCreator::WindowCreator()
{
}
WindowCreator::~WindowCreator()
{
}
NS_IMPL_ISUPPORTS1(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;
}

View File

@ -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

View File

@ -0,0 +1,19 @@
xpconect
mozuconv
i18n
necko
jar50
pref
caps
gkparser
gkgfxwin
imglib2
gkwidget
gklayout
docshell
embedcmp
webbrwsr
editor
txmgr
appshell
chrmlite

View File

@ -0,0 +1,19 @@
xpconnect
nsUConvModule
nsI18nModule
necko_core_and_primary_protocols
nsJarModule
nsPrefModule
nsSecurityManagerModule
nsParserModule
nsGfxModule
nsImageLib2Module
nsWidgetModule
nsLayoutModule
docshell_provider
embedcomponents
Browser_Embedding_Module
nsEditorModule
nsTransactionManagerModule
appshell
chromelite

View File

@ -0,0 +1,85 @@
//{{NO_DEPENDENCIES}}
// Microsoft eMbedded Visual C++ 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 IDR_MENUBAR1 133
#define IDR_MENUBAR2 135
#define MOZ_EDIT_URI 1001
#define IDC_GO 1003
#define IDC_BROWSER 1004
#define IDC_ADDRESS 1005
#define IDC_BROWSER2 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_Print 32772
#define MOZ_NewBrowser 32773
#define MOZ_NewEditor 32774
#define MOZ_Save 32775
#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 ID_FILE 32788
#define IDS_CAP_FILE 32790
#define ID_FILE_OPEN 32791
#define ID_EDIT 32792
#define IDS_CAP_EDIT 32794
#define IDS_CAP_MENUITEM32796 32797
#define ID_TOOLS 32798
#define ID_HELP 32799
#define IDS_CAP_HELP 32801
#define ID_FILE_QUIT 32806
#define ID_ABOUT 32807
#define IDC_STATIC -1
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 136
#define _APS_NEXT_COMMAND_VALUE 32810
#define _APS_NEXT_CONTROL_VALUE 1013
#define _APS_NEXT_SYMED_VALUE 110
#endif
#endif

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,43 @@
/* -*- 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 "prtypes.h"
class nsIWebBrowserChrome;
namespace AppCallbacks {
nsresult CreateBrowserWindow(PRUint32 aChromeFlags,
nsIWebBrowserChrome *aParent,
nsIWebBrowserChrome **aNewWindow);
void EnableChromeWindow(nsIWebBrowserChrome *aWindow, PRBool aEnabled);
PRUint32 RunEventLoop(PRBool &aRunCondition);
}

View File

@ -0,0 +1,184 @@
//Microsoft eMbedded 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 DISCARDABLE "winEmbed.ICO"
IDI_SMALL ICON DISCARDABLE "SMALL.ICO"
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
2 TEXTINCLUDE MOVEABLE PURE
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 MOVEABLE PURE
BEGIN
"\r\n"
"\0"
END
1 TEXTINCLUDE MOVEABLE PURE
BEGIN
"resource.h\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
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 DISCARDABLE
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
STRINGTABLE DISCARDABLE
BEGIN
IDS_CAP_FILE "File"
IDS_CAP_EDIT "Edit"
IDS_CAP_MENUITEM32796 "Tools"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_CAP_HELP "Help"
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 DISCARDABLE 0, 0, 160, 167
STYLE DS_MODALFRAME | DS_CENTER | WS_VISIBLE | WS_CLIPCHILDREN | WS_CAPTION
MENU 109
FONT 8, "MS Sans Serif"
BEGIN
PUSHBUTTON "<",IDC_BACK,1,1,10,13
PUSHBUTTON ">",IDC_FORWARD,11,1,10,13
PUSHBUTTON "R",IDC_RELOAD,21,1,10,13
PUSHBUTTON "S",IDC_STOP,31,1,10,13
COMBOBOX IDC_ADDRESS,41,1,99,52,CBS_DROPDOWN | CBS_AUTOHSCROLL |
WS_VSCROLL | WS_TABSTOP
DEFPUSHBUTTON "Go",IDC_GO,139,1,17,13
CONTROL "Status",IDC_STATUS,"Static",SS_LEFTNOWORDWRAP |
WS_GROUP,0,158,117,9
CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER,
125,158,31,9
LTEXT "",IDC_BROWSER,4,17,151,136,NOT WS_GROUP
END
IDD_BROWSER_NC DIALOG DISCARDABLE 0, 0, 164, 153
STYLE WS_POPUP | WS_CLIPCHILDREN
MENU 109
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "",IDC_BROWSER,0,0,164,140,NOT WS_GROUP
LTEXT "",IDC_BROWSER2,0,0,161,151,NOT WS_GROUP
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO MOVEABLE PURE
BEGIN
IDD_BROWSER, DIALOG
BEGIN
RIGHTMARGIN, 156
TOPMARGIN, 1
BOTTOMMARGIN, 162
END
END
#endif // APSTUDIO_INVOKED
#endif // English (U.K.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -0,0 +1,2 @@
[winembed]
dist/bin/winEmbed.exe