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
This commit is contained in:
73
mozilla/embedding/qa/mozembed/src/Makefile.in
Normal file
73
mozilla/embedding/qa/mozembed/src/Makefile.in
Normal file
@@ -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
|
||||
BIN
mozilla/embedding/qa/mozembed/src/SMALL.ICO
Normal file
BIN
mozilla/embedding/qa/mozembed/src/SMALL.ICO
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 318 B |
37
mozilla/embedding/qa/mozembed/src/StdAfx.cpp
Normal file
37
mozilla/embedding/qa/mozembed/src/StdAfx.cpp
Normal file
@@ -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
|
||||
61
mozilla/embedding/qa/mozembed/src/StdAfx.h
Normal file
61
mozilla/embedding/qa/mozembed/src/StdAfx.h
Normal file
@@ -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 <windows.h>
|
||||
|
||||
// C RunTime Header Files
|
||||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
#include <memory.h>
|
||||
#include <tchar.h>
|
||||
|
||||
// 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_)
|
||||
101
mozilla/embedding/qa/mozembed/src/makefile.win
Normal file
101
mozilla/embedding/qa/mozembed/src/makefile.win
Normal file
@@ -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
|
||||
|
||||
BIN
mozilla/embedding/qa/mozembed/src/mozEmbed.ICO
Normal file
BIN
mozilla/embedding/qa/mozembed/src/mozEmbed.ICO
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
1496
mozilla/embedding/qa/mozembed/src/mozEmbed.cpp
Normal file
1496
mozilla/embedding/qa/mozembed/src/mozEmbed.cpp
Normal file
File diff suppressed because it is too large
Load Diff
39
mozilla/embedding/qa/mozembed/src/mozEmbed.h
Normal file
39
mozilla/embedding/qa/mozembed/src/mozEmbed.h
Normal file
@@ -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);
|
||||
}
|
||||
263
mozilla/embedding/qa/mozembed/src/mozEmbed.rc
Normal file
263
mozilla/embedding/qa/mozembed/src/mozEmbed.rc
Normal file
@@ -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
|
||||
|
||||
54
mozilla/embedding/qa/mozembed/src/nsQABrowserCID.h
Normal file
54
mozilla/embedding/qa/mozembed/src/nsQABrowserCID.h
Normal file
@@ -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 <radha@netscape.com>, 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}}
|
||||
398
mozilla/embedding/qa/mozembed/src/nsQABrowserChrome.cpp
Normal file
398
mozilla/embedding/qa/mozembed/src/nsQABrowserChrome.cpp
Normal file
@@ -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<nsIDOMWindow> domWindow;
|
||||
nsCOMPtr<nsIDOMWindow> topDomWindow;
|
||||
aWebProgress->GetDOMWindow(getter_AddRefs(domWindow));
|
||||
if (domWindow) { // Get root domWindow
|
||||
domWindow->GetTop(getter_AddRefs(topDomWindow));
|
||||
}
|
||||
if (domWindow != topDomWindow)
|
||||
isSubFrameLoad = PR_TRUE;
|
||||
}
|
||||
if (!isSubFrameLoad)
|
||||
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<nsIDOMWindow> contentWin;
|
||||
mWebBrowser->GetContentDOMWindow(getter_AddRefs(contentWin));
|
||||
if (contentWin)
|
||||
contentWin->SizeToContent();
|
||||
mBrowserUIGlue->ShowWindow(this, PR_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
97
mozilla/embedding/qa/mozembed/src/nsQABrowserChrome.h
Normal file
97
mozilla/embedding/qa/mozembed/src/nsQABrowserChrome.h
Normal file
@@ -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<nsIWebBrowser> mWebBrowser;
|
||||
nsCOMPtr<nsIQABrowserUIGlue> mBrowserUIGlue;
|
||||
nsCOMPtr<nsIWebBrowserChrome> mDependentParent; // opener (for dependent windows only)
|
||||
|
||||
};
|
||||
|
||||
#endif /* __nsQABrowserChrome__ */
|
||||
199
mozilla/embedding/qa/mozembed/src/nsQABrowserModule.cpp
Normal file
199
mozilla/embedding/qa/mozembed/src/nsQABrowserModule.cpp
Normal file
@@ -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<nsIComponentManager> compMgr = do_GetService(kComponentManagerCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsCOMPtr<nsIComponentRegistrar> 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<nsIComponentManagerObsolete> 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<nsIComponentManagerObsolete> 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
|
||||
76
mozilla/embedding/qa/mozembed/src/nsQABrowserUIGlue.h
Normal file
76
mozilla/embedding/qa/mozembed/src/nsQABrowserUIGlue.h
Normal file
@@ -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<nsIQABrowserView> mBrowserView;
|
||||
};
|
||||
|
||||
|
||||
#endif //nsQABrowserUIGlue_h_
|
||||
172
mozilla/embedding/qa/mozembed/src/nsQABrowserView.cpp
Normal file
172
mozilla/embedding/qa/mozembed/src/nsQABrowserView.cpp
Normal file
@@ -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<nsIInterfaceRequestor> 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<nsIDocShellTreeItem> 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;
|
||||
}
|
||||
|
||||
83
mozilla/embedding/qa/mozembed/src/nsQABrowserView.h
Normal file
83
mozilla/embedding/qa/mozembed/src/nsQABrowserView.h
Normal file
@@ -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<nsIWebBrowser> mWebBrowser;
|
||||
nsCOMPtr<nsIWebNavigation> mWebNav;
|
||||
nsCOMPtr<nsIBaseWindow> mBaseWindow;
|
||||
};
|
||||
|
||||
|
||||
#endif //nsQABrowserView_h_
|
||||
61
mozilla/embedding/qa/mozembed/src/nsQAWindowCreator.cpp
Normal file
61
mozilla/embedding/qa/mozembed/src/nsQAWindowCreator.cpp
Normal file
@@ -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<nsIQABrowserUIGlue> 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;
|
||||
}
|
||||
48
mozilla/embedding/qa/mozembed/src/nsQAWindowCreator.h
Normal file
48
mozilla/embedding/qa/mozembed/src/nsQAWindowCreator.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: Mozilla-sample-code 1.0
|
||||
*
|
||||
* Copyright (c) 2002 Netscape Communications Corporation and
|
||||
* other contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this Mozilla sample software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
* persons to whom the Software is furnished to do so, subject to the
|
||||
* following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef __WindowCreator_h_
|
||||
#define __WindowCreator_h_
|
||||
|
||||
#include "nsIWindowCreator.h"
|
||||
|
||||
class WindowCreator :
|
||||
public nsIWindowCreator
|
||||
{
|
||||
public:
|
||||
WindowCreator();
|
||||
virtual ~WindowCreator();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIWINDOWCREATOR
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
71
mozilla/embedding/qa/mozembed/src/resource.h
Normal file
71
mozilla/embedding/qa/mozembed/src/resource.h
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user