Massive change to start minimo on CE using xul and other advanced features. NPODB

This commit is contained in:
dougt%meer.net 2005-06-17 18:42:08 +00:00
parent 7146d1bf04
commit 11c7d93b0d
14 changed files with 250 additions and 1746 deletions

View File

@ -36,12 +36,9 @@ include $(DEPTH)/config/autoconf.mk
MOZILLA_INTERNAL_API = 1
PROGRAM = winEmbed$(BIN_SUFFIX)
RESFILE = winEmbed.res
PROGRAM = minimo$(BIN_SUFFIX)
MODULE = winEmbed
PACKAGE_FILE = winembed.pkg
MODULE = minimo
REQUIRES = xpcom \
string \
@ -61,13 +58,14 @@ REQUIRES = xpcom \
layout \
content \
profdirserviceprovider \
embedcomponents \
appcomps \
$(NULL)
CPPSRCS = \
winEmbed.cpp \
WebBrowserChrome.cpp \
WindowCreator.cpp \
PromptService.cpp \
$(NULL)

View File

@ -42,13 +42,9 @@
#include "nsIDOMWindow.h"
#include "nsIComponentRegistrar.h"
#include "PromptService.h"
// Local header files
#include "winEmbed.h"
#include "WebBrowserChrome.h"
#include "WindowCreator.h"
#include "resource.h"
#include "PromptService.h"
#endif // MINIMO_PRIVATE_H

View File

