Bug 201308 [Webclient] support nsIWindowCreator::CreateChromeWindow

r=edburns
This commit is contained in:
kyle.yuan%sun.com 2003-04-24 05:55:22 +00:00
parent d0b580c34a
commit c51f266635
16 changed files with 635 additions and 291 deletions

View File

@ -0,0 +1,38 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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 RaptorCanvas.
*
* The Initial Developer of the Original Code is Kirk Baker and
* Ian Wilkinson. Portions created by Kirk Baker and Ian Wilkinson are
* Copyright (C) 1999 Kirk Baker and Ian Wilkinson. All
* Rights Reserved.
*
* Contributor(s): Kyle Yuan <kyle.yuan@sun.com>
*/
package org.mozilla.webclient;
public class NewWindowEvent extends WebclientEvent
{
//
// Constructors
//
public NewWindowEvent(Object source, long newType,
Object newEventData)
{
super(source, newType, newEventData);
}
} // end of class NewWindowEvent

View File

@ -0,0 +1,71 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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 RaptorCanvas.
*
* The Initial Developer of the Original Code is Kirk Baker and
* Ian Wilkinson. Portions created by Kirk Baker and Ian Wilkinson are
* Copyright (C) 1999 Kirk Baker and Ian Wilkinson. All
* Rights Reserved.
*
* Contributor(s): Kyle Yuan <kyle.yuan@sun.com>
*/
package org.mozilla.webclient;
public interface NewWindowListener extends WebclientEventListener {
public static final long CHROME_DEFAULT = 1;
public static final long CHROME_WINDOW_BORDERS = 1 << 1;
/* Specifies whether the window can be closed. */
public static final long CHROME_WINDOW_CLOSE = 1 << 2;
/* Specifies whether the window is resizable. */
public static final long CHROME_WINDOW_RESIZE = 1 << 3;
/* Specifies whether to display the menu bar. */
public static final long CHROME_MENUBAR = 1 << 4;
/* Specifies whether to display the browser toolbar, making buttons such as Back, Forward, and Stop available. */
public static final long CHROME_TOOLBAR = 1 << 5;
/* Specifies whether to display the input field for entering URLs directly into the browser. */
public static final long CHROME_LOCATIONBAR = 1 << 6;
/* Specifies whether to add a status bar at the bottom of the window. */
public static final long CHROME_STATUSBAR = 1 << 7;
/* Specifies whether to display the personal bar. (Mozilla only) */
public static final long CHROME_PERSONAL_TOOLBAR = 1 << 8;
/* Specifies whether to display horizontal and vertical scroll bars. */
public static final long CHROME_SCROLLBARS = 1 << 9;
/* Specifies whether to display a title bar for the window. */
public static final long CHROME_TITLEBAR = 1 << 10;
public static final long CHROME_EXTRA = 1 << 11;
public static final long CHROME_WITH_SIZE = 1 << 12;
public static final long CHROME_WITH_POSITION = 1 << 13;
/* Specifies whether the window is minimizable. */
public static final long CHROME_WINDOW_MIN = 1 << 14;
public static final long CHROME_WINDOW_POPUP = 1 << 15;
public static final long CHROME_ALL = 4094;
}

View File

