From 48cd1db9db18b6c82839d60babc144148388df26 Mon Sep 17 00:00:00 2001 From: "radha%netscape.com" Date: Tue, 13 Aug 2002 19:23:55 +0000 Subject: [PATCH] Initial checkin for mozEmbed, XPCOM based embedding app. Not part of the mozilla trunk build. git-svn-id: svn://10.0.0.236/trunk@127191 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/embedding/qa/mozembed/src/Makefile.in | 73 + mozilla/embedding/qa/mozembed/src/SMALL.ICO | Bin 0 -> 318 bytes mozilla/embedding/qa/mozembed/src/StdAfx.cpp | 37 + mozilla/embedding/qa/mozembed/src/StdAfx.h | 61 + .../embedding/qa/mozembed/src/makefile.win | 101 ++ .../embedding/qa/mozembed/src/mozEmbed.ICO | Bin 0 -> 1078 bytes .../embedding/qa/mozembed/src/mozEmbed.cpp | 1496 +++++++++++++++++ mozilla/embedding/qa/mozembed/src/mozEmbed.h | 39 + mozilla/embedding/qa/mozembed/src/mozEmbed.rc | 263 +++ .../qa/mozembed/src/nsQABrowserCID.h | 54 + .../qa/mozembed/src/nsQABrowserChrome.cpp | 398 +++++ .../qa/mozembed/src/nsQABrowserChrome.h | 97 ++ .../qa/mozembed/src/nsQABrowserModule.cpp | 199 +++ .../qa/mozembed/src/nsQABrowserUIGlue.h | 76 + .../qa/mozembed/src/nsQABrowserView.cpp | 172 ++ .../qa/mozembed/src/nsQABrowserView.h | 83 + .../qa/mozembed/src/nsQAWindowCreator.cpp | 61 + .../qa/mozembed/src/nsQAWindowCreator.h | 48 + mozilla/embedding/qa/mozembed/src/resource.h | 71 + 19 files changed, 3329 insertions(+) create mode 100644 mozilla/embedding/qa/mozembed/src/Makefile.in create mode 100644 mozilla/embedding/qa/mozembed/src/SMALL.ICO create mode 100644 mozilla/embedding/qa/mozembed/src/StdAfx.cpp create mode 100644 mozilla/embedding/qa/mozembed/src/StdAfx.h create mode 100644 mozilla/embedding/qa/mozembed/src/makefile.win create mode 100644 mozilla/embedding/qa/mozembed/src/mozEmbed.ICO create mode 100644 mozilla/embedding/qa/mozembed/src/mozEmbed.cpp create mode 100644 mozilla/embedding/qa/mozembed/src/mozEmbed.h create mode 100644 mozilla/embedding/qa/mozembed/src/mozEmbed.rc create mode 100644 mozilla/embedding/qa/mozembed/src/nsQABrowserCID.h create mode 100644 mozilla/embedding/qa/mozembed/src/nsQABrowserChrome.cpp create mode 100644 mozilla/embedding/qa/mozembed/src/nsQABrowserChrome.h create mode 100644 mozilla/embedding/qa/mozembed/src/nsQABrowserModule.cpp create mode 100644 mozilla/embedding/qa/mozembed/src/nsQABrowserUIGlue.h create mode 100644 mozilla/embedding/qa/mozembed/src/nsQABrowserView.cpp create mode 100644 mozilla/embedding/qa/mozembed/src/nsQABrowserView.h create mode 100644 mozilla/embedding/qa/mozembed/src/nsQAWindowCreator.cpp create mode 100644 mozilla/embedding/qa/mozembed/src/nsQAWindowCreator.h create mode 100644 mozilla/embedding/qa/mozembed/src/resource.h diff --git a/mozilla/embedding/qa/mozembed/src/Makefile.in b/mozilla/embedding/qa/mozembed/src/Makefile.in new file mode 100644 index 00000000000..caeb0a99cfd --- /dev/null +++ b/mozilla/embedding/qa/mozembed/src/Makefile.in @@ -0,0 +1,73 @@ +# +# The contents of this file are subject to the Mozilla Public +# License Version 1.1 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is Netscape +# Communications, Inc. Portions created by Netscape are +# Copyright (C) 2001, Mozilla. All Rights Reserved. +# +# Contributor(s): + +DEPTH = ../../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +MODULE = mozEmbed +PROGRAM = mozEmbed$(BIN_SUFFIX) +RESFILE = $(MODULE).res + +REQUIRES = xpcom \ + string \ + embed_base \ + webbrwsr \ + webshell \ + windowwatcher \ + profile \ + necko \ + docshell \ + dom \ + widget \ + uriloader \ + shistory \ + webbrowserpersist \ + gfx \ + mozEmbed \ + $(NULL) + + +CPPSRCS = nsQABrowserView.cpp \ + nsQABrowserChrome.cpp \ + nsQABrowserModule.cpp \ + nsQAWindowCreator.cpp \ + mozEmbed.cpp \ + StdAfx.cpp \ + $(NULL) + +EXTRA_DSO_LIBS = embed_base_s gkgfx + +LIBS = \ + $(EXTRA_DSO_LIBS) \ + $(XPCOM_LIBS) \ + $(NSPR_LIBS) \ + $(NULL) + +OS_LIBS += \ + ole32.lib \ + comdlg32.lib \ + shell32.lib \ + version.lib \ + $(NULL) + +include $(topsrcdir)/config/rules.mk diff --git a/mozilla/embedding/qa/mozembed/src/SMALL.ICO b/mozilla/embedding/qa/mozembed/src/SMALL.ICO new file mode 100644 index 0000000000000000000000000000000000000000..ec288075e2874b7f8371930b7fdc8c4071fce40c GIT binary patch literal 318 zcmc(Zu?>JQ3 r?D{1EDk6qS)ruf9bwKN{X8!X4mZ>tL literal 0 HcmV?d00001 diff --git a/mozilla/embedding/qa/mozembed/src/StdAfx.cpp b/mozilla/embedding/qa/mozembed/src/StdAfx.cpp new file mode 100644 index 00000000000..d8bfde4ed9c --- /dev/null +++ b/mozilla/embedding/qa/mozembed/src/StdAfx.cpp @@ -0,0 +1,37 @@ +/* ***** 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 ***** */ + +// stdafx.cpp : source file that includes just the standard includes +// winEmbed.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/mozilla/embedding/qa/mozembed/src/StdAfx.h b/mozilla/embedding/qa/mozembed/src/StdAfx.h new file mode 100644 index 00000000000..3c26f2f98f5 --- /dev/null +++ b/mozilla/embedding/qa/mozembed/src/StdAfx.h @@ -0,0 +1,61 @@ +/* ***** 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 ***** */ + +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) +#define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + + +// Windows Header Files: +#include + +// C RunTime Header Files +#include +#include +#include +#include + +// Local Header Files + +// TODO: reference additional headers your program requires here + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) diff --git a/mozilla/embedding/qa/mozembed/src/makefile.win b/mozilla/embedding/qa/mozembed/src/makefile.win new file mode 100644 index 00000000000..5c23fb18eef --- /dev/null +++ b/mozilla/embedding/qa/mozembed/src/makefile.win @@ -0,0 +1,101 @@ +# ***** 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=..\..\..\.. + +MAKE_OBJ_TYPE = EXE + +MODULE = mozEmbed +REQUIRES = xpcom \ + string \ + embed_base \ + webBrowser_core \ + webshell \ + windowwatcher \ + profile \ + necko \ + docshell \ + dom \ + widget \ + uriloader \ + shistory \ + webbrowserpersist \ + gfx \ + mozEmbed \ + $(NULL) + +PROGRAM = .\$(OBJDIR)\$(MODULE).exe +RESFILE = $(MODULE).res + + +# +# 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. +# +LLFLAGS=$(LLFLAGS) /HEAP:0x40000 + + +OBJS = \ + .\$(OBJDIR)\nsQABrowserView.obj \ + .\$(OBJDIR)\nsQABrowserChrome.obj \ + .\$(OBJDIR)\nsQAWindowCreator.obj \ + .\$(OBJDIR)\StdAfx.obj \ + .\$(OBJDIR)\nsQABrowserModule.obj \ + .\$(OBJDIR)\mozEmbed.obj \ + $(NULL) + +LLIBS= \ + $(DIST)\lib\baseembed_s.lib \ + $(DIST)\lib\gkgfx.lib \ + $(DIST)\lib\xpcom.lib \ + $(LIBNSPR) \ + $(NULL) + +WIN_LIBS= \ + ole32.lib \ + comdlg32.lib \ + shell32.lib \ + version.lib \ + $(NULL) + +include <$(DEPTH)\config\rules.mak> + +libs:: $(PROGRAM) + $(MAKE_INSTALL) $(PROGRAM) $(DIST)\bin + +clobber_all:: + $(RM) $(DIST)\bin\$(MODULE).exe + diff --git a/mozilla/embedding/qa/mozembed/src/mozEmbed.ICO b/mozilla/embedding/qa/mozembed/src/mozEmbed.ICO new file mode 100644 index 0000000000000000000000000000000000000000..b276a959679bf59784dd4fcd071783a0e3b120a2 GIT binary patch literal 1078 zcmeH_(G9{d3`8$2-#8=W3v~=e%V-&gPj673Qz50ONC-aR((~D|+m(@Zs}DevFE#>EP=wMAG+sZf26J3yG1txtqmTpsWSn TOD>ppkC9I`*0N_?`+d9vY|+CV literal 0 HcmV?d00001 diff --git a/mozilla/embedding/qa/mozembed/src/mozEmbed.cpp b/mozilla/embedding/qa/mozembed/src/mozEmbed.cpp new file mode 100644 index 00000000000..5a10f346671 --- /dev/null +++ b/mozilla/embedding/qa/mozembed/src/mozEmbed.cpp @@ -0,0 +1,1496 @@ +/* -*- 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): Radha Kulkarni + * + * ***** END LICENSE BLOCK ***** */ + +#include +#include "stdafx.h" + +// Win32 header files +#include "windows.h" +#include "commctrl.h" +#include "commdlg.h" + +// Mozilla header files +#include "nsCOMPtr.h" +#include "nsEmbedAPI.h" +#include "nsWeakReference.h" +#include "nsIClipboardCommands.h" +#include "nsXPIDLString.h" +#include "nsIWebBrowserPersist.h" +#include "nsIWebBrowserFocus.h" +#include "nsIWindowWatcher.h" +#include "nsIProfile.h" +//#include "nsIObserverService.h" +#include "nsIObserver.h" +#include "nsIProfileChangeStatus.h" +#include "nsIURI.h" +#include "plstr.h" +#include "nsIInterfaceRequestor.h" +#include "nsCRT.h" +#include "nsString.h" + +#include "nsIWebBrowser.h" +#include "nsIComponentManager.h" +#include "nsIServiceManagerUtils.h" +#include "nsIEmbeddingSiteWindow.h" +#include "nsIWebNavigation.h" +#include "nsIWebBrowserChrome.h" +#include "nsIInterfaceRequestorUtils.h" +#include "nsIComponentRegistrar.h" +#include "nsIModule.h" +#include "nsIGenericFactory.h" + +// Local header files +//#include "nsIQABrowserChrome.h" +#include "mozEmbed.h" +#include "nsQAWindowCreator.h" +#include "resource.h" +#include "nsQABrowserCID.h" +#include "nsQABrowserUIGlue.h" +//#include "nsIQABrowserView.h" + + +// Printing header files +#include "nsIPrintSettings.h" +#include "nsIWebBrowserPrint.h" + + +#define MAX_LOADSTRING 100 +#define MAX_BROWSER_ALLOWED 50 + +const TCHAR *szWindowClass = _T("MOZEMBED"); + +// Forward declarations of functions included in this code module: +static ATOM MyRegisterClass(HINSTANCE hInstance); +static LRESULT CALLBACK BrowserWndProc(HWND, UINT, WPARAM, LPARAM); +static BOOL 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 BOOL ChooseNewProfile(BOOL bShowForMultipleProfilesOnly, const char *szDefaultProfile); +static LRESULT CALLBACK ChooseProfileDlgProc(HWND, UINT, WPARAM, LPARAM); +extern nsresult RegisterComponents(); + +// Global variables +static UINT gDialogCount = 0; +static BOOL gProfileSwitch = FALSE; +static HINSTANCE ghInstanceResources = NULL; +static HINSTANCE ghInstanceApp = NULL; +static char gFirstURL[1024]; + +// 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/") +}; + +// +// 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: 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); + + PRBool canGoBack = PR_FALSE; + PRBool canGoForward = PR_FALSE; + if (webNavigation) + { + webNavigation->GetCanGoBack(&canGoBack); + webNavigation->GetCanGoForward(&canGoForward); + } + + PRBool canCutSelection = PR_FALSE; + PRBool canCopySelection = PR_FALSE; + PRBool 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); +} + + + + +//////////////////////////////////////////////////////////////////////////////////////////// +// Main program +//////////////////////////////////////////////////////////////////////////////////////////// + +int main(int argc, char *argv[]) +{ + 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"; + char *szDefaultProfile = nsnull; + int argn; + for (argn = 1; argn < argc; argn++) + { + if (stricmp("-P", argv[argn]) == 0) + { + if (argn + 1 < argc) + { + szDefaultProfile = argv[++argn]; + } + } + else + { + szFirstURL = argv[argn]; + } + } + strncpy(gFirstURL, szFirstURL, sizeof(gFirstURL) - 1); + + ghInstanceApp = GetModuleHandle(NULL); + ghInstanceResources = GetModuleHandle(NULL); + + // Initialize global strings + TCHAR szTitle[MAX_LOADSTRING]; + LoadString(ghInstanceResources, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); + MyRegisterClass(ghInstanceApp); + + // Init Embedding APIs + NS_InitEmbedding(nsnull, nsnull); + RegisterComponents(); + + // Choose the new profile + // Have to do this to initialise global history + if (!ChooseNewProfile(TRUE, szDefaultProfile)) + { + NS_TermEmbedding(); + return 1; + } + + WPARAM rv; + { + 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 = AppCallbacks::RunEventLoop(runCondition); + + // observer->Release(); + } + // Close down Embedding APIs + NS_TermEmbedding(); + + return 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() +{ + + printf("In InitializeWindowCreator\n"); + // create an nsWindowCreator and give it to the WindowWatcher service + WindowCreator *creatorCallback = new WindowCreator(); + if (creatorCallback) + { + nsCOMPtr windowCreator(dont_QueryInterface(NS_STATIC_CAST(nsIWindowCreator *, creatorCallback))); + if (windowCreator) + { + nsCOMPtr wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1")); + if (wwatch) + { + wwatch->SetWindowCreator(windowCreator); + return NS_OK; + } + } + } + return NS_ERROR_FAILURE; +} + +//----------------------------------------------------------------------------- + +// +// FUNCTION: OpenWebPage() +// +// PURPOSE: Opens a new browser dialog and starts it loading to the +// specified url. +// +nsresult OpenWebPage(const char *url) +{ + nsresult rv; + printf("In OpenWebpage\n"); + + if (gDialogCount == MAX_BROWSER_ALLOWED) + return NS_ERROR_FAILURE; + + // Create the UI Glue object. This is the glue between nsIWebBrowserChrome and + // the native UI code. + nsCOMPtr browserUIGlue; + browserUIGlue = do_CreateInstance(NS_QABROWSERUIGLUE_CONTRACTID, &rv); + + if (!browserUIGlue) + return NS_ERROR_FAILURE; + + // Create a new browser window + nsIWebBrowserChrome * chrome; + rv = browserUIGlue->CreateNewBrowserWindow(nsIWebBrowserChrome::CHROME_ALL, nsnull, + &chrome); + if (NS_SUCCEEDED(rv)) { + browserUIGlue->LoadURL(url); + } + return rv; + +} + + + +// +// FUNCTION: SaveWebPage() +// +// PURPOSE: Saves the contents of the web page to a file +// +void SaveWebPage(nsIWebBrowser *aWebBrowser) +{ + // Use the browser window title as the initial file name + nsCOMPtr webBrowserAsWin = do_QueryInterface(aWebBrowser); + nsXPIDLString windowTitle; + webBrowserAsWin->GetTitle(getter_Copies(windowTitle)); + nsCString fileName; fileName.AssignWithConversion(windowTitle); + + // Sanitize the title of all illegal characters + fileName.CompressWhitespace(); // Remove whitespace from the ends + fileName.StripChars("\\*|:\"> persist(do_QueryInterface(aWebBrowser)); + + nsCOMPtr file; + NS_NewNativeLocalFile(nsDependentCString(szFile), TRUE, getter_AddRefs(file)); + + nsCOMPtr dataPath; + if (pszDataPath) + { + NS_NewNativeLocalFile(nsDependentCString(pszDataPath), TRUE, getter_AddRefs(dataPath)); + } + + persist->SaveDocument(nsnull, file, dataPath, nsnull, 0, 0); + } +} + + +// +// FUNCTION: ResizeEmbedding() +// +// PURPOSE: Resizes the webbrowser window to fit its container. +// +nsresult ResizeEmbedding(nsIWebBrowserChrome* chrome) +{ + if (!chrome) + return NS_ERROR_FAILURE; + + nsCOMPtr 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 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(ghInstanceResources, (LPCTSTR)IDI_MOZEMBED); + wcex.hCursor = LoadCursor(NULL, IDC_ARROW); + wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); + wcex.lpszClassName = szWindowClass; + wcex.hIconSm = LoadIcon(ghInstanceResources, (LPCTSTR)IDI_SMALL); + + return RegisterClassEx(&wcex); +} + + + +// +// FUNCTION: BrowserDlgProc() +// +// PURPOSE: Browser dialog windows message handler. +// +// COMMENTS: +// +// The code for handling buttons and menu actions is here. +// +BOOL CALLBACK BrowserDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + if (uMsg == WM_COMMAND && LOWORD(wParam) == MOZ_SwitchProfile) + { + ChooseNewProfile(FALSE, NULL); + return FALSE; + } + + // Get the browser and other pointers since they are used a lot below + HWND hwndBrowser = GetDlgItem(hwndDlg, IDC_BROWSER); + nsIWebBrowserChrome *chrome = nsnull ; + if (hwndBrowser) + { + chrome = (nsIWebBrowserChrome *) GetWindowLong(hwndBrowser, GWL_USERDATA); + } + nsCOMPtr webBrowser; + nsCOMPtr webNavigation; + nsCOMPtr webBrowserPrint; + if (chrome) + { + chrome->GetWebBrowser(getter_AddRefs(webBrowser)); + webNavigation = do_QueryInterface(webBrowser); + webBrowserPrint = do_GetInterface(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) + { + if (!webNavigation || !webBrowser || !chrome) + return FALSE; + + webNavigation->Stop(nsIWebNavigation::STOP_ALL); + chrome->ExitModalEventLoop(NS_OK); + + // Explicitly destroy the embedded browser and then the chrome + // First the browser + nsCOMPtr browserAsWin = do_QueryInterface(webBrowser); + if (browserAsWin) + browserAsWin->Destroy(); + + // Now the chrome + chrome->SetWebBrowser(nsnull); + NS_RELEASE(chrome); + + return FALSE; + } + break; + case WM_DESTROY: + return FALSE; + + case WM_COMMAND: + { + if (!webBrowser) + { + return FALSE; + } + + // 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: + { + TCHAR szURL[2048]; + memset(szURL, 0, sizeof(szURL)); + GetDlgItemText(hwndDlg, IDC_ADDRESS, szURL, + sizeof(szURL) / sizeof(szURL[0]) - 1); + webNavigation->LoadURI( + NS_ConvertASCIItoUCS2(szURL).get(), + nsIWebNavigation::LOAD_FLAGS_NONE, + nsnull, + nsnull, + nsnull); + } + 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; + + case MOZ_Save: + SaveWebPage(webBrowser); + break; + + case MOZ_Print: + { + // NOTE: Embedding code shouldn't need to get the docshell or + // contentviewer AT ALL. This code below will break one + // day but will have to do until the embedding API has + // a cleaner way to do the same thing. + if (webBrowserPrint) + { + nsCOMPtr printSettings; + webBrowserPrint->GetGlobalPrintSettings(getter_AddRefs(printSettings)); + NS_ASSERTION(printSettings, "You can't PrintPreview without a PrintSettings!"); + if (printSettings) + { + printSettings->SetPrintSilent(PR_TRUE); + webBrowserPrint->Print(printSettings, (nsIWebProgressListener*)nsnull); + } + } + } + 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(ghInstanceResources, IDS_ABOUT_TITLE, szAboutTitle, MAX_LOADSTRING); + LoadString(ghInstanceResources, 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 *) GetWindowLong(hWnd, GWL_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); +} + + +/////////////////////////////////////////////////////////////////////////////// +// Profile chooser dialog + + +// +// FUNCTION: ChooseNewProfile() +// +// PURPOSE: Allows the user to select a new profile from a list. +// The bShowForMultipleProfilesOnly argument specifies whether the +// function should automatically select the first profile and return +// without displaying a dialog box if there is only one profile to +// select. +// +BOOL ChooseNewProfile(BOOL bShowForMultipleProfilesOnly, const char *szDefaultProfile) +{ + nsresult rv; + nsCOMPtr profileService = + do_GetService(NS_PROFILE_CONTRACTID, &rv); + if (NS_FAILED(rv)) + { + return FALSE; + } + + if (szDefaultProfile) + { + // Make a new default profile + nsAutoString newProfileName; newProfileName.AssignWithConversion(szDefaultProfile); + rv = profileService->CreateNewProfile(newProfileName.get(), nsnull, nsnull, PR_FALSE); + if (NS_FAILED(rv)) return FALSE; + rv = profileService->SetCurrentProfile(newProfileName.get()); + if (NS_FAILED(rv)) return FALSE; + return TRUE; + } + + PRInt32 profileCount = 0; + rv = profileService->GetProfileCount(&profileCount); + if (profileCount == 0) + { + // Make a new default profile + NS_NAMED_LITERAL_STRING(newProfileName, "mozEmbed"); + rv = profileService->CreateNewProfile(newProfileName.get(), nsnull, nsnull, PR_FALSE); + if (NS_FAILED(rv)) return FALSE; + rv = profileService->SetCurrentProfile(newProfileName.get()); + if (NS_FAILED(rv)) return FALSE; + return TRUE; + } + else if (profileCount == 1 && bShowForMultipleProfilesOnly) + { + // GetCurrentProfile returns the profile which was last used but is not nescesarily + // active. Call SetCurrentProfile to make it installed and active. + + nsXPIDLString currProfileName; + rv = profileService->GetCurrentProfile(getter_Copies(currProfileName)); + if (NS_FAILED(rv)) return FALSE; + rv = profileService->SetCurrentProfile(currProfileName); + if (NS_FAILED(rv)) return FALSE; + return TRUE; + } + + INT nResult; + nResult = DialogBox(ghInstanceResources, (LPCTSTR)IDD_CHOOSEPROFILE, NULL, (DLGPROC)ChooseProfileDlgProc); + return (nResult == IDOK) ? TRUE : FALSE; +} + + +// +// FUNCTION: ChooseProfileDlgProc(HWND, unsigned, WORD, LONG) +// +// PURPOSE: Dialog handler procedure for the open uri dialog. +// +LRESULT CALLBACK ChooseProfileDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + nsresult rv; + switch (message) + { + case WM_INITDIALOG: + { + HWND hwndProfileList = GetDlgItem(hDlg, IDC_PROFILELIST); + + nsCOMPtr profileService = + do_GetService(NS_PROFILE_CONTRACTID, &rv); + + // Get the list of profile names and add them to the list box + PRUint32 listLen = 0; + PRUnichar **profileList = nsnull; + rv = profileService->GetProfileList(&listLen, &profileList); + for (PRUint32 index = 0; index < listLen; index++) + { +#ifdef UNICODE + SendMessageW(hwndProfileList, LB_ADDSTRING, 0, (LPARAM) profileList[index]); +#else + nsCAutoString profile; profile.AssignWithConversion(profileList[index]); + SendMessageA(hwndProfileList, LB_ADDSTRING, 0, (LPARAM) profile.get()); +#endif + } + + // Select the current profile (if there is one) + + // Get the current profile +#ifdef UNICODE + nsXPIDLString currProfile; + profileService->GetCurrentProfile(getter_Copies(currProfile)); +#else + nsXPIDLString currProfileUnicode; + profileService->GetCurrentProfile(getter_Copies(currProfileUnicode)); + nsCAutoString currProfile; currProfile.AssignWithConversion(currProfileUnicode); +#endif + + // Now find and select it + INT currentProfileIndex = LB_ERR; + currentProfileIndex = SendMessage(hwndProfileList, LB_FINDSTRINGEXACT, -1, (LPARAM) currProfile.get()); + if (currentProfileIndex != LB_ERR) + { + SendMessage(hwndProfileList, LB_SETCURSEL, currentProfileIndex, 0); + } + } + return TRUE; + + case WM_COMMAND: + if (LOWORD(wParam) == IDOK || + (HIWORD(wParam) & LBN_DBLCLK && LOWORD(wParam) == IDC_PROFILELIST)) + { + HWND hwndProfileList = GetDlgItem(hDlg, IDC_PROFILELIST); + + // Get the selected profile from the list box and make it current + INT currentProfileIndex = SendMessage(hwndProfileList, LB_GETCURSEL, 0, 0); + if (currentProfileIndex != LB_ERR) + { + nsCOMPtr profileService = + do_GetService(NS_PROFILE_CONTRACTID, &rv); + // Convert TCHAR name to unicode and make it current + INT profileNameLen = SendMessage(hwndProfileList, LB_GETTEXTLEN, currentProfileIndex, 0); + TCHAR *profileName = new TCHAR[profileNameLen + 1]; + SendMessage(hwndProfileList, LB_GETTEXT, currentProfileIndex, (LPARAM) profileName); + nsAutoString newProfile; newProfile.AssignWithConversion(profileName); + rv = profileService->SetCurrentProfile(newProfile.get()); + } + EndDialog(hDlg, IDOK); + } + else if (LOWORD(wParam) == IDCANCEL) + { + EndDialog(hDlg, LOWORD(wParam)); + } + return TRUE; + } + + return FALSE; +} + + +//----------------------------------------------------------------------------- +// AppCallbacks +//----------------------------------------------------------------------------- + + +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 = ::CreateEvent(NULL, TRUE, FALSE, NULL); + + while (aRunCondition ) { + // Process pending messages + while (::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) { + if (!::GetMessage(&msg, NULL, 0, 0)) { + // WM_QUIT + aRunCondition = PR_FALSE; + break; + } + + PRBool wasHandled = PR_FALSE; + ::NS_HandleEmbeddingEvent(msg, wasHandled); + if (wasHandled) + continue; + + ::TranslateMessage(&msg); + ::DispatchMessage(&msg); + } + + // Do idle stuff + ::MsgWaitForMultipleObjects(1, &hFakeEvent, FALSE, 100, QS_ALLEVENTS); + } + ::CloseHandle(hFakeEvent); + return msg.wParam; +} + + +/////////////////////////////////////////////////////////////////////////////// +// nsQABrowserUIGlue +/////////////////////////////////////////////////////////////////////////////// + +nsQABrowserUIGlue::nsQABrowserUIGlue():mAllowNewWindows(PR_TRUE) +{ + NS_INIT_REFCNT(); +} + +nsQABrowserUIGlue::~nsQABrowserUIGlue() +{ + +} + +NS_IMPL_ISUPPORTS1(nsQABrowserUIGlue, nsIQABrowserUIGlue); + +//////////////////////////////////////////////////////////////////////////////// +// nsIQABrowserUIGlue +//////////////////////////////////////////////////////////////////////////////// + +NS_IMETHODIMP +nsQABrowserUIGlue::CreateNewBrowserWindow(PRInt32 aChromeFlags, + nsIWebBrowserChrome *aParent, + nsIWebBrowserChrome **aNewWindow) +{ + + printf("In nsQABrowserUIGlue::CreateNewBrowserWindow\n"); + + nsresult rv; + + + // Create the chrome object. This implements all the interfaces + // that an embedding application must implement. + nsCOMPtr chrome(do_CreateInstance(NS_QABROWSERCHROME_CONTRACTID, &rv)); + if (!chrome) + return NS_ERROR_FAILURE; + + nsCOMPtr webBrowserChrome(do_QueryInterface(chrome)); + + if (!webBrowserChrome) + return NS_ERROR_FAILURE; + + // now an extra addref; the window owns itself (to be released by + // nsQABrowserUIGlue::Destroy) + *aNewWindow = webBrowserChrome.get(); + NS_ADDREF(*aNewWindow); + + // Set the chrome flags on the chrome. This may not be necessary. + webBrowserChrome->SetChromeFlags(aChromeFlags); + // chrome->SetParent(aParent); + + // Create the browser view object. nsIBrowserView creates and holds + // handle to the nsIWebBrowser object. + mBrowserView = do_CreateInstance(NS_QABROWSERVIEW_CONTRACTID, &rv); + if (!mBrowserView) + return NS_ERROR_FAILURE; + + // Create the native window. + nativeWindow nativeWnd; + nativeWnd = CreateNativeWindow(*aNewWindow); + + // Wire all the layers together. + chrome->InitQAChrome(this, nativeWnd); + + // Create the actual browser. + mBrowserView->CreateBrowser(nativeWnd, webBrowserChrome); + + // Place it where we want it. + ResizeEmbedding(webBrowserChrome); + + // 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)) + ShowWindow(*aNewWindow, PR_TRUE); + + return NS_OK; +} + + +// +// FUNCTION: Destroy() +// +// PURPOSE: Destroy the window specified by the chrome +// +NS_IMETHODIMP +nsQABrowserUIGlue::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); + + // Explicitly destroy the embedded browser and then the chrome + // First the browser + nsCOMPtr browserAsWin = do_QueryInterface(webBrowser); + if (browserAsWin) + browserAsWin->Destroy(); + + // Now the chrome + chrome->SetWebBrowser(nsnull); + NS_RELEASE(chrome); + return NS_OK; +} + + +// +// FUNCTION: Called as the final act of a chrome object during its destructor +// +NS_IMETHODIMP +nsQABrowserUIGlue::Destroyed(nsIWebBrowserChrome* chrome) +{ + HWND hwndDlg = GetBrowserDlgFromChrome(chrome); + if (hwndDlg == NULL) + { + return NS_ERROR_FAILURE; + } + + // Clear the window user data + HWND hwndBrowser = GetDlgItem(hwndDlg, IDC_BROWSER); + SetWindowLong(hwndBrowser, GWL_USERDATA, nsnull); + DestroyWindow(hwndBrowser); + DestroyWindow(hwndDlg); + + --gDialogCount; + if (gDialogCount == 0) + { + if (gProfileSwitch) + { + gProfileSwitch = FALSE; + OpenWebPage(gFirstURL); + } + else + { + // Quit when there are no more browser objects + PostQuitMessage(0); + } + } + return NS_OK; +} + + +// +// FUNCTION: Set the input focus onto the browser window +// +NS_IMETHODIMP +nsQABrowserUIGlue::SetFocus(nsIWebBrowserChrome *chrome) +{ + HWND hwndDlg = GetBrowserDlgFromChrome(chrome); + if (hwndDlg == NULL) + { + return NS_ERROR_FAILURE; + } + + HWND hwndBrowser = GetDlgItem(hwndDlg, IDC_BROWSER); + ::SetFocus(hwndBrowser); + return NS_OK; +} + +// +// FUNCTION: UpdateStatusBarText() +// +// PURPOSE: Set the status bar text. +// +NS_IMETHODIMP +nsQABrowserUIGlue::UpdateStatusBarText(nsIWebBrowserChrome *aChrome, const PRUnichar* aStatusText) +{ + HWND hwndDlg = GetBrowserDlgFromChrome(aChrome); + nsCString status; + if (aStatusText) + status.AssignWithConversion(aStatusText); + SetDlgItemText(hwndDlg, IDC_STATUS, status.get()); + return NS_OK; +} + + +// +// FUNCTION: UpdateCurrentURI() +// +// PURPOSE: Updates the URL address field +// +NS_IMETHODIMP +nsQABrowserUIGlue::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) + { + nsCAutoString uriString; + currentURI->GetAsciiSpec(uriString); + HWND hwndDlg = GetBrowserDlgFromChrome(aChrome); + SetDlgItemText(hwndDlg, IDC_ADDRESS, uriString.get()); + } + return NS_OK; +} + + +// +// FUNCTION: UpdateBusyState() +// +// PURPOSE: Refreshes the stop/go buttons in the browser dialog +// +NS_IMETHODIMP +nsQABrowserUIGlue::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); + return NS_OK; +} + + +// +// FUNCTION: UpdateProgress() +// +// PURPOSE: Refreshes the progress bar in the browser dialog +// +NS_IMETHODIMP +nsQABrowserUIGlue::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); + } + return NS_OK; +} + +// +// FUNCTION: ShowContextMenu() +// +// PURPOSE: Display a context menu for the given node +// +NS_IMETHODIMP +nsQABrowserUIGlue::ShowContextMenu(nsIWebBrowserChrome *aChrome, PRInt32 aContextFlags, nsIDOMEvent *aEvent, nsIDOMNode *aNode) +{ + // TODO code to test context flags and display a popup menu should go here + return NS_OK; +} + +// +// FUNCTION: ShowTooltip() +// +// PURPOSE: Show a tooltip +// +NS_IMETHODIMP +nsQABrowserUIGlue::ShowTooltip(nsIWebBrowserChrome *aChrome, PRInt32 aXCoords, PRInt32 aYCoords, const PRUnichar *aTipText) +{ + // TODO code to show a tooltip should go here + return NS_OK; +} + +// +// FUNCTION: HideTooltip() +// +// PURPOSE: Hide the tooltip +// +NS_IMETHODIMP +nsQABrowserUIGlue::HideTooltip(nsIWebBrowserChrome *aChrome) +{ + // TODO code to hide a tooltip should go here + return NS_OK; +} + +NS_IMETHODIMP +nsQABrowserUIGlue::ShowWindow(nsIWebBrowserChrome *aChrome, PRBool aShow) +{ + HWND win = GetBrowserDlgFromChrome(aChrome); + return ::ShowWindow(win, aShow ? SW_RESTORE : SW_HIDE); +} + +NS_IMETHODIMP +nsQABrowserUIGlue::SizeTo(nsIWebBrowserChrome *aChrome, PRInt32 aWidth, PRInt32 aHeight) +{ + HWND win = GetBrowserDlgFromChrome(aChrome); + RECT winRect; + + ::GetWindowRect(win, &winRect); + return ::MoveWindow(win, winRect.left, winRect.top, aWidth, aHeight, TRUE); +} + +// +// FUNCTION: GetResourceStringByID() +// +// PURPOSE: Get the resource string for the ID +// +NS_IMETHODIMP +nsQABrowserUIGlue::GetResourceStringById(PRInt32 aID, char ** aReturn) +{ + char resBuf[MAX_LOADSTRING]; + int retval = LoadString( ghInstanceResources, aID, (LPTSTR)resBuf, sizeof(resBuf) ); + if (retval != 0) + { + int resLen = strlen(resBuf); + *aReturn = (char *)calloc(resLen+1, sizeof(char *)); + if (!*aReturn) return NS_OK; + PL_strncpy(*aReturn, (char *) resBuf, resLen); + } + return NS_OK; +} + +NS_IMETHODIMP +nsQABrowserUIGlue::SetTitle(const PRUnichar * aTitle) +{ + return NS_OK; +} + +NS_IMETHODIMP +nsQABrowserUIGlue::GetTitle(PRUnichar ** aTitle) +{ + return NS_OK; +} + + +NS_IMETHODIMP +nsQABrowserUIGlue::SetVisibility(PRBool aVisibility) +{ + return NS_OK; +} + + +NS_IMETHODIMP +nsQABrowserUIGlue::GetVisibility(PRBool * aVisibility) +{ + *aVisibility = PR_TRUE; + return NS_OK; +} + + +NS_IMETHODIMP +nsQABrowserUIGlue::SetAllowNewBrowserWindows(PRBool aValue) +{ + mAllowNewWindows = aValue; + return NS_OK; +} + + +NS_IMETHODIMP +nsQABrowserUIGlue::GetAllowNewBrowserWindows(PRBool * aReturn) +{ + if (aReturn) + *aReturn = mAllowNewWindows; + return NS_OK; +} + +NS_IMETHODIMP +nsQABrowserUIGlue::LoadHomePage() +{ + NS_NAMED_LITERAL_CSTRING (url, "http://www.mozilla.org/embedding"); + return LoadURL(url.get()); + +} + +NS_IMETHODIMP +nsQABrowserUIGlue::LoadURL(const char * aURL) +{ + nsresult rv = NS_OK; + // Start loading a page + nsCOMPtr newBrowser; + mBrowserView->GetWebBrowser(getter_AddRefs(newBrowser)); + nsCOMPtr webNav(do_QueryInterface(newBrowser, &rv)); + if (webNav) + return webNav->LoadURI(NS_ConvertASCIItoUCS2(aURL).get(), + nsIWebNavigation::LOAD_FLAGS_NONE, + nsnull, + nsnull, + nsnull); + return rv; +} + + +// +// 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. +// +nativeWindow +nsQABrowserUIGlue::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(ghInstanceResources, + MAKEINTRESOURCE(IDD_BROWSER), + NULL, + BrowserDlgProc); + else + hwndDialog = CreateDialog(ghInstanceResources, + MAKEINTRESOURCE(IDD_BROWSER_NC), + NULL, + BrowserDlgProc); + if (!hwndDialog) + return (void *) nsnull; + + // Stick a menu onto it + if (chromeFlags & nsIWebBrowserChrome::CHROME_MENUBAR) { + HMENU hmenuDlg = LoadMenu(ghInstanceResources, MAKEINTRESOURCE(IDC_MOZEMBED)); + 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); + SetWindowLong(hwndBrowser, GWL_USERDATA, (LONG)chrome); // save the browser LONG_PTR. + SetWindowLong(hwndBrowser, GWL_STYLE, GetWindowLong(hwndBrowser, GWL_STYLE) | WS_CLIPCHILDREN); + + // Activate the window + PostMessage(hwndDialog, WM_ACTIVATE, WA_ACTIVE, 0); + + gDialogCount++; + + return (void *) hwndBrowser; +} \ No newline at end of file diff --git a/mozilla/embedding/qa/mozembed/src/mozEmbed.h b/mozilla/embedding/qa/mozembed/src/mozEmbed.h new file mode 100644 index 00000000000..3981c6e5adb --- /dev/null +++ b/mozilla/embedding/qa/mozembed/src/mozEmbed.h @@ -0,0 +1,39 @@ +/* -*- 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 { + void EnableChromeWindow(nsIWebBrowserChrome *aWindow, PRBool aEnabled); + + PRUint32 RunEventLoop(PRBool &aRunCondition); +} diff --git a/mozilla/embedding/qa/mozembed/src/mozEmbed.rc b/mozilla/embedding/qa/mozembed/src/mozEmbed.rc new file mode 100644 index 00000000000..ffbefdedb2a --- /dev/null +++ b/mozilla/embedding/qa/mozembed/src/mozEmbed.rc @@ -0,0 +1,263 @@ +//Microsoft Developer Studio 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_MOZEMBED ICON DISCARDABLE "winEmbed.ICO" +IDI_SMALL ICON DISCARDABLE "SMALL.ICO" + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDC_MOZEMBED MENU DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + MENUITEM "New Browser...", MOZ_NewBrowser + MENUITEM SEPARATOR + MENUITEM SEPARATOR + MENUITEM "&Save As...", MOZ_Save + 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 +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +2 TEXTINCLUDE DISCARDABLE +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 DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +1 TEXTINCLUDE DISCARDABLE +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 + +#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, 400, 217 +STYLE WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_CLIPCHILDREN | + WS_CAPTION | WS_SYSMENU | WS_THICKFRAME +CAPTION "winEmbed sample - UNSUPPORTED" +MENU IDC_MOZEMBED +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,"MOZEMBED",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 DISCARDABLE 0, 0, 400, 217 +STYLE WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_CLIPCHILDREN | + WS_CAPTION | WS_SYSMENU | WS_THICKFRAME +CAPTION "winEmbed chromeless sample" +MENU IDC_MOZEMBED +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "Embedded Browser",IDC_BROWSER,"MOZEMBED",WS_TABSTOP,0,0, + 400,217 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +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 DISCARDABLE 0, 0, 186, 154 +STYLE 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 DISCARDABLE +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/mozilla/embedding/qa/mozembed/src/nsQABrowserCID.h b/mozilla/embedding/qa/mozembed/src/nsQABrowserCID.h new file mode 100644 index 00000000000..918fc7937f4 --- /dev/null +++ b/mozilla/embedding/qa/mozembed/src/nsQABrowserCID.h @@ -0,0 +1,54 @@ +/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: NPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Netscape Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Radha Kulkarni , Original Author + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the NPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the NPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#define NS_QABROWSERUIGLUE_CONTRACTID "@mozilla.org/qaembed-browseruiglue;1" +#define NS_QABROWSERUIGLUE_CID \ +{0x243e56f6, 0xeaab, 0x469b, \ +{0xba, 0x36, 0xfd, 0xfc, 0xbc, 0xbe, 0x73, 0x77}} + + +#define NS_QABROWSERCHROME_CONTRACTID "@mozilla.org/qaembed-browserchrome;1" +#define NS_QABROWSERCHROME_CID \ +{0xa7ddddd, 0x9bb9, 0x411e, \ +{0xb2, 0x80, 0xab, 0x1b, 0x83, 0x4b, 0x88, 0x80}} + + +#define NS_QABROWSERVIEW_CONTRACTID "@mozilla.org/qaembed-browserview;1" +#define NS_QABROWSERVIEW_CID \ +{0x6f5af858, 0xe5c2, 0x4b5a, \ +{0x9e, 0xf1, 0x9e, 0x19, 0xa3, 0xab, 0x92, 0x18}} diff --git a/mozilla/embedding/qa/mozembed/src/nsQABrowserChrome.cpp b/mozilla/embedding/qa/mozembed/src/nsQABrowserChrome.cpp new file mode 100644 index 00000000000..b3ecd6348ac --- /dev/null +++ b/mozilla/embedding/qa/mozembed/src/nsQABrowserChrome.cpp @@ -0,0 +1,398 @@ +/* ***** 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): Radha Kulkarni (radha@netscape.com) + * + * ***** 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 "nsIDOMWindowInternal.h" +#include "nsIInterfaceRequestor.h" +#include "nsIInterfaceRequestorUtils.h" +#include "nsIRequest.h" +#include "nsIChannel.h" +#include "nsCWebBrowser.h" +#include "nsWidgetsCID.h" +#include "nsIProfileChangeStatus.h" +#include "nsCRT.h" +#include "nsWeakReference.h" + +// Local includes +#include "resource.h" +#include "mozEmbed.h" +#include "nsQABrowserChrome.h" + + +nsQABrowserChrome::nsQABrowserChrome() +{ + NS_INIT_REFCNT(); + mNativeWindow = nsnull; + mSizeSet = PR_FALSE; +} + +nsQABrowserChrome::~nsQABrowserChrome() +{ + if (mBrowserUIGlue) + mBrowserUIGlue->Destroyed(this); +} + + +//***************************************************************************** +// nsQABrowserChrome::nsISupports +//***************************************************************************** + + +NS_IMPL_ISUPPORTS7(nsQABrowserChrome, + nsIQABrowserChrome, + nsIWebBrowserChrome, + nsIInterfaceRequestor, + nsIEmbeddingSiteWindow, + nsIWebProgressListener, + nsIWebBrowserChromeFocus, + nsISupportsWeakReference); + + + +//***************************************************************************** +// nsQABrowserChrome::nsIInterfaceRequestor +//***************************************************************************** + +NS_IMETHODIMP nsQABrowserChrome::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); +} + +//***************************************************************************** +// nsQABrowserChrome::nsIQABrowserChrome +//***************************************************************************** + +NS_IMETHODIMP +nsQABrowserChrome::InitQAChrome(nsIQABrowserUIGlue * aUIGlue, nativeWindow aNativeWnd) +{ + mBrowserUIGlue = aUIGlue; + mNativeWindow = aNativeWnd; + + return NS_OK; +} + +//***************************************************************************** +// nsQABrowserChrome::nsIQABrowserChrome +//***************************************************************************** + +NS_IMETHODIMP nsQABrowserChrome::SetStatus(PRUint32 aType, const PRUnichar* aStatus) +{ + if (mBrowserUIGlue) + return mBrowserUIGlue->UpdateStatusBarText(this, aStatus); + return NS_ERROR_FAILURE; +} + +NS_IMETHODIMP nsQABrowserChrome::GetWebBrowser(nsIWebBrowser** aWebBrowser) +{ + NS_ENSURE_ARG_POINTER(aWebBrowser); + *aWebBrowser = mWebBrowser; + NS_IF_ADDREF(*aWebBrowser); + return NS_OK; +} + +NS_IMETHODIMP nsQABrowserChrome::SetWebBrowser(nsIWebBrowser* aWebBrowser) +{ + mWebBrowser = aWebBrowser; + return NS_OK; +} + +NS_IMETHODIMP nsQABrowserChrome::GetChromeFlags(PRUint32* aChromeMask) +{ + if (aChromeMask) + *aChromeMask = mChromeFlags; + return NS_OK; +} + +NS_IMETHODIMP nsQABrowserChrome::SetChromeFlags(PRUint32 aChromeMask) +{ + mChromeFlags = aChromeMask; + return NS_OK; +} + +NS_IMETHODIMP nsQABrowserChrome::DestroyBrowserWindow(void) +{ + if (mBrowserUIGlue) + return mBrowserUIGlue->Destroy(this); + return NS_ERROR_FAILURE; +} + + +NS_IMETHODIMP nsQABrowserChrome::SizeBrowserTo(PRInt32 aCX, PRInt32 aCY) +{ + /* 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 mozEmbed's purposes. + */ + mSizeSet = PR_TRUE; + if (mBrowserUIGlue) + return mBrowserUIGlue->SizeTo(this, aCX, aCY); + return NS_ERROR_FAILURE; +} + + +NS_IMETHODIMP nsQABrowserChrome::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 nsQABrowserChrome::IsWindowModal(PRBool *aReturn) +{ + if (aReturn) + *aReturn = PR_FALSE; + return NS_OK; +} + +NS_IMETHODIMP nsQABrowserChrome::ExitModalEventLoop(nsresult aStatus) +{ + mContinueModalLoop = PR_FALSE; + return NS_OK; +} + +//***************************************************************************** +// nsQABrowserChrome::nsIEmbeddingSiteWindow +//***************************************************************************** + +NS_IMETHODIMP nsQABrowserChrome::SetDimensions(PRUint32 aFlags, PRInt32 x, PRInt32 y, PRInt32 cx, PRInt32 cy) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP nsQABrowserChrome::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 nsQABrowserChrome::SetFocus() +{ + if (mBrowserUIGlue) + return mBrowserUIGlue->SetFocus(this); + return NS_ERROR_FAILURE; +} + +/* attribute wstring title; */ +NS_IMETHODIMP nsQABrowserChrome::GetTitle(PRUnichar * *aTitle) +{ + NS_ENSURE_ARG_POINTER(aTitle); + *aTitle = nsnull; + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP nsQABrowserChrome::SetTitle(const PRUnichar * aTitle) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* attribute boolean visibility; */ +NS_IMETHODIMP nsQABrowserChrome::GetVisibility(PRBool * aVisibility) +{ + NS_ENSURE_ARG_POINTER(aVisibility); + *aVisibility = PR_TRUE; + return NS_OK; +} +NS_IMETHODIMP nsQABrowserChrome::SetVisibility(PRBool aVisibility) +{ + return NS_OK; +} + +/* attribute nativeSiteWindow siteWindow */ +NS_IMETHODIMP nsQABrowserChrome::GetSiteWindow(void * *aSiteWindow) +{ + NS_ENSURE_ARG_POINTER(aSiteWindow); + *aSiteWindow = mNativeWindow; + return NS_OK; +} + + +//***************************************************************************** +// nsQABrowserChrome::nsIWebProgressListener +//***************************************************************************** +NS_IMETHODIMP +nsQABrowserChrome::OnProgressChange(nsIWebProgress *progress, nsIRequest *request, + PRInt32 curSelfProgress, PRInt32 maxSelfProgress, + PRInt32 curTotalProgress, PRInt32 maxTotalProgress) +{ + if (mBrowserUIGlue) + return mBrowserUIGlue->UpdateProgress(this, curTotalProgress, maxTotalProgress); + return NS_OK; +} + +NS_IMETHODIMP +nsQABrowserChrome::OnStateChange(nsIWebProgress *progress, nsIRequest *request, + PRUint32 progressStateFlags, nsresult status) +{ + if (!mBrowserUIGlue) + return NS_ERROR_FAILURE; + + if ((progressStateFlags & STATE_START) && (progressStateFlags & STATE_IS_DOCUMENT)) + { + mBrowserUIGlue->UpdateBusyState(this, PR_TRUE); + } + + if ((progressStateFlags & STATE_STOP) && (progressStateFlags & STATE_IS_DOCUMENT)) + { + mBrowserUIGlue->UpdateBusyState(this, PR_FALSE); + mBrowserUIGlue->UpdateProgress(this, 0, 100); + mBrowserUIGlue->UpdateStatusBarText(this, nsnull); + ContentFinishedLoading(); + } + + return NS_OK; +} + + +NS_IMETHODIMP +nsQABrowserChrome::OnLocationChange(nsIWebProgress* aWebProgress, + nsIRequest* aRequest, + nsIURI *location) +{ + if (!mBrowserUIGlue) + return NS_ERROR_FAILURE; + + 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) + mBrowserUIGlue->UpdateCurrentURI(this); + return NS_OK; +} + +NS_IMETHODIMP +nsQABrowserChrome::OnStatusChange(nsIWebProgress* aWebProgress, + nsIRequest* aRequest, + nsresult aStatus, + const PRUnichar* aMessage) +{ + if (mBrowserUIGlue) + return mBrowserUIGlue->UpdateStatusBarText(this, aMessage); + return NS_OK; +} + + + +NS_IMETHODIMP +nsQABrowserChrome::OnSecurityChange(nsIWebProgress *aWebProgress, + nsIRequest *aRequest, + PRUint32 state) +{ + return NS_OK; +} +//***************************************************************************** +// nsQABrowserChrome::nsInsQABrowserChromeFocus +//***************************************************************************** + +NS_IMETHODIMP +nsQABrowserChrome::FocusNextElement() +{ + return NS_OK; +} + +NS_IMETHODIMP +nsQABrowserChrome::FocusPrevElement() +{ + return NS_OK; +} + + + +void +nsQABrowserChrome::ContentFinishedLoading() +{ + // if it was a chrome window and no one has already specified a size, + // size to content + if (mWebBrowser && !mSizeSet && mBrowserUIGlue && + (mChromeFlags & nsIWebBrowserChrome::CHROME_OPENAS_CHROME)) { + nsCOMPtr contentWin; + mWebBrowser->GetContentDOMWindow(getter_AddRefs(contentWin)); + if (contentWin) + contentWin->SizeToContent(); + mBrowserUIGlue->ShowWindow(this, PR_TRUE); + } +} + + + + + + + + + + + + + diff --git a/mozilla/embedding/qa/mozembed/src/nsQABrowserChrome.h b/mozilla/embedding/qa/mozembed/src/nsQABrowserChrome.h new file mode 100644 index 00000000000..e515e7de1b8 --- /dev/null +++ b/mozilla/embedding/qa/mozembed/src/nsQABrowserChrome.h @@ -0,0 +1,97 @@ +/* ***** 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 __nsQABrowserChrome__ +#define __nsQABrowserChrome__ + +#include "nsCOMPtr.h" +#include "nsIGenericFactory.h" +#include "nsString.h" +#include "nsIWebBrowserChrome.h" +#include "nsIQABrowserChrome.h" +#include "nsIDocShell.h" +#include "nsIBaseWindow.h" +#include "nsIEmbeddingSiteWindow.h" +#include "nsIWebNavigation.h" +#include "nsIWebBrowser.h" +#include "nsWeakReference.h" +#include "nsIWeakReference.h" +#include "nsIQABrowserView.h" +#include "nsIQABrowserUIGlue.h" +#include "nsIWebProgressListener.h" +#include "nsIWebBrowserChromeFocus.h" + +/* +#include "nsIContentViewer.h" +#include "nsIContentViewerFile.h" + +#include "nsIInterfaceRequestor.h" +#include "nsIInterfaceRequestorUtils.h" +#include "nsIObserver.h" +#include "nsISHistoryListener.h" +#include "nsIContextMenuListener.h" +#include "nsITooltipListener.h" +*/ + +class nsQABrowserChrome : public nsIWebBrowserChrome, + public nsIEmbeddingSiteWindow, + public nsIInterfaceRequestor, + public nsIQABrowserChrome, + public nsSupportsWeakReference, + public nsIWebProgressListener, + public nsIWebBrowserChromeFocus +{ +public: + nsQABrowserChrome(); + virtual ~nsQABrowserChrome(); + + NS_DECL_ISUPPORTS + NS_DECL_NSIWEBBROWSERCHROME + NS_DECL_NSIQABROWSERCHROME + NS_DECL_NSIINTERFACEREQUESTOR + NS_DECL_NSIEMBEDDINGSITEWINDOW + NS_DECL_NSIWEBBROWSERCHROMEFOCUS + NS_DECL_NSIWEBPROGRESSLISTENER + +protected: + + void ContentFinishedLoading(); + + nativeWindow mNativeWindow; + PRUint32 mChromeFlags; + PRBool mContinueModalLoop; + PRBool mSizeSet; + + nsCOMPtr mWebBrowser; + nsCOMPtr mBrowserUIGlue; + nsCOMPtr mDependentParent; // opener (for dependent windows only) + +}; + +#endif /* __nsQABrowserChrome__ */ diff --git a/mozilla/embedding/qa/mozembed/src/nsQABrowserModule.cpp b/mozilla/embedding/qa/mozembed/src/nsQABrowserModule.cpp new file mode 100644 index 00000000000..d2eb4521b85 --- /dev/null +++ b/mozilla/embedding/qa/mozembed/src/nsQABrowserModule.cpp @@ -0,0 +1,199 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: NPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Netscape Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): Radha Kulkarni (radha@netscape.com) + * + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the NPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the NPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsIModule.h" +#include "nsIGenericFactory.h" +#include "nsIComponentManager.h" +#include "nsIServiceManager.h" +#include "nsIComponentRegistrar.h" + +#include "nsQABrowserCID.h" +#include "nsQABrowserView.h" +#include "nsQABrowserUIGlue.h" +#include "nsQABrowserChrome.h" + +// Factory Constructors + +NS_GENERIC_FACTORY_CONSTRUCTOR(nsQABrowserView) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsQABrowserUIGlue) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsQABrowserChrome) + +// Component Table + + + +static NS_DEFINE_CID(kBrowserViewCID, NS_QABROWSERVIEW_CID); +static NS_DEFINE_CID(kBrowserUIGlueCID, NS_QABROWSERUIGLUE_CID); +static NS_DEFINE_CID(kBrowserChromeCID, NS_QABROWSERCHROME_CID); +static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID); + +static const nsModuleComponentInfo gQAEmbeddingModuleViewInfo[] = +{ + { "QA_BrowserView Component", NS_QABROWSERVIEW_CID, + NS_QABROWSERVIEW_CONTRACTID, nsQABrowserViewConstructor } +}; + +static const nsModuleComponentInfo gQAEmbeddingModuleUIInfo[] = +{ + { "QA_BrowserUIGlue Component", NS_QABROWSERUIGLUE_CID, + NS_QABROWSERUIGLUE_CONTRACTID, nsQABrowserUIGlueConstructor } +}; + +static const nsModuleComponentInfo gQAEmbeddingModuleChromeInfo[] = +{ + { "QA_BrowserChrome Component", NS_QABROWSERCHROME_CID, + NS_QABROWSERCHROME_CONTRACTID, nsQABrowserChromeConstructor } +}; + +nsresult +RegisterComponents() +{ + + nsresult rv=NS_OK; + nsIGenericFactory* fact; + + // Register the factory for all supporting interfaces. + nsCOMPtr compMgr = do_GetService(kComponentManagerCID, &rv); + if (NS_FAILED(rv)) return rv; + nsCOMPtr registrar(do_QueryInterface(compMgr)); + + // Register nsQABrowserView + rv = NS_NewGenericFactory(&fact, gQAEmbeddingModuleViewInfo); + rv = registrar->RegisterFactory(kBrowserViewCID, + "QA Embedding BrowserView", + NS_QABROWSERVIEW_CONTRACTID, + fact); + NS_RELEASE(fact); + + //Register nsQABrowserUIGlue + rv = NS_NewGenericFactory(&fact, gQAEmbeddingModuleUIInfo); + + rv = registrar->RegisterFactory(kBrowserUIGlueCID, + "QA Embedding BrowserUIGlue", + NS_QABROWSERUIGLUE_CONTRACTID, + fact); + NS_RELEASE(fact); + + //Register nsQABrowserChrome + rv = NS_NewGenericFactory(&fact, gQAEmbeddingModuleChromeInfo); + + rv = registrar->RegisterFactory(kBrowserChromeCID, + "QA Embedding BrowserChrome", + NS_QABROWSERCHROME_CONTRACTID, + fact); + NS_RELEASE(fact); + return rv; + +} + + + + +#if 0 +nsresult +NSRegisterSelf(nsISupports* aServMgr, const char* aPath) +{ + nsresult rv; + nsCOMPtr compMgr = + do_GetService(kComponentManagerCID, aServMgr, &rv); + if (NS_FAILED(rv)) return rv; + + rv = compMgr->RegisterComponent(kBrowserViewCID, + "QA Embedding BrowserView", + NS_QABROWSERVIEW_CONTRACTID, + aPath, PR_TRUE, PR_TRUE); + rv = compMgr->RegisterComponent(kBrowserUIGlueCID, + "QA Embedding BrowserUIGlue", + NS_QABROWSERUIGLUE_CONTRACTID, + aPath, PR_TRUE, PR_TRUE); + + return rv; + +} + +nsresult +NSUnregisterSelf(nsISupports* aServMgr, const char* aPath) +{ + nsresult rv; + nsCOMPtr compMgr = + do_GetService(kComponentManagerCID, aServMgr, &rv); + if (NS_FAILED(rv)) return rv; + + //rv = compMgr->UnregisterComponent(kRDFDataSourceCID, aPath); + + rv = compMgr->UnregisterComponent(kBrowserViewCID, aPath); + rv = compMgr->UnregisterComponent(kBrowserUIGlueCID, aPath); + + return rv; +} +#endif /* 0 */ + + + +// NSGetModule implementation. + + +#if 0 + +NS_IMPL_NSGETMODULE(Mozilla_Embedding_Component, gQAEmbeddingModuleInfo) + +nsresult +NSGetFactory(nsISupports* aServMgr, + const nsCID &aClass, + const char* aClassName, + const char* aContractID, + nsIFactory **aFactory) +{ + nsresult rv=NS_OK; + nsIGenericFactory* fact; + // if (aClass.Equals(kBrowserViewCID)) + rv = NS_NewGenericFactory(&fact, gQAEmbeddingModuleInfo); + // else if (aClass.Equals(kBrowserUIGlueCID)) + // rv = NS_NewGenericFactory(&fact, NS_NewQABrowserUIGlueFactory); + // rv = NS_ERROR_FAILURE; + + if (NS_SUCCEEDED(rv)) + *aFactory = fact; + +#ifdef DEBUG_radha + printf("nsQABrowserComponent NSGetFactory!\n"); +#endif + return rv; +} + +#endif \ No newline at end of file diff --git a/mozilla/embedding/qa/mozembed/src/nsQABrowserUIGlue.h b/mozilla/embedding/qa/mozembed/src/nsQABrowserUIGlue.h new file mode 100644 index 00000000000..158cb597646 --- /dev/null +++ b/mozilla/embedding/qa/mozembed/src/nsQABrowserUIGlue.h @@ -0,0 +1,76 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: NPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Netscape Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): Radha Kulkarni (radha@netscape.com) + * + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the NPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the NPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/** + * nsQABrowserView is an XPCOM component that creates a nsIWebBrowser + * object and supports testing of nsIWebBrowser and other related embedding + * interfaces with in mozilla. All the embedding examples that currently + * use nsIWebBrowser like MFCEmbed, gtkEmbed are platform specific. This object + * on the other hand provides a XP implementation and can be used as a + * reference implementation for QA purposes with in mozilla. + */ +#ifndef nsQABrowserUIGlue_h_ +#define nsQABrowserUIGlue_h_ + +#include "nsISupports.h" +#include "nsIQABrowserUIGlue.h" +#include "nsIQABrowserChrome.h" +#include "nsIQABrowserView.h" + + +extern nsresult NS_NewQABrowserUIGlueFactory(nsISupports *, const nsIID& iid, void ** result); + +class nsQABrowserUIGlue : public nsIQABrowserUIGlue +{ +public: + nsQABrowserUIGlue(); + + NS_DECL_ISUPPORTS + NS_DECL_NSIQABROWSERUIGLUE + +protected: + virtual ~nsQABrowserUIGlue(); + nativeWindow CreateNativeWindow(nsIWebBrowserChrome * aChrome); + +private: + PRBool mAllowNewWindows; + nsCOMPtr mBrowserView; +}; + + +#endif //nsQABrowserUIGlue_h_ \ No newline at end of file diff --git a/mozilla/embedding/qa/mozembed/src/nsQABrowserView.cpp b/mozilla/embedding/qa/mozembed/src/nsQABrowserView.cpp new file mode 100644 index 00000000000..7a0c13fe870 --- /dev/null +++ b/mozilla/embedding/qa/mozembed/src/nsQABrowserView.cpp @@ -0,0 +1,172 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: NPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Netscape Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): Radha Kulkarni (radha@netscape.com) + * + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the NPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the NPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +//locals +#include "nsQABrowserView.h" +#include "nsIQABrowserView.h" +#include "nsIInterfaceRequestor.h" + +//essentials +#include "nsIComponentManager.h" + + +//Interfaces Needed +#include "nsCWebBrowser.h" +#include "nsIDocShellTreeItem.h" +#include "nsIWebProgressListener.h" +#include "nsIWebBrowserChrome.h" +#include "nsWeakPtr.h" +#include "nsWeakReference.h" + + +nsQABrowserView::nsQABrowserView():mWebBrowser(nsnull) +{ + NS_INIT_REFCNT(); + mWebBrowser = nsnull; + mWebNav = nsnull; + mBaseWindow = nsnull; +} + +nsQABrowserView::~nsQABrowserView() +{ +} + +//***************************************************************************** +// nsQABrowserView::nsISupports +//***************************************************************************** + +NS_IMPL_ISUPPORTS2(nsQABrowserView, nsIQABrowserView, nsIInterfaceRequestor); + +//***************************************************************************** +// nsQABrowserView::nsIInterfacerequestor +//***************************************************************************** + +NS_IMETHODIMP +nsQABrowserView::GetInterface(const nsIID& aIID, void ** aSink) +{ + NS_ENSURE_ARG_POINTER(aSink); + printf("In nsQABrowserView::GetInterface\n"); + if (NS_SUCCEEDED(QueryInterface(aIID, aSink))) + return NS_OK; + + if (mWebBrowser) { + printf("nsQABrowserView::GetInterface, Got mWebBrowser\n"); + nsCOMPtr ifcReq(do_QueryInterface(mWebBrowser)); + if (ifcReq) + return ifcReq->GetInterface(aIID, aSink); + } + + return NS_NOINTERFACE; + +} + + +NS_IMETHODIMP +nsQABrowserView::CreateBrowser(nativeWindow aNativeWnd, nsIWebBrowserChrome * aChrome) +{ + + nsresult rv; + mWebBrowser = do_CreateInstance(NS_WEBBROWSER_CONTRACTID, &rv); + if (NS_FAILED(rv) || !mWebBrowser) + return NS_ERROR_FAILURE; + + mWebNav = do_QueryInterface(mWebBrowser, &rv); + if(NS_FAILED(rv)) + return rv; + + // Set the chrome object the container window. + mWebBrowser->SetContainerWindow(aChrome); + if(NS_FAILED(rv)) + return rv; + + rv = NS_OK; + nsCOMPtr dsti = do_QueryInterface(mWebBrowser, &rv); + if(NS_FAILED(rv)) + return rv; + + // If the browser window hosting chrome or content? + dsti->SetItemType(nsIDocShellTreeItem::typeContentWrapper); + + // Create the real webbrowser window + mBaseWindow = do_QueryInterface(mWebBrowser, &rv); + if(NS_FAILED(rv)) + return rv; + + // Create the actual window + rv = mBaseWindow->InitWindow(aNativeWnd, nsnull, 0, 0, -1, -1); + rv = mBaseWindow->Create(); + + // set a handle to nsIWebBrowser in nsQAWebBrowserChrome + aChrome->SetWebBrowser(mWebBrowser); + + // Register the QABrowserChrome object to receive progress messages + // These callbacks will be used to update the status/progress bars + nsWeakPtr weakling(dont_AddRef(NS_GetWeakReference(aChrome))); + (void)mWebBrowser->AddWebBrowserListener(weakling, NS_GET_IID(nsIWebProgressListener)); + + // Finally, show the web browser window + mBaseWindow->SetVisibility(PR_TRUE); + + return NS_OK; +} + +// XXX Not needed +NS_IMETHODIMP +nsQABrowserView::DestroyBrowser() +{ + // destroy the actual window. + mBaseWindow->Destroy(); + mWebBrowser = nsnull; + mWebNav = nsnull; + return NS_OK; +} + + + +// Get a handle to the nsIWebBrowser object. +NS_IMETHODIMP +nsQABrowserView::GetWebBrowser(nsIWebBrowser ** aWebBrowser) +{ + if (!mWebBrowser || !(aWebBrowser)) + return NS_ERROR_FAILURE; + + *aWebBrowser = mWebBrowser; + NS_ADDREF(*aWebBrowser); + return NS_OK; +} + diff --git a/mozilla/embedding/qa/mozembed/src/nsQABrowserView.h b/mozilla/embedding/qa/mozembed/src/nsQABrowserView.h new file mode 100644 index 00000000000..293e0a6b4b5 --- /dev/null +++ b/mozilla/embedding/qa/mozembed/src/nsQABrowserView.h @@ -0,0 +1,83 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: NPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Netscape Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): Radha Kulkarni (radha@netscape.com) + * + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the NPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the NPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/** + * nsQABrowserView is an XPCOM component that creates a nsIWebBrowser + * object and supports testing of nsIWebBrowser and other related embedding + * interfaces with in mozilla. All the embedding examples that currently + * use nsIWebBrowser like MFCEmbed, gtkEmbed are platform specific. This object + * on the other hand provides a XP implementation and can be used as a + * reference implementation for QA purposes with in mozilla. + */ +#ifndef nsQABrowserView_h_ +#define nsQABrowserView_h_ + +#include "nsCOMPtr.h" +#include "nsISupports.h" +#include "nsIInterfaceRequestor.h" +#include "nsIQABrowserView.h" +#include "nsQABrowserCID.h" +#include "nsIQABrowserChrome.h" + +#include "nsIWebNavigation.h" +#include "nsIBaseWindow.h" +#include "nsIWebBrowser.h" + +//extern nsresult NS_NewQABrowserViewFactory(nsISupports *, const nsIID& iid, void ** result); + +class nsQABrowserView : public nsIInterfaceRequestor, + public nsIQABrowserView +{ +public: + nsQABrowserView(); + + NS_DECL_ISUPPORTS + NS_DECL_NSIINTERFACEREQUESTOR + NS_DECL_NSIQABROWSERVIEW + +protected: + virtual ~nsQABrowserView(); + +private: + nsCOMPtr mWebBrowser; + nsCOMPtr mWebNav; + nsCOMPtr mBaseWindow; +}; + + +#endif //nsQABrowserView_h_ \ No newline at end of file diff --git a/mozilla/embedding/qa/mozembed/src/nsQAWindowCreator.cpp b/mozilla/embedding/qa/mozembed/src/nsQAWindowCreator.cpp new file mode 100644 index 00000000000..d86da057921 --- /dev/null +++ b/mozilla/embedding/qa/mozembed/src/nsQAWindowCreator.cpp @@ -0,0 +1,61 @@ +/* -*- 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 "nsCOMPtr.h" +#include "nsIServiceManagerUtils.h" +#include "nsIWebBrowserChrome.h" +#include "nsQAWindowCreator.h" +#include "nsIQABrowserUIGlue.h" +#include "nsQABrowserCID.h" + +WindowCreator::WindowCreator() +{ + NS_INIT_REFCNT(); +} + +WindowCreator::~WindowCreator() +{ +} + +NS_IMPL_ISUPPORTS1(WindowCreator, nsIWindowCreator) + +NS_IMETHODIMP +WindowCreator::CreateChromeWindow(nsIWebBrowserChrome *parent, + PRUint32 chromeFlags, + nsIWebBrowserChrome **_retval) +{ + NS_ENSURE_ARG_POINTER(_retval); + nsresult rv; + nsCOMPtr glue(do_CreateInstance(NS_QABROWSERUIGLUE_CONTRACTID, &rv)); + if (glue) + glue->CreateNewBrowserWindow(PRInt32(chromeFlags), parent, _retval); + //AppCallbacks::CreateBrowserWindow(PRInt32(chromeFlags), parent, _retval); + return *_retval ? NS_OK : NS_ERROR_FAILURE; +} diff --git a/mozilla/embedding/qa/mozembed/src/nsQAWindowCreator.h b/mozilla/embedding/qa/mozembed/src/nsQAWindowCreator.h new file mode 100644 index 00000000000..d2c78e0cd9c --- /dev/null +++ b/mozilla/embedding/qa/mozembed/src/nsQAWindowCreator.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/mozilla/embedding/qa/mozembed/src/resource.h b/mozilla/embedding/qa/mozembed/src/resource.h new file mode 100644 index 00000000000..d84f5645451 --- /dev/null +++ b/mozilla/embedding/qa/mozembed/src/resource.h @@ -0,0 +1,71 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by mozEmbed.rc +// +#define IDC_MYICON 2 +#define IDD_MOZEMBED_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_MOZEMBED 107 +#define IDS_ABOUT 107 +#define IDI_SMALL 108 +#define IDS_ABOUT_TITLE 108 +#define IDC_MOZEMBED 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_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 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