@ -1,227 +0,0 @@
#include "MinimoPrivate.h"
class PromptService: public nsIPromptService
{
public:
PromptService();
virtual ~PromptService();
NS_DECL_ISUPPORTS
NS_DECL_NSIPROMPTSERVICE
private:
nsCOMPtr<nsIWindowWatcher> mWWatch;
HWND WndForDOMWindow(nsIDOMWindow *aWindow);
};
NS_IMPL_ISUPPORTS1(PromptService, nsIPromptService)
PromptService::PromptService()
{
mWWatch = do_GetService(NS_WINDOWWATCHER_CONTRACTID);
}
PromptService::~PromptService()
{
}
HWND
PromptService::WndForDOMWindow(nsIDOMWindow *aWindow)
{
nsCOMPtr<nsIWebBrowserChrome> chrome;
HWND val = NULL;
if (mWWatch) {
nsCOMPtr<nsIDOMWindow> fosterParent;
if (!aWindow) { // it will be a dependent window. try to find a foster parent.
mWWatch->GetActiveWindow(getter_AddRefs(fosterParent));
aWindow = fosterParent;
}
mWWatch->GetChromeForWindow(aWindow, getter_AddRefs(chrome));
}
if (chrome) {
nsCOMPtr<nsIEmbeddingSiteWindow> site(do_QueryInterface(chrome));
if (site) {
site->GetSiteWindow(reinterpret_cast<void **>(&val));
}
}
return val;
}
NS_IMETHODIMP
PromptService::Alert(nsIDOMWindow *parent, const PRUnichar *dialogTitle, const PRUnichar *text)
{
HWND wnd = WndForDOMWindow(parent);
MessageBoxW(wnd, text, dialogTitle, MB_OK | MB_ICONEXCLAMATION);
return NS_OK;
}
NS_IMETHODIMP
PromptService::AlertCheck(nsIDOMWindow *parent,
const PRUnichar *dialogTitle,
const PRUnichar *text,
const PRUnichar *checkboxMsg,
PRBool *checkValue)
{
Alert(parent, dialogTitle, text);
return NS_OK;
}
NS_IMETHODIMP
PromptService::Confirm(nsIDOMWindow *parent,
const PRUnichar *dialogTitle,
const PRUnichar *text,
PRBool *_retval)
{
HWND wnd = WndForDOMWindow(parent);
int choice = MessageBoxW(wnd, text, dialogTitle, MB_YESNO | MB_ICONEXCLAMATION);
*_retval = choice == IDYES ? PR_TRUE : PR_FALSE;
return NS_OK;
}
NS_IMETHODIMP
PromptService::ConfirmCheck(nsIDOMWindow *parent,
const PRUnichar *dialogTitle,
const PRUnichar *text,
const PRUnichar *checkboxMsg,
PRBool *checkValue,
PRBool *_retval)
{
Confirm(parent, dialogTitle, text, _retval);
return NS_OK;
}
NS_IMETHODIMP
PromptService::Prompt(nsIDOMWindow *parent,
const PRUnichar *dialogTitle,
const PRUnichar *text,
PRUnichar **value,
const PRUnichar *checkboxMsg,
PRBool *checkValue,
PRBool *_retval)
{
HWND wnd = WndForDOMWindow(parent);
MessageBoxW(wnd, L"Prompt", dialogTitle, MB_OK | MB_ICONEXCLAMATION);
return NS_OK;
}
NS_IMETHODIMP
PromptService::PromptUsernameAndPassword(nsIDOMWindow *parent,
const PRUnichar *dialogTitle,
const PRUnichar *text,
PRUnichar **username,
PRUnichar **password,
const PRUnichar *checkboxMsg,
PRBool *checkValue,
PRBool *_retval)
{
HWND wnd = WndForDOMWindow(parent);
MessageBoxW(wnd, L"PromptUsernameAndPassword", dialogTitle, MB_OK | MB_ICONEXCLAMATION);
return NS_OK;
}
NS_IMETHODIMP
PromptService::PromptPassword(nsIDOMWindow *parent,
const PRUnichar *dialogTitle,
const PRUnichar *text,
PRUnichar **password,
const PRUnichar *checkboxMsg,
PRBool *checkValue,
PRBool *_retval)
{
HWND wnd = WndForDOMWindow(parent);
MessageBoxW(wnd, L"PromptPassword", dialogTitle, MB_OK | MB_ICONEXCLAMATION);
return NS_OK;
}
NS_IMETHODIMP
PromptService::Select(nsIDOMWindow *parent,
const PRUnichar *dialogTitle,
const PRUnichar *text, PRUint32 count,
const PRUnichar **selectList,
PRInt32 *outSelection,
PRBool *_retval)
{
HWND wnd = WndForDOMWindow(parent);
MessageBoxW(wnd, L"Select", dialogTitle, MB_OK | MB_ICONEXCLAMATION);
return NS_OK;
}
NS_IMETHODIMP
PromptService::ConfirmEx(nsIDOMWindow *parent,
const PRUnichar *dialogTitle,
const PRUnichar *text,
PRUint32 buttonFlags,
const PRUnichar *button0Title,
const PRUnichar *button1Title,
const PRUnichar *button2Title,
const PRUnichar *checkMsg,
PRBool *checkValue,
PRInt32 *buttonPressed)
{
HWND wnd = WndForDOMWindow(parent);
MessageBoxW(wnd, L"ConfirmEx", dialogTitle, MB_OK | MB_ICONEXCLAMATION);
return NS_OK;
}
class PromptServiceFactory : public nsIFactory {
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIFACTORY
PromptServiceFactory();
virtual ~PromptServiceFactory();
};
//*****************************************************************************
NS_IMPL_ISUPPORTS1(PromptServiceFactory, nsIFactory)
PromptServiceFactory::PromptServiceFactory() {
}
PromptServiceFactory::~PromptServiceFactory() {
}
NS_IMETHODIMP
PromptServiceFactory::CreateInstance(nsISupports *aOuter, const nsIID & aIID, void **aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
*aResult = NULL;
PromptService *inst = new PromptService;
if (!inst)
return NS_ERROR_OUT_OF_MEMORY;
nsresult rv = inst->QueryInterface(aIID, aResult);
if (rv != NS_OK) {
// We didn't get the right interface, so clean up
delete inst;
}
return rv;
}
NS_IMETHODIMP
PromptServiceFactory::LockFactory(PRBool lock)
{
return NS_OK;
}
nsresult NS_NewPromptServiceFactory(nsIFactory** aFactory)
{
NS_ENSURE_ARG_POINTER(aFactory);
*aFactory = nsnull;
PromptServiceFactory *result = new PromptServiceFactory;
if (!result)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(result);
*aFactory = result;
return NS_OK;
}