@ -59,13 +59,13 @@ import java.io.FileInputStream;
* This is a test application for using the BrowserControl.
*
* @version $Id: EMWindow.java,v 1.39 2003/04/18 01:07:51 kyle.yuan%sun.com Exp $
* @version $Id: EMWindow.java,v 1.40 2003/04/24 05:55:07 kyle.yuan%sun.com Exp $
*
* @see org.mozilla.webclient.BrowserControlFactory
*/
public class EMWindow extends Frame implements DialogClient, ActionListener, DocumentLoadListener, MouseListener, Prompt, PrefChangedCallback {
public class EMWindow extends Frame implements DialogClient, ActionListener, DocumentLoadListener, MouseListener, NewWindowListener, Prompt, PrefChangedCallback {
static final int defaultWidth = 640;
static final int defaultHeight = 480;
@ -91,6 +91,7 @@ public class EMWindow extends Frame implements DialogClient, ActionListener, Doc
private UniversalDialog uniDialog = null;
private MenuBar menuBar;
private Menu historyMenu;
private MenuItem newItem;
private MenuItem backMenuItem;
private MenuItem forwardMenuItem;
private HistoryActionListener historyActionListener = null;
@ -115,173 +116,177 @@ public class EMWindow extends Frame implements DialogClient, ActionListener, Doc
private String myBinDir;
private boolean mInPrintPreview;
private long chromeFlag;
public static void main(String [] arg)
{
}
public static void main(String [] arg)
{
}
public EMWindow (String title, String binDir, String url, int winnum, EmbeddedMozilla Creator)
{
super(title);
popup = new PopupMenu();
creator = Creator;
currentURL = url;
winNum = winnum;
myBinDir = binDir;
mInPrintPreview = false;
System.out.println("constructed with binDir: " + binDir + " url: " + url);
setSize(defaultWidth, defaultHeight);
public EMWindow (String title, String binDir, String url, int winnum, EmbeddedMozilla Creator, long chromeFlags)
{
super(title);
popup = new PopupMenu();
creator = Creator;
currentURL = url;
winNum = winnum;
myBinDir = binDir;
mInPrintPreview = false;
System.out.println("constructed with binDir: " + binDir + " url: " + url);
setSize(defaultWidth, defaultHeight);
if (0 != (chromeFlags & NewWindowListener.CHROME_MENUBAR))
createMenubar();
if (0 != (chromeFlags & NewWindowListener.CHROME_TOOLBAR))
createToolbar(url);
// Create the browser
try {
BrowserControlFactory.setAppData(binDir);
browserControl = BrowserControlFactory.newBrowserControl();
browserCanvas =
(BrowserControlCanvas)
browserControl.queryInterface(BrowserControl.BROWSER_CONTROL_CANVAS_NAME);
// Create the browser
try {
BrowserControlFactory.setAppData(binDir);
browserControl = BrowserControlFactory.newBrowserControl();
browserCanvas =
(BrowserControlCanvas)
browserControl.queryInterface(BrowserControl.BROWSER_CONTROL_CANVAS_NAME);
}
catch(Exception e) {
System.out.println("Can't create BrowserControl: " +
e.getMessage());
}
Assert.assert_it(null != browserCanvas);
browserCanvas.setSize(defaultWidth, defaultHeight);
}
catch(Exception e) {
System.out.println("Can't create BrowserControl: " +
e.getMessage());
}
Assert.assert_it(null != browserCanvas);
browserCanvas.setSize(defaultWidth, defaultHeight);
// Add the control panel and the browserCanvas
add(browserCanvas, BorderLayout.CENTER);
// Add the control panel and the browserCanvas
add(browserCanvas, BorderLayout.CENTER);
// Create the status panel
// Create the status panel
if (0 != (chromeFlags & NewWindowListener.CHROME_STATUSBAR))
createStatusbar();
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.out.println("Got windowClosing");
System.out.println("destroying the BrowserControl");
EMWindow.this.delete();
// should close the BrowserControlCanvas
creator.DestroyEMWindow(winNum);
}
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.out.println("Got windowClosing");
System.out.println("destroying the BrowserControl");
EMWindow.this.delete();
// should close the BrowserControlCanvas
creator.DestroyEMWindow(winNum);
}
public void windowClosed(WindowEvent e) {
System.out.println("Got windowClosed");
}
});
public void windowClosed(WindowEvent e) {
System.out.println("Got windowClosed");
}
});
// Create the Context Menus
add(popup);
// Create the Context Menus
add(popup);
popup.add(popup_ViewSource = new MenuItem("View Source as ByteArray"));
popup.add(popup_SelectAll = new MenuItem("Select All"));
popup.add(popup_ViewSource = new MenuItem("View Source as ByteArray"));
popup.add(popup_SelectAll = new MenuItem("Select All"));
popup.add(popup_ViewSelection = new MenuItem("View Selection"));
contextListener = new PopupActionListener();
contextListener = new PopupActionListener();
popup_ViewSource.addActionListener (contextListener);
popup_SelectAll.addActionListener (contextListener);
popup_ViewSource.addActionListener (contextListener);
popup_SelectAll.addActionListener (contextListener);
popup_ViewSelection.addActionListener (contextListener);
show();
toFront();
show();
toFront();
try {
navigation = (Navigation2)
browserControl.queryInterface(BrowserControl.NAVIGATION_NAME);
navigation.setPrompt(this);
currentPage = (CurrentPage2)
browserControl.queryInterface(BrowserControl.CURRENT_PAGE_NAME);
history = (History)
browserControl.queryInterface(BrowserControl.HISTORY_NAME);
prefs = (Preferences)
browserControl.queryInterface(BrowserControl.PREFERENCES_NAME);
prefs.registerPrefChangedCallback(this,
"network.cookie.warnAboutCookies",
"This IS the Closure!");
prefs.setPref("network.cookie.warnAboutCookies", "true");
prefs.setPref("browser.cache.disk_cache_size", "0");
try {
navigation = (Navigation2)
browserControl.queryInterface(BrowserControl.NAVIGATION_NAME);
navigation.setPrompt(this);
currentPage = (CurrentPage2)
browserControl.queryInterface(BrowserControl.CURRENT_PAGE_NAME);
history = (History)
browserControl.queryInterface(BrowserControl.HISTORY_NAME);
prefs = (Preferences)
browserControl.queryInterface(BrowserControl.PREFERENCES_NAME);
prefs.registerPrefChangedCallback(this,
"network.cookie.warnAboutCookies",
"This IS the Closure!");
prefs.setPref("network.cookie.warnAboutCookies", "true");
prefs.setPref("browser.cache.disk_cache_size", "0");
// pull out the proxies, and make java aware of them
Properties prefsProps = prefs.getPrefs();
String proxyHost = (String) prefsProps.get("network.proxy.http");
String proxyPort = (String) prefsProps.get("network.proxy.http_port");
if (null != proxyHost && null != proxyPort) {
System.setProperty("http.proxyHost", proxyHost);
System.setProperty("http.proxyPort", proxyPort);
}
//prefsProps = prefs.getPrefs();
//prefsProps.list(System.out); // This works, try it!
}
catch (Exception e) {
System.out.println(e.toString());
// pull out the proxies, and make java aware of them
Properties prefsProps = prefs.getPrefs();
String proxyHost = (String) prefsProps.get("network.proxy.http");
String proxyPort = (String) prefsProps.get("network.proxy.http_port");
if (null != proxyHost && null != proxyPort) {
System.setProperty("http.proxyHost", proxyHost);
System.setProperty("http.proxyPort", proxyPort);
}
try {
EventRegistration eventRegistration =
(EventRegistration)
browserControl.queryInterface(BrowserControl.EVENT_REGISTRATION_NAME);
eventRegistration.addDocumentLoadListener(this);
eventRegistration.addMouseListener(this);
//prefsProps = prefs.getPrefs();
//prefsProps.list(System.out); // This works, try it!
}
catch (Exception e) {
System.out.println(e.toString());
}
// PENDING(edburns): test code, replace with production code
bookmarks =
(Bookmarks)
browserControl.queryInterface(BrowserControl.BOOKMARKS_NAME);
System.out.println("debug: edburns: got Bookmarks instance");
try {
EventRegistration2 eventRegistration =
(EventRegistration2)
browserControl.queryInterface(BrowserControl.EVENT_REGISTRATION_NAME);
eventRegistration.addDocumentLoadListener(this);
eventRegistration.addMouseListener(this);
eventRegistration.addNewWindowListener(this);
bookmarksTree = bookmarks.getBookmarks();
// PENDING(edburns): test code, replace with production code
bookmarks =
(Bookmarks)
browserControl.queryInterface(BrowserControl.BOOKMARKS_NAME);
System.out.println("debug: edburns: got Bookmarks instance");
/*********
bookmarksTree = bookmarks.getBookmarks();
TreeNode bookmarksRoot = (TreeNode) bookmarksTree.getRoot();
/*********
System.out.println("debug: edburns: testing the Enumeration");
int childCount = bookmarksRoot.getChildCount();
System.out.println("debug: edburns: root has " + childCount +
" children.");
TreeNode bookmarksRoot = (TreeNode) bookmarksTree.getRoot();
Enumeration rootChildren = bookmarksRoot.children();
TreeNode currentChild;
System.out.println("debug: edburns: testing the Enumeration");
int childCount = bookmarksRoot.getChildCount();
System.out.println("debug: edburns: root has " + childCount +
" children.");
int i = 0, childIndex;
while (rootChildren.hasMoreElements()) {
currentChild = (TreeNode) rootChildren.nextElement();
System.out.println("debug: edburns: bookmarks root has children! child: " + i + " name: " + currentChild.toString());
i++;
}
Enumeration rootChildren = bookmarksRoot.children();
TreeNode currentChild;
System.out.println("debug: edburns: testing getChildAt(" + --i + "): ");
currentChild = bookmarksRoot.getChildAt(i);
System.out.println("debug: edburns: testing getIndex(Child " +
i + "): index should be " + i + ".");
childIndex = bookmarksRoot.getIndex(currentChild);
System.out.println("debug: edburns: index is: " + childIndex);
*****/
/**********
System.out.println("debug: edburns: got new entry");
Properties entryProps = entry.getProperties();
System.out.println("debug: edburns: entry url: " +
entryProps.getProperty(BookmarkEntry.URL));
bookmarks.addBookmark(folder, entry);
**********/
}
catch (Exception e) {
System.out.println(e.toString());
int i = 0, childIndex;
while (rootChildren.hasMoreElements()) {
currentChild = (TreeNode) rootChildren.nextElement();
System.out.println("debug: edburns: bookmarks root has children! child: " + i + " name: " + currentChild.toString());
i++;
}
if (null != navigation) {
navigation.loadURL(url);
}
} // EMWindow() ctor
System.out.println("debug: edburns: testing getChildAt(" + --i + "): ");
currentChild = bookmarksRoot.getChildAt(i);
System.out.println("debug: edburns: testing getIndex(Child " +
i + "): index should be " + i + ".");
childIndex = bookmarksRoot.getIndex(currentChild);
System.out.println("debug: edburns: index is: " + childIndex);
*****/
/**********
System.out.println("debug: edburns: got new entry");
Properties entryProps = entry.getProperties();
System.out.println("debug: edburns: entry url: " +
entryProps.getProperty(BookmarkEntry.URL));
bookmarks.addBookmark(folder, entry);
**********/
}
catch (Exception e) {
System.out.println(e.toString());
}
if (null != navigation && url.length() > 0) {
navigation.loadURL(url);
}
} // EMWindow() ctor
private void createMenubar()
{
@ -289,7 +294,7 @@ private void createMenubar()
this.setMenuBar(menuBar);
Menu fileMenu = new Menu("File");
MenuItem newItem = new MenuItem("New Window");
newItem = new MenuItem("New Window");
fileMenu.add(newItem);
newItem.addActionListener(this);
MenuItem printItem = new MenuItem("Print");
@ -424,14 +429,14 @@ public void delete()
{
browserCanvas.setVisible(false);
if (null != bookmarksFrame) {
bookmarksFrame.setVisible(false);
bookmarksFrame.dispose();
bookmarksFrame = null;
bookmarksFrame.setVisible(false);
bookmarksFrame.dispose();
bookmarksFrame = null;
}
if (null != domViewer) {
domViewer.setVisible(false);
domViewer.dispose();
domViewer = null;
domViewer.setVisible(false);
domViewer.dispose();
domViewer = null;
}
BrowserControlFactory.deleteBrowserControl(browserControl);
browserControl = null;
@ -455,7 +460,10 @@ public void actionPerformed (ActionEvent evt)
try {
if (command.equals("New Window")) {
creator.CreateEMWindow();
creator.CreateEMWindow("", NewWindowListener.CHROME_ALL);
}
else if (command.equals("New Window2")) {
creator.CreateEMWindow("", chromeFlag);
}
else if (command.equals("Close")) {
System.out.println("Got windowClosing");
@ -740,6 +748,15 @@ public void eventDispatched(WebclientEvent event)
break;
}
}
else if (event instanceof NewWindowEvent) {
chromeFlag = (long) event.getType();
// send a "new window" event to the window
Toolkit.getDefaultToolkit().
getSystemEventQueue().
postEvent(new ActionEvent(newItem,
ActionEvent.ACTION_PERFORMED,
"New Window2"));
}
}
/**

View File

@ -1,5 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
*
* 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
@ -38,16 +38,15 @@ import org.mozilla.util.Assert;
* This is a test application for using the BrowserControl.
*
* @version $Id: EmbeddedMozilla.java,v 1.6 2001/05/23 22:26:52 edburns%acm.org Exp $
*
* @version $Id: EmbeddedMozilla.java,v 1.7 2003/04/24 05:55:08 kyle.yuan%sun.com Exp $
*
* @see org.mozilla.webclient.BrowserControlFactory
*/
public interface EmbeddedMozilla
public interface EmbeddedMozilla
{
public void CreateEMWindow();
public void CreateEMWindow(String newurl, long chromeFlags);
public void DestroyEMWindow(int winNumber);
}

View File

@ -1,5 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
*
* 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
@ -38,9 +38,9 @@ import org.mozilla.util.Assert;
* This is a test application for using the BrowserControl.
*
* @version $Id: EmbeddedMozillaImpl.java,v 1.2 2001/12/23 23:22:21 timeless%mac.com Exp $
*
* @see org.mozilla.webclient.BrowserControlFactory
* @version $Id: EmbeddedMozillaImpl.java,v 1.3 2003/04/24 05:55:09 kyle.yuan%sun.com Exp $
*
* @see org.mozilla.webclient.BrowserControlFactory
*/
@ -58,33 +58,34 @@ public static void printUsage()
System.out.println(" <path> is the absolute path to the native browser bin directory, ");
System.out.println(" including the bin.");
}
public EmbeddedMozillaImpl()
public EmbeddedMozillaImpl()
{
CreateEMWindow();
}
public void CreateEMWindow()
{
System.out.println("Creating new EmbeddedMozillaImpl window");
EMWindow aEMWindow ;
aEMWindow = new EMWindow("EmbeddedMozilla#" + (int)(count+1),
binDir, url, count, this);
count++;
CreateEMWindow(url, NewWindowListener.CHROME_ALL);
}
public void DestroyEMWindow(int winNumber) {
count--;
if (count == 0) {
System.out.println("closing application");
try {
BrowserControlFactory.appTerminate();
public void CreateEMWindow(String newurl, long chromeFlags)
{
System.out.println("Creating new EmbeddedMozillaImpl window");
EMWindow aEMWindow ;
aEMWindow = new EMWindow("EmbeddedMozilla#" + (int)(count+1),
binDir, newurl, count, this, chromeFlags);
count++;
}
public void DestroyEMWindow(int winNumber)
{
count--;
if (count == 0) {
System.out.println("closing application");
try {
BrowserControlFactory.appTerminate();
}
catch(Exception e) {
System.out.println("got Exception on exit: " + e.getMessage());
}
System.exit(0);
}
catch(Exception e) {
System.out.println("got Exception on exit: " + e.getMessage());
}
System.exit(0);
}
}
public static void main(String [] arg)
@ -95,7 +96,7 @@ public static void main(String [] arg)
}
String urlArg =(2 == arg.length) ? arg[1] : "http://www.mozilla.org/projects/blackwood/webclient/";
// set class vars used in EmbeddedMozillaImpl ctor
// set class vars used in EmbeddedMozillaImpl ctor
binDir = arg[0];
url = urlArg;

View File

@ -1,5 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
*
* 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
@ -28,17 +28,19 @@ import org.mozilla.util.Log;
import org.mozilla.util.ParameterCheck;
import org.mozilla.webclient.BrowserControl;
import org.mozilla.webclient.EventRegistration;
import org.mozilla.webclient.EventRegistration2;
import org.mozilla.webclient.WindowControl;
import org.mozilla.webclient.WrapperFactory;
import org.mozilla.webclient.DocumentLoadEvent;
import org.mozilla.webclient.DocumentLoadListener;
import org.mozilla.webclient.NewWindowEvent;
import org.mozilla.webclient.NewWindowListener;
import java.awt.event.MouseListener;
import org.mozilla.webclient.WebclientEvent;
import org.mozilla.webclient.WebclientEventListener;
import org.mozilla.webclient.UnimplementedException;
import org.mozilla.webclient.UnimplementedException;
public class EventRegistrationImpl extends ImplObjectNative implements EventRegistration
public class EventRegistrationImpl extends ImplObjectNative implements EventRegistration2
{
//
// Constants
@ -65,11 +67,11 @@ public class EventRegistrationImpl extends ImplObjectNative implements EventRegi
private NativeEventThread nativeEventThread = null;
//
// Constructors and Initializers
// Constructors and Initializers
//
public EventRegistrationImpl(WrapperFactory yourFactory,
BrowserControl yourBrowserControl)
public EventRegistrationImpl(WrapperFactory yourFactory,
BrowserControl yourBrowserControl)
{
super(yourFactory, yourBrowserControl);
@ -77,9 +79,9 @@ public EventRegistrationImpl(WrapperFactory yourFactory,
try {
WindowControl windowControl = (WindowControl)
myBrowserControl.queryInterface(BrowserControl.WINDOW_CONTROL_NAME);
if (windowControl instanceof WindowControlImpl) {
nativeEventThread =
nativeEventThread =
((WindowControlImpl)windowControl).getNativeEventThread();
}
}
@ -91,7 +93,7 @@ public EventRegistrationImpl(WrapperFactory yourFactory,
public void delete()
{
nativeEventThread = null;
super.delete();
}
@ -104,7 +106,7 @@ public void delete()
//
//
// Methods from EventRegistration
// Methods from EventRegistration
//
/**
@ -123,13 +125,13 @@ public void addDocumentLoadListener(DocumentLoadListener listener)
Assert.assert_it(null != nativeEventThread);
ParameterCheck.nonNull(listener);
WCEventListenerWrapper listenerWrapper =
WCEventListenerWrapper listenerWrapper =
new WCEventListenerWrapper(listener,
DocumentLoadListener.class.getName());
if (null == listenerWrapper) {
throw new NullPointerException("Can't instantiate WCEventListenerWrapper, out of memory.");
}
synchronized(myBrowserControl) {
nativeEventThread.addListener(listenerWrapper);
}
@ -142,14 +144,14 @@ public void removeDocumentLoadListener(DocumentLoadListener listener)
Assert.assert_it(-1 != nativeWebShell);
Assert.assert_it(null != nativeEventThread);
ParameterCheck.nonNull(listener);
WCEventListenerWrapper listenerWrapper =
WCEventListenerWrapper listenerWrapper =
new WCEventListenerWrapper(listener,
DocumentLoadListener.class.getName());
if (null == listenerWrapper) {
throw new NullPointerException("Can't instantiate WCEventListenerWrapper, out of memory.");
}
synchronized(myBrowserControl) {
nativeEventThread.removeListener(listenerWrapper);
}
@ -168,21 +170,21 @@ public void addMouseListener(MouseListener listener)
// implements java.awt.event.MouseListener. See WCMouseListener for
// more information.
WCMouseListenerImpl mouseListenerWrapper =
WCMouseListenerImpl mouseListenerWrapper =
new WCMouseListenerImpl(listener);
if (null == mouseListenerWrapper) {
throw new NullPointerException("Can't instantiate WCMouseListenerImpl, out of memory.");
}
WCEventListenerWrapper listenerWrapper =
WCEventListenerWrapper listenerWrapper =
new WCEventListenerWrapper(mouseListenerWrapper,
MouseListener.class.getName());
if (null == listenerWrapper) {
throw new NullPointerException("Can't instantiate WCEventListenerWrapper, out of memory.");
}
synchronized(myBrowserControl) {
nativeEventThread.addListener(listenerWrapper);
}
@ -196,26 +198,67 @@ public void removeMouseListener(MouseListener listener)
Assert.assert_it(null != nativeEventThread);
ParameterCheck.nonNull(listener);
WCMouseListenerImpl mouseListenerWrapper =
WCMouseListenerImpl mouseListenerWrapper =
new WCMouseListenerImpl(listener);
if (null == mouseListenerWrapper) {
throw new NullPointerException("Can't instantiate WCMouseListenerImpl, out of memory.");
}
WCEventListenerWrapper listenerWrapper =
WCEventListenerWrapper listenerWrapper =
new WCEventListenerWrapper(mouseListenerWrapper,
MouseListener.class.getName());
if (null == listenerWrapper) {
throw new NullPointerException("Can't instantiate WCEventListenerWrapper, out of memory.");
}
synchronized(myBrowserControl) {
nativeEventThread.removeListener(listenerWrapper);
}
}
public void addNewWindowListener(NewWindowListener listener)
{
ParameterCheck.nonNull(listener);
myFactory.throwExceptionIfNotInitialized();
Assert.assert_it(-1 != nativeWebShell);
Assert.assert_it(null != nativeEventThread);
ParameterCheck.nonNull(listener);
WCEventListenerWrapper listenerWrapper =
new WCEventListenerWrapper(listener,
NewWindowListener.class.getName());
if (null == listenerWrapper) {
throw new NullPointerException("Can't instantiate WCEventListenerWrapper, out of memory.");
}
synchronized(myBrowserControl) {
nativeEventThread.addListener(listenerWrapper);
}
}
public void removeNewWindowListener(NewWindowListener listener)
{
ParameterCheck.nonNull(listener);
myFactory.throwExceptionIfNotInitialized();
Assert.assert_it(-1 != nativeWebShell);
Assert.assert_it(null != nativeEventThread);
ParameterCheck.nonNull(listener);
WCEventListenerWrapper listenerWrapper =
new WCEventListenerWrapper(listener,
NewWindowListener.class.getName());
if (null == listenerWrapper) {
throw new NullPointerException("Can't instantiate WCEventListenerWrapper, out of memory.");
}
synchronized(myBrowserControl) {
nativeEventThread.removeListener(listenerWrapper);
}
}
// ----VERTIGO_TEST_START
//
@ -228,20 +271,20 @@ public static void main(String [] args)
Log.setApplicationName("EventRegistrationImpl");
Log.setApplicationVersion("0.0");
Log.setApplicationVersionDate("$Id: EventRegistrationImpl.java,v 1.10 2001/05/29 18:36:07 ashuk%eng.sun.com Exp $");
Log.setApplicationVersionDate("$Id: EventRegistrationImpl.java,v 1.11 2003/04/24 05:55:12 kyle.yuan%sun.com Exp $");
try {
org.mozilla.webclient.BrowserControlFactory.setAppData(args[0]);
org.mozilla.webclient.BrowserControl control =
org.mozilla.webclient.BrowserControlFactory.newBrowserControl();
org.mozilla.webclient.BrowserControl control =
org.mozilla.webclient.BrowserControlFactory.newBrowserControl();
Assert.assert_it(control != null);
EventRegistration wc = (EventRegistration)
control.queryInterface(org.mozilla.webclient.BrowserControl.WINDOW_CONTROL_NAME);
Assert.assert_it(wc != null);
EventRegistration2 wc = (EventRegistration2)
control.queryInterface(org.mozilla.webclient.BrowserControl.WINDOW_CONTROL_NAME);
Assert.assert_it(wc != null);
}
catch (Exception e) {
System.out.println("got exception: " + e.getMessage());
System.out.println("got exception: " + e.getMessage());
}
}

View File

@ -1,5 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
*
* 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
@ -37,12 +37,14 @@ import org.mozilla.webclient.BrowserControlCanvas;
import org.mozilla.webclient.WindowControl;
import org.mozilla.webclient.DocumentLoadEvent;
import org.mozilla.webclient.DocumentLoadListener;
import org.mozilla.webclient.NewWindowEvent;
import org.mozilla.webclient.NewWindowListener;
import java.awt.event.MouseListener;
import org.mozilla.webclient.WebclientEvent;
import org.mozilla.webclient.WebclientEventListener;
import org.mozilla.webclient.UnimplementedException;
public class NativeEventThread extends Thread
public class NativeEventThread extends Thread
{
//
@ -62,7 +64,7 @@ private static Object firstThread = null;
/**
* Vector of listener objects to add.
* Vector of listener objects to add.
*/
@ -70,26 +72,26 @@ private Vector listenersToAdd;
/**
* Vector of listener objects to remove.
* Vector of listener objects to remove.
*/
private Vector listenersToRemove;
/**
/**
* a handle to the actual mozilla webShell, obtained in constructor
*/
private int nativeWebShell = -1;
/**
* a reference to the WindowControl that created us.
*/
private WindowControl windowControl;
private BrowserControl browserControl;
@ -125,7 +127,7 @@ public NativeEventThread(String threadName, BrowserControl yourBrowserControl)
browserControl = yourBrowserControl;
try {
windowControl = (WindowControl)
windowControl = (WindowControl)
browserControl.queryInterface(BrowserControl.WINDOW_CONTROL_NAME);
nativeWebShell = windowControl.getNativeWebShell();
@ -133,7 +135,7 @@ public NativeEventThread(String threadName, BrowserControl yourBrowserControl)
browserControl.queryInterface(BrowserControl.BROWSER_CONTROL_CANVAS_NAME);
}
catch (Exception e) {
System.out.println("NativeEventThread constructor: Exception: " + e +
System.out.println("NativeEventThread constructor: Exception: " + e +
" " + e.getMessage());
}
}
@ -160,7 +162,7 @@ public void delete()
wait();
}
catch (Exception e) {
System.out.println("NativeEventThread.delete: interrupted while waiting\n\t for NativeEventThread to notify() after destruction of initContext: " + e +
System.out.println("NativeEventThread.delete: interrupted while waiting\n\t for NativeEventThread to notify() after destruction of initContext: " + e +
" " + e.getMessage());
}
}
@ -190,14 +192,14 @@ public void delete()
* necessary.
* @see nativeInitialize
* @see nativeProcessEvents
* @see nativeAddListener
*/
public void run()
public void run()
{
// this.setPriority(Thread.MIN_PRIORITY);
Assert.assert_it(-1 != nativeWebShell);
@ -221,7 +223,7 @@ public void run()
Thread.sleep(1);
}
catch (Exception e) {
System.out.println("NativeEventThread.run(): Exception: " + e +
System.out.println("NativeEventThread.run(): Exception: " + e +
" while sleeping: " + e.getMessage());
}
synchronized (this) {
@ -243,14 +245,14 @@ public void run()
if (this == firstThread) {
nativeProcessEvents(nativeWebShell);
}
if (null != listenersToAdd && !listenersToAdd.isEmpty()) {
tempEnum = listenersToAdd.elements();
while (tempEnum.hasMoreElements()) {
WCEventListenerWrapper tempListener =
WCEventListenerWrapper tempListener =
(WCEventListenerWrapper) tempEnum.nextElement();
nativeAddListener(nativeWebShell,tempListener.listener,
nativeAddListener(nativeWebShell,tempListener.listener,
tempListener.listenerClassName);
}
// use removeAllElements instead of clear for jdk1.1.x
@ -258,7 +260,7 @@ public void run()
listenersToAdd.removeAllElements();
}
doRemoveListeners();
}
}
}
@ -292,12 +294,12 @@ private void doRemoveListeners()
}
}
else {
WCEventListenerWrapper tempListener =
WCEventListenerWrapper tempListener =
(WCEventListenerWrapper) listenerObj;
nativeRemoveListener(nativeWebShell,
nativeRemoveListener(nativeWebShell,
tempListener.listener,
tempListener.listenerClassName);
}
}
// use removeAllElements instead of clear for jdk1.1.x
@ -318,7 +320,7 @@ private void doRemoveListeners()
* The vector is a vector of WCEventListenerWrapper instances. In run()
* these are unpacked and sent to nativeAddListener like this:
* nativeAddListener(nativeWebShell,tempListener.listener,
* nativeAddListener(nativeWebShell,tempListener.listener,
* tempListener.listenerClassName); <P>
* @see run
@ -369,7 +371,7 @@ void removeListener(WCEventListenerWrapper newListener)
listenersToRemove.addElement(newListener);
}
}
}
/**
@ -381,8 +383,8 @@ void removeListener(WCEventListenerWrapper newListener)
*/
void nativeEventOccurred(WebclientEventListener target,
String targetClassName, long eventType,
void nativeEventOccurred(WebclientEventListener target,
String targetClassName, long eventType,
Object eventData)
{
ParameterCheck.nonNull(target);
@ -390,26 +392,29 @@ void nativeEventOccurred(WebclientEventListener target,
Assert.assert_it(-1 != nativeWebShell);
Assert.assert_it(null != windowControl);
WebclientEvent event = null;
if (DocumentLoadListener.class.getName().equals(targetClassName)) {
event = new DocumentLoadEvent(this, eventType, eventData);
}
else if (MouseListener.class.getName().equals(targetClassName)) {
Assert.assert_it(target instanceof WCMouseListenerImpl);
// We create a plain vanilla WebclientEvent, which the
// WCMouseListenerImpl target knows how to deal with.
// Also, the source happens to be the browserControlCanvas
// to satisfy the java.awt.event.MouseEvent's requirement
// that the source be a java.awt.Component subclass.
event = new WebclientEvent(browserControlCanvas, eventType, eventData);
}
else if (NewWindowListener.class.getName().equals(targetClassName)) {
event = new NewWindowEvent(this, eventType, eventData);
}
// else...
// PENDING(edburns): maybe we need to put this in some sort of
// event queue?
target.eventDispatched(event);
@ -471,9 +476,9 @@ public native void nativeAddListener(int webShellPtr,
* Called from Java to allow the native code to remove a listener.
*/
*/
public native void nativeRemoveListener(int webShellPtr,
public native void nativeRemoveListener(int webShellPtr,
WebclientEventListener typedListener,
String listenerName);
@ -481,7 +486,7 @@ public native void nativeRemoveListener(int webShellPtr,
* Called from Java to allow the native code to remove all listeners.
*/
*/
public native void nativeRemoveAllListeners(int webShellPrt);

View File

@ -94,18 +94,18 @@ NS_IMPL_RELEASE(CBrowserContainer)
NS_INTERFACE_MAP_BEGIN(CBrowserContainer)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIWebBrowserChrome)
NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChrome)
NS_INTERFACE_MAP_ENTRY(nsIURIContentListener)
NS_INTERFACE_MAP_ENTRY(nsIDocShellTreeOwner)
NS_INTERFACE_MAP_ENTRY(nsIBaseWindow)
NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener)
NS_INTERFACE_MAP_ENTRY(nsIWebShellContainer)
NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChrome)
NS_INTERFACE_MAP_ENTRY(nsIURIContentListener)
NS_INTERFACE_MAP_ENTRY(nsIDocShellTreeOwner)
NS_INTERFACE_MAP_ENTRY(nsIBaseWindow)
NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener)
NS_INTERFACE_MAP_ENTRY(nsIWebShellContainer)
NS_INTERFACE_MAP_ENTRY(nsIAuthPrompt)
NS_INTERFACE_MAP_ENTRY(nsIPrompt)
NS_INTERFACE_MAP_ENTRY(nsIDOMEventListener)
NS_INTERFACE_MAP_ENTRY(nsIDOMMouseListener)
NS_INTERFACE_MAP_ENTRY(wcIBrowserContainer)
NS_INTERFACE_MAP_ENTRY(nsIPrompt)
NS_INTERFACE_MAP_ENTRY(nsIDOMEventListener)
NS_INTERFACE_MAP_ENTRY(nsIDOMMouseListener)
NS_INTERFACE_MAP_ENTRY(wcIBrowserContainer)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_END
@ -115,6 +115,13 @@ NS_INTERFACE_MAP_END
NS_IMETHODIMP CBrowserContainer::GetInterface(const nsIID & uuid, void * *result)
{
if (uuid.Equals(NS_GET_IID(nsIDOMWindow)))
{
if (m_pOwner)
return m_pOwner->GetContentDOMWindow((nsIDOMWindow **) result);
return NS_ERROR_NOT_INITIALIZED;
}
return QueryInterface(uuid, result);
}

View File

@ -18,9 +18,9 @@
# Contributor(s):
DEPTH = ../../..
topsrcdir = $(DEPTH)
srcdir = $(topsrcdir)/java/webclient/src_moz
VPATH = $(topsrcdir)/java/webclient/src_moz
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
# IMPORTANT: on Linux, if building webclient with a non-debug mozilla
@ -113,6 +113,7 @@ CPPSRCS = \
PreferencesImpl.cpp \
PreferencesActionEvents.cpp \
WrapperFactoryImpl.cpp \
WindowCreator.cpp \
$(NULL)
ifeq ($(OS_ARCH),Linux)
@ -191,20 +192,5 @@ endif
endif
buildRunems:
ifeq ($(BAL_INTERFACE),)
ifeq ($(PACKAGE_BUILD),)
@echo +++ Creating runem. Use this to run the test browser.
rm -f runem
@echo #!/bin/sh > runem
@echo $(PERL) ../src_share/runem.pl org.mozilla.webclient.test.EmbeddedMozillaImpl $(DEPTH) "$$"1 "$$"2 "$$"3 "$$"4 "$$"4 "$$"6 >> runem
chmod 755 runem
else
endif # PACKAGE_BUILD
endif # BAL_INTERFACE
install:: buildRunems
clobber_all:: clobber

View File

@ -24,6 +24,7 @@
* Ed Burns <edburns@acm.org>
* Ashutosh Kulkarni <ashuk@eng.sun.com>
* Ann Sunhachawee
* Kyle Yuan <kyle.yuan@sun.com>
*/
#include "NativeEventThread.h"
@ -58,11 +59,12 @@
#include "nsIDocShell.h"
#include "nsIBaseWindow.h"
#include "nsIDocShellTreeItem.h"
#include "nsCWebBrowser.h"
#include "nsIEventQueueService.h"
#include "nsIThread.h"
//nsIWebShell is included in ns_util.h
#include "NativeEventThreadActionEvents.h"
#include "nsIWindowWatcher.h"
#include "nsIComponentRegistrar.h"
#include "WindowCreator.h"
#include "prlog.h" // for PR_ASSERT
@ -170,6 +172,7 @@ static PRBool gFirstTime = PR_TRUE;
PLEventQueue * gActionQueue = nsnull;
PRThread * gEmbeddedThread = nsnull;
nsISHistory *gHistory = nsnull;
WindowCreator * gCreatorCallback = nsnull;
char * errorMessages[] = {
"No Error",
@ -313,6 +316,10 @@ JNIEXPORT void JNICALL Java_org_mozilla_webclient_wrapper_1native_NativeEventThr
case MOUSE_LISTENER:
initContext->browserContainer->AddMouseListener(globalRef);
break;
case NEW_WINDOW_LISTENER:
if (gCreatorCallback)
gCreatorCallback->AddNewWindowListener(globalRef);
break;
}
return;
@ -463,6 +470,29 @@ static void event_processor_callback(gpointer data,
//
/* 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(WebShellInitContext * initContext)
{
// create an nsWindowCreator and give it to the WindowWatcher service
gCreatorCallback = new WindowCreator(initContext);
if (gCreatorCallback)
{
nsCOMPtr<nsIWindowCreator> windowCreator(dont_QueryInterface(NS_STATIC_CAST(nsIWindowCreator *, gCreatorCallback)));
if (windowCreator)
{
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
if (wwatch)
{
wwatch->SetWindowCreator(windowCreator);
return NS_OK;
}
}
}
return NS_ERROR_FAILURE;
}
void DoMozInitialization(WebShellInitContext * initContext)
{
if (gFirstTime) {
@ -495,6 +525,8 @@ void DoMozInitialization(WebShellInitContext * initContext)
// If this fails, it just goes to stdout/stderr
}
InitializeWindowCreator(initContext);
// handle the profile manager nonsense
nsCOMPtr<nsICmdLineService> cmdLine =do_GetService(kCmdLineServiceCID);
nsCOMPtr<nsIProfile> profile = do_GetService(NS_PROFILE_CONTRACTID);
@ -630,6 +662,14 @@ nsresult InitMozillaStuff (WebShellInitContext * initContext)
initContext->initFailCode = kCreateWebShellError;
return NS_ERROR_UNEXPECTED;
}
#ifdef XP_UNIX
// The gdk_x_error function exits in some cases, we don't
// want that.
XSetErrorHandler(wc_x_error);
#endif
}
if (gFirstTime) {
@ -738,15 +778,11 @@ nsresult InitMozillaStuff (WebShellInitContext * initContext)
}
#endif
#ifdef XP_UNIX
// The gdk_x_error function exits in some cases, we don't
// want that.
XSetErrorHandler(wc_x_error);
#endif
// Just need to loop once to clear out events before returning
processEventLoop(initContext);
// PENDING(kyle): not sure if we need to check this, but it does prevent some crash from happening
void* threadId = PR_GetCurrentThread();
if (threadId == (void *) gEmbeddedThread)
// Just need to loop once to clear out events before returning
processEventLoop(initContext);
return rv;
}

View File

@ -37,6 +37,7 @@ static NS_DEFINE_IID(kIWebShellIID, NS_IWEB_SHELL_IID);
static NS_DEFINE_IID(kISHistoryIID, NS_ISHISTORY_IID);
static NS_DEFINE_CID(kSHistoryCID, NS_SHISTORY_CID);
extern WebShellInitContext* gNewWindowInitContext;
/*
* wsRealizeBrowserEvent
@ -151,6 +152,8 @@ wsRealizeBrowserEvent::handleEvent ()
mInitContext->initComplete = TRUE;
// we will check this value in WindowCreator::CreateChromeWindow
gNewWindowInitContext = mInitContext;
return (void *) nsnull;
} // handleEvent()

View File

@ -0,0 +1,81 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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 RaptorCanvas.
*
* The Initial Developer of the Original Code is Kirk Baker and
* Ian Wilkinson. Portions created by Kirk Baker and Ian Wilkinson are
* Copyright (C) 1999 Kirk Baker and Ian Wilkinson. All
* Rights Reserved.
*
* Contributor(s): Kyle Yuan <kyle.yuan@sun.com>
*/
#include "nsIWebBrowserChrome.h"
#include "WindowCreator.h"
int processEventLoop(WebShellInitContext * initContext);
WebShellInitContext* gNewWindowInitContext;
WindowCreator::WindowCreator(WebShellInitContext *yourInitContext)
{
mInitContext = yourInitContext;
mTarget = 0;
}
WindowCreator::~WindowCreator()
{
}
NS_IMPL_ISUPPORTS1(WindowCreator, nsIWindowCreator)
NS_IMETHODIMP WindowCreator::AddNewWindowListener(jobject target)
{
if (! mTarget)
mTarget = target;
return NS_OK;
}
NS_IMETHODIMP
WindowCreator::CreateChromeWindow(nsIWebBrowserChrome *parent,
PRUint32 chromeFlags,
nsIWebBrowserChrome **_retval)
{
if (!mTarget)
return NS_OK;
gNewWindowInitContext = nsnull;
util_SendEventToJava(mInitContext->env,
mInitContext->nativeEventThread,
mTarget,
NEW_WINDOW_LISTENER_CLASSNAME,
chromeFlags,
0);
// check gNewWindowInitContext to see if the initialization had completed
void* threadId = PR_GetCurrentThread();
while (!gNewWindowInitContext) {
if (threadId == (void *) gEmbeddedThread) {
processEventLoop(mInitContext);
}
::PR_Sleep(PR_INTERVAL_NO_WAIT);
}
nsCOMPtr<nsIWebBrowserChrome> webChrome(do_QueryInterface(gNewWindowInitContext->browserContainer));
*_retval = webChrome;
NS_IF_ADDREF(*_retval);
printf ("RET=%x\n", *_retval);
return NS_OK;
}

View File

@ -0,0 +1,46 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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 RaptorCanvas.
*
* The Initial Developer of the Original Code is Kirk Baker and
* Ian Wilkinson. Portions created by Kirk Baker and Ian Wilkinson are
* Copyright (C) 1999 Kirk Baker and Ian Wilkinson. All
* Rights Reserved.
*
* Contributor(s): Kyle Yuan <kyle.yuan@sun.com>
*/
#ifndef __WindowCreator_h_
#define __WindowCreator_h_
#include "nsIWindowCreator.h"
#include "ns_util.h"
class WindowCreator : public nsIWindowCreator
{
private:
WebShellInitContext *mInitContext;
jobject mTarget;
public:
WindowCreator(WebShellInitContext *yourInitContext);
virtual ~WindowCreator();
NS_IMETHOD AddNewWindowListener(jobject target);
NS_DECL_ISUPPORTS
NS_DECL_NSIWINDOWCREATOR
};
#endif

View File

@ -51,6 +51,7 @@ static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
const char *gSupportedListenerInterfaces[] = {
DOCUMENT_LOAD_LISTENER_CLASSNAME_VALUE,
MOUSE_LISTENER_CLASSNAME_VALUE,
NEW_WINDOW_LISTENER_CLASSNAME_VALUE,
nsnull
};

View File

@ -82,6 +82,7 @@ jobject BM_IS_FOLDER_VALUE;
jstring DOCUMENT_LOAD_LISTENER_CLASSNAME;
jstring MOUSE_LISTENER_CLASSNAME;
jstring NEW_WINDOW_LISTENER_CLASSNAME;
jlong DocumentLoader_maskValues[] = { -1L };
char * DocumentLoader_maskNames[] = {
@ -284,6 +285,12 @@ jboolean util_InitStringConstants()
MOUSE_LISTENER_CLASSNAME_VALUE)))) {
return JNI_FALSE;
}
if (nsnull == (NEW_WINDOW_LISTENER_CLASSNAME = (jstring)
::util_NewGlobalRef(env, (jobject)
::util_NewStringUTF(env,
NEW_WINDOW_LISTENER_CLASSNAME_VALUE)))) {
return JNI_FALSE;
}
return STRING_CONSTANTS_INITED = JNI_TRUE;
}

View File

@ -124,6 +124,7 @@ extern jobject BM_IS_FOLDER_VALUE;
*/
extern jstring DOCUMENT_LOAD_LISTENER_CLASSNAME;
extern jstring MOUSE_LISTENER_CLASSNAME;
extern jstring NEW_WINDOW_LISTENER_CLASSNAME;
//
@ -135,6 +136,7 @@ extern jstring MOUSE_LISTENER_CLASSNAME;
typedef enum {
DOCUMENT_LOAD_LISTENER = 0,
MOUSE_LISTENER,
NEW_WINDOW_LISTENER,
LISTENER_NOT_FOUND
} LISTENER_CLASSES;
@ -142,6 +144,7 @@ typedef enum {
#define DOCUMENT_LOAD_LISTENER_CLASSNAME_VALUE "org.mozilla.webclient.DocumentLoadListener"
#define MOUSE_LISTENER_CLASSNAME_VALUE "java.awt.event.MouseListener"
#define NEW_WINDOW_LISTENER_CLASSNAME_VALUE "org.mozilla.webclient.NewWindowListener"
#define START_DOCUMENT_LOAD_EVENT_MASK_VALUE "START_DOCUMENT_LOAD_EVENT_MASK"