View File

@ -1,9 +0,0 @@
#include "nsIFactory.h"
#include "nsIPromptService.h"
#define NS_PROMPTSERVICE_CID \
{0xa2112d6a, 0x0e28, 0x421f, {0xb4, 0x6a, 0x25, 0xc0, 0xb3, 0x8, 0xcb, 0xd0}}
nsresult NS_NewPromptServiceFactory(nsIFactory** aFactory);

View File

@ -46,17 +46,13 @@
#include "nsIDOMEventTarget.h"
#include "nsIContent.h"
// Local includes
#include "resource.h"
#include "winEmbed.h"
#include "WebBrowserChrome.h"
#include "nsIWebBrowserSetup.h"
WebBrowserChrome::WebBrowserChrome()
{
mNativeWindow = nsnull;
mSizeSet = PR_FALSE;
}
WebBrowserChrome::~WebBrowserChrome()
@ -76,43 +72,24 @@ nsresult WebBrowserChrome::CreateBrowser(PRInt32 aX, PRInt32 aY,
if (!mWebBrowser)
return NS_ERROR_FAILURE;
// Configure what the web browser can and cannot do
nsCOMPtr<nsIWebBrowserSetup> webBrowserAsSetup(do_QueryInterface(mWebBrowser));
webBrowserAsSetup->SetProperty(nsIWebBrowserSetup::SETUP_ALLOW_PLUGINS, PR_TRUE);
webBrowserAsSetup->SetProperty(nsIWebBrowserSetup::SETUP_IS_CHROME_WRAPPER, PR_TRUE);
(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));
// get the content DOM window for that web browser
nsCOMPtr<nsIDOMWindow> domWindow;
mWebBrowser->GetContentDOMWindow(getter_AddRefs(domWindow));
if (!domWindow)
return NS_ERROR_FAILURE;
// get the private DOM window
nsCOMPtr<nsPIDOMWindow> domWindowPrivate = do_QueryInterface(domWindow);
// and the root window for that DOM window
nsPIDOMWindow* piWin = domWindowPrivate->GetPrivateRoot();
nsCOMPtr<nsIDOMEventReceiver> eventHandler = do_QueryInterface(piWin->GetChromeEventHandler());
eventHandler->AddEventListenerByIID(this, NS_GET_IID(nsIDOMMouseListener));
// The window has been created. Now register for history notifications
mWebBrowser->AddWebBrowserListener(thisListener, NS_GET_IID(nsISHistoryListener));
browserBaseWindow->InitWindow( mNativeWindow, nsnull, aX, aY, aCX, aCY);
browserBaseWindow->Create();
if (mWebBrowser)
{
@ -120,6 +97,7 @@ nsresult WebBrowserChrome::CreateBrowser(PRInt32 aX, PRInt32 aY,
NS_ADDREF(*aBrowser);
return NS_OK;
}
return NS_ERROR_FAILURE;
}
@ -135,14 +113,6 @@ NS_INTERFACE_MAP_BEGIN(WebBrowserChrome)
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_ENTRY(nsIDOMEventListener)
NS_INTERFACE_MAP_ENTRY(nsIDOMMouseListener)
NS_INTERFACE_MAP_END
//*****************************************************************************
@ -171,7 +141,6 @@ NS_IMETHODIMP WebBrowserChrome::GetInterface(const nsIID &aIID, void** aInstance
NS_IMETHODIMP WebBrowserChrome::SetStatus(PRUint32 aType, const PRUnichar* aStatus)
{
WebBrowserChromeUI::UpdateStatusBarText(this, aStatus);
return NS_OK;
}
@ -211,33 +180,21 @@ NS_IMETHODIMP WebBrowserChrome::DestroyBrowserWindow(void)
// 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;
SetWindowPos((HWND)mNativeWindow, NULL, 0, 0, aWidth, aHeight, SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER);
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;
*_retval = mContinueModalLoop;
return NS_OK;
}
NS_IMETHODIMP WebBrowserChrome::ExitModalEventLoop(nsresult aStatus)
@ -260,242 +217,59 @@ 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);
if (NS_FAILED(status))
{
nsString wStr;
char buffer[100];
sprintf(buffer, "Error loading page (status=%x)", status);
wStr.AppendLiteral(buffer);
WebBrowserChromeUI::UpdateStatusBarText(this, wStr.get());
#ifdef DEBUG
printf(buffer);
#endif
}
}
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;
}
//*****************************************************************************
// WebBrowserChrome::nsIEmbeddingSiteWindow
//*****************************************************************************
NS_IMETHODIMP WebBrowserChrome::SetDimensions(PRUint32 aFlags, PRInt32 x, PRInt32 y, PRInt32 cx, PRInt32 cy)
NS_IMETHODIMP WebBrowserChrome::SetDimensions(PRUint32 aFlags, PRInt32 aX, PRInt32 aY, PRInt32 aCX, PRInt32 aCY)
{
return NS_ERROR_NOT_IMPLEMENTED;
nsCOMPtr<nsIBaseWindow> browserBaseWindow = do_QueryInterface(mWebBrowser);
if (aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION && (aFlags & (nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER | nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER)))
{
MoveWindow((HWND)mNativeWindow, aX, aY, aCX, aCY, PR_TRUE);
return NS_OK;
}
else if (aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION)
{
RECT rect;
GetWindowRect((HWND)mNativeWindow, &rect);
MoveWindow((HWND)mNativeWindow, aX, aY, rect.right-rect.left, rect.bottom-rect.top, TRUE);
return NS_OK;
}
else if (aFlags & (nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER |
nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER)) {
RECT rect;
GetWindowRect((HWND)mNativeWindow, &rect);
MoveWindow((HWND)mNativeWindow, rect.left, rect.top, aCX, aCY, TRUE);
return NS_OK;
}
return NS_ERROR_INVALID_ARG;
}
NS_IMETHODIMP WebBrowserChrome::GetDimensions(PRUint32 aFlags, PRInt32 *x, PRInt32 *y, PRInt32 *cx, PRInt32 *cy)
NS_IMETHODIMP WebBrowserChrome::GetDimensions(PRUint32 aFlags, PRInt32 *aX, PRInt32 *aY, PRInt32 *aCX, PRInt32 *aCY)
{
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;
nsCOMPtr<nsIBaseWindow> browserBaseWindow = do_QueryInterface(mWebBrowser);
if (aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION &&
(aFlags & (nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER |
nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER))) {
return browserBaseWindow->GetPositionAndSize(aX, aY, aCX, aCY);
}
else if (aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION) {
return browserBaseWindow->GetPosition(aX, aY);
}
else if (aFlags & (nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER |
nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER)) {
return browserBaseWindow->GetSize(aCX, aCY);
}
return NS_ERROR_INVALID_ARG;
}
/* void setFocus (); */
NS_IMETHODIMP WebBrowserChrome::SetFocus()
{
WebBrowserChromeUI::SetFocus(this);
::SetFocus((HWND)mNativeWindow);
return NS_OK;
}
@ -533,124 +307,3 @@ NS_IMETHODIMP WebBrowserChrome::GetSiteWindow(void * *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;
}
//*****************************************************************************
// WebBrowserChrome::nsIDOMEventListener
//*****************************************************************************
NS_IMETHODIMP WebBrowserChrome::HandleEvent(nsIDOMEvent* aEvent)
{
return NS_OK;
}
//*****************************************************************************
// WebBrowserChrome::nsIDOMMouseEvent
//*****************************************************************************
NS_IMETHODIMP WebBrowserChrome::MouseDown(nsIDOMEvent* aDOMEvent)
{
return NS_OK;
}
NS_IMETHODIMP WebBrowserChrome::MouseUp(nsIDOMEvent* aDOMEvent)
{
return NS_OK;
}
NS_IMETHODIMP WebBrowserChrome::MouseClick(nsIDOMEvent* aDOMEvent)
{
return NS_OK;
}
NS_IMETHODIMP WebBrowserChrome::MouseDblClick(nsIDOMEvent* aDOMEvent)
{
nsCOMPtr<nsIDOMMouseEvent> mouseEvent = do_QueryInterface(aDOMEvent);
if (!mouseEvent)
return NS_OK;
// We want to hide events that are in anonymous content such as a scrollbar.
nsCOMPtr<nsIDOMNSEvent> nsEvent(do_QueryInterface(aDOMEvent));
if (!nsEvent)
return NS_OK;
nsCOMPtr<nsIDOMEventTarget> targetNode;
aDOMEvent->GetTarget(getter_AddRefs(targetNode));
nsCOMPtr<nsIDOMEventTarget> originalTargetNode;
nsEvent->GetOriginalTarget(getter_AddRefs(originalTargetNode));
if (originalTargetNode != targetNode)
return NS_OK;
PRInt32 screenX, screenY;
mouseEvent->GetScreenX(&screenX);
mouseEvent->GetScreenY(&screenY);
boolean handled = WebBrowserChromeUI::DoubleClick(this, screenX, screenY);
if (handled)
{
aDOMEvent->StopPropagation();
aDOMEvent->PreventDefault();
}
return NS_OK;
}
NS_IMETHODIMP WebBrowserChrome::MouseOver(nsIDOMEvent* aDOMEvent)
{
return NS_OK;
}
NS_IMETHODIMP WebBrowserChrome::MouseOut(nsIDOMEvent* aDOMEvent)
{
return NS_OK;
}

View File

@ -38,7 +38,6 @@
#include "nsIBaseWindow.h"
#include "nsIEmbeddingSiteWindow.h"
#include "nsIWebNavigation.h"
#include "nsIWebProgressListener.h"
#include "nsIInterfaceRequestor.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIWebBrowser.h"
@ -47,8 +46,6 @@
#include "nsISHistoryListener.h"
#include "nsIContextMenuListener.h"
#include "nsITooltipListener.h"
#include "nsIDOMMouseListener.h"
#include "nsIDOMMouseEvent.h"
class WebBrowserChromeUI
{
@ -56,35 +53,13 @@ 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);
static boolean DoubleClick(nsIWebBrowserChrome *aChrome, PRInt32 x, PRInt32 y);
};
class WebBrowserChrome : public nsIWebBrowserChrome,
public nsIWebBrowserChromeFocus,
public nsIWebProgressListener,
public nsIEmbeddingSiteWindow,
public nsIInterfaceRequestor,
public nsISHistoryListener,
public nsIObserver,
public nsIContextMenuListener,
public nsITooltipListener,
public nsSupportsWeakReference,
public nsIDOMMouseListener
public nsSupportsWeakReference
{
public:
WebBrowserChrome();
@ -93,42 +68,18 @@ public:
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
// nsIDOMEventListener
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent);
// nsIDOMMouseListener
NS_IMETHOD MouseDown(nsIDOMEvent* aDOMEvent);
NS_IMETHOD MouseUp(nsIDOMEvent* aDOMEvent);
NS_IMETHOD MouseClick(nsIDOMEvent* aDOMEvent);
NS_IMETHOD MouseDblClick(nsIDOMEvent* aDOMEvent);
NS_IMETHOD MouseOver(nsIDOMEvent* aDOMEvent);
NS_IMETHOD MouseOut(nsIDOMEvent* aDOMEvent);
nsresult CreateBrowser(PRInt32 aX, PRInt32 aY, PRInt32 aCX, PRInt32 aCY,
nsIWebBrowser **aBrowser);
void SetParent(nsIWebBrowserChrome *aParent)
{ mDependentParent = aParent; }
nsresult CreateBrowser(PRInt32 aX, PRInt32 aY, PRInt32 aCX, PRInt32 aCY, nsIWebBrowser **aBrowser);
protected:
nsresult SendHistoryStatusMessage(nsIURI * aURI, char * operation, PRInt32 info1=0, PRUint32 info2=0);
nativeWindow mNativeWindow;
PRUint32 mChromeFlags;
PRBool mContinueModalLoop;
PRBool mSizeSet;
nsCOMPtr<nsIWebBrowser> mWebBrowser;
nsCOMPtr<nsIWebBrowserChrome> mDependentParent; // opener (for dependent windows only)
};
#endif /* __WebBrowserChrome__ */

View File

@ -30,7 +30,7 @@
#include "nsIWebBrowserChrome.h"
#include "WindowCreator.h"
#include "winEmbed.h"
#include "MinimoPrivate.h"
WindowCreator::WindowCreator()
{
@ -42,12 +42,70 @@ WindowCreator::~WindowCreator()
NS_IMPL_ISUPPORTS1(WindowCreator, nsIWindowCreator)
NS_IMETHODIMP
WindowCreator::CreateChromeWindow(nsIWebBrowserChrome *parent,
PRUint32 chromeFlags,
nsIWebBrowserChrome **_retval)
nsresult ResizeEmbedding(nsIWebBrowserChrome* chrome)
{
NS_ENSURE_ARG_POINTER(_retval);
AppCallbacks::CreateBrowserWindow(PRInt32(chromeFlags), parent, _retval);
return *_retval ? NS_OK : NS_ERROR_FAILURE;
if (!chrome)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIEmbeddingSiteWindow> embeddingSite = do_QueryInterface(chrome);
HWND hWnd;
embeddingSite->GetSiteWindow((void **) & hWnd);
if (!hWnd)
return NS_ERROR_NULL_POINTER;
RECT rect;
GetClientRect(hWnd, &rect);
// Make sure the browser is visible and sized
nsCOMPtr<nsIWebBrowser> webBrowser;
chrome->GetWebBrowser(getter_AddRefs(webBrowser));
nsCOMPtr<nsIBaseWindow> 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;
}
NS_IMETHODIMP
WindowCreator::CreateChromeWindow(nsIWebBrowserChrome *aParent,
PRUint32 aChromeFlags,
nsIWebBrowserChrome **aNewWindow)
{
NS_ENSURE_ARG_POINTER(aNewWindow);
WebBrowserChrome * chrome = new WebBrowserChrome();
if (!chrome)
return NS_ERROR_FAILURE;
// now an extra addref; the window owns itself (to be released by
// WebBrowserChromeUI::Destroy)
NS_ADDREF(chrome);
chrome->SetChromeFlags(aChromeFlags);
// Insert the browser
nsCOMPtr<nsIWebBrowser> newBrowser;
chrome->CreateBrowser(-1, -1, -1, -1, getter_AddRefs(newBrowser));
if (!newBrowser)
{
NS_RELEASE(chrome);
return NS_ERROR_FAILURE;
}
// and an addref on the way out.
NS_ADDREF(chrome);
*aNewWindow = NS_STATIC_CAST(nsIWebBrowserChrome*, chrome);
ResizeEmbedding(chrome);
return NS_OK;
}

View File

@ -182,3 +182,5 @@ pref("ui.key.menuAccessKey", 18);
pref("ui.key.menuAccessKeyFocuses", false);
pref("ui.key.saveLink.shift", true);
pref("viewmanager.do_doublebuffering", true);
pref("browser.xul.error_pages.enabled", true);

View File

@ -3,6 +3,7 @@ mozuconv
i18n
necko
jar50
rdf
pref
caps
gkparser
@ -13,12 +14,16 @@ gklayout
docshell
embedcmp
webbrwsr
editor
texteditor
txmgr
appshell
chrmlite
chrome
mork
xmlextra
t8iix
websrvcs
popuplite
snav
tkitcmps
gkplugin
softkey

View File

@ -3,6 +3,7 @@ nsUConvModule
nsI18nModule
necko_core_and_primary_protocols
nsJarModule
nsRDFModule
nsPrefModule
nsSecurityManagerModule
nsParserModule
@ -16,9 +17,13 @@ Browser_Embedding_Module
nsEditorModule
nsTransactionManagerModule
appshell
chromelite
nsChromeModule
nsMorkModule
nsXMLExtrasModule
TransformiixModule
nsWebServicesModule
popuplite
SpatialNavigationModule
nsToolkitCompsModule
nsPluginModule
SoftKeyBoardModule

View File

@ -8,10 +8,10 @@ CROSS_COMPILE=1
CXX=arm-wince-gcc
LD=arm-wince-link
AR=arm-wince-lib
mk_add_options AR=arm-wince-lib
AS=arm-wince-as
mk_add_options AR=arm-wince-lib
ac_add_options --target=arm-wince
ac_add_options --enable-win32-target=WINCE
ac_add_options --enable-default-toolkit=windows
@ -23,7 +23,7 @@ ac_add_options --disable-md
ac_add_options --disable-activex
ac_add_options --disable-activex-scripting
ac_add_options --disable-oji
ac_add_options --disable-plugins
#ac_add_options --disable-plugins
WINCE=1
mk_add_options WINCE=1
@ -34,16 +34,13 @@ mk_add_options TARGET_DEVICE=device
MINIMO=1
mk_add_options MINIMO=1
# disable XUL support to reduce codesize
ac_add_options --disable-xul
# enable minimal profile support
ac_add_options --disable-profilesharing
ac_add_options --disable-profilelocking
ac_add_options --enable-single-profile
# disable features and skip various build steps
ac_add_options --enable-extensions="xml-rpc xmlextras transformiix webservices"
ac_add_options --enable-extensions="xml-rpc xmlextras transformiix webservices spatialnavigation"
ac_add_options --disable-accessibility
ac_add_options --disable-composer
ac_add_options --enable-plaintext-editor-only
@ -66,7 +63,7 @@ ac_add_options --disable-logging
ac_add_options --disable-tests
# build minimal set of protocol handlers
ac_add_options --enable-necko-protocols=http,file,res,jar
ac_add_options --enable-necko-protocols=about,data,http,file,res,jar
# build minimal set of image decoders
ac_add_options --enable-image-decoders=png,gif,jpeg
@ -82,4 +79,5 @@ ac_add_options --disable-debug
ac_add_options --disable-shared
ac_add_options --enable-static
#for now.
ac_add_options --disable-crypto

View File

@ -34,16 +34,13 @@ mk_add_options TARGET_DEVICE=emulator
MINIMO=1
mk_add_options MINIMO=1
# disable XUL support to reduce codesize
ac_add_options --disable-xul
# enable minimal profile support
ac_add_options --disable-profilesharing
ac_add_options --disable-profilelocking
ac_add_options --enable-single-profile
# disable features and skip various build steps
ac_add_options --enable-extensions="xml-rpc xmlextras transformiix webservices"
ac_add_options --enable-extensions="xml-rpc xmlextras transformiix webservices spatialnavigation"
ac_add_options --disable-accessibility
ac_add_options --disable-composer
ac_add_options --enable-plaintext-editor-only
@ -66,7 +63,7 @@ ac_add_options --disable-logging
ac_add_options --disable-tests
# build minimal set of protocol handlers
ac_add_options --enable-necko-protocols=http,file,res,jar
ac_add_options --enable-necko-protocols=about,data,http,file,res,jar
# build minimal set of image decoders
ac_add_options --enable-image-decoders=png,gif,jpeg
@ -82,7 +79,6 @@ ac_add_options --disable-debug
ac_add_options --disable-shared
ac_add_options --enable-static
ac_add_options --disable-crypto
#ac_add_options --disable-crypto
# XPCALL Code is busted on the emulator?
ac_add_options --disable-jsloader

File diff suppressed because it is too large Load Diff

View File

@ -1,44 +1,6 @@
/* -*- 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);
}
extern nsresult CreateBrowserWindow(PRUint32 aChromeFlags, nsIWebBrowserChrome *aParent, nsIWebBrowserChrome **aNewWindow);
extern PRUint32 RunEventLoop(PRBool &aRunCondition);
extern HWND GetBrowserFromChrome(nsIWebBrowserChrome *aChrome);