a=edburns
bug=31253

This change doesn't impact SeaMonkey.

Move the initialization of the nativeWebShell ptr into a superclass.


git-svn-id: svn://10.0.0.236/trunk@62501 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
edburns%acm.org
2000-03-09 23:22:52 +00:00
parent e926d2847d
commit c4a928699e
7 changed files with 139 additions and 113 deletions

View File

@@ -29,7 +29,6 @@ import org.mozilla.util.ParameterCheck;
import org.mozilla.webclient.BrowserControl;
import org.mozilla.webclient.Bookmarks;
import org.mozilla.webclient.BookmarkEntry;
import org.mozilla.webclient.ImplObject;
import org.mozilla.webclient.WindowControl;
import org.mozilla.webclient.WrapperFactory;
@@ -37,7 +36,7 @@ import javax.swing.tree.TreeModel;
import javax.swing.tree.TreeNode;
import javax.swing.tree.DefaultTreeModel;
public class BookmarksImpl extends ImplObject implements Bookmarks
public class BookmarksImpl extends ImplObjectNative implements Bookmarks
{
//
// Constants
@@ -55,14 +54,6 @@ public class BookmarksImpl extends ImplObject implements Bookmarks
// Relationship Instance Variables
/**
* a handle to the actual mozilla webShell, obtained from WindowControl
*/
private int nativeWebShell = -1;
/**
* The bookmarks
@@ -80,16 +71,6 @@ public BookmarksImpl(WrapperFactory yourFactory,
BrowserControl yourBrowserControl)
{
super(yourFactory, yourBrowserControl);
// save the native webshell ptr
try {
WindowControl windowControl = (WindowControl)
myBrowserControl.queryInterface(BrowserControl.WINDOW_CONTROL_NAME);
nativeWebShell = windowControl.getNativeWebShell();
}
catch (Exception e) {
System.out.println(e.getMessage());
}
}
//
@@ -218,7 +199,7 @@ public static void main(String [] args)
Log.setApplicationName("BookmarksImpl");
Log.setApplicationVersion("0.0");
Log.setApplicationVersionDate("$Id: BookmarksImpl.java,v 1.1 2000-03-04 01:10:55 edburns%acm.org Exp $");
Log.setApplicationVersionDate("$Id: BookmarksImpl.java,v 1.2 2000-03-09 23:22:50 edburns%acm.org Exp $");
try {
org.mozilla.webclient.BrowserControlFactory.setAppData(args[0]);

View File

@@ -28,11 +28,10 @@ import org.mozilla.util.ParameterCheck;
import org.mozilla.webclient.BrowserControl;
import org.mozilla.webclient.CurrentPage;
import org.mozilla.webclient.ImplObject;
import org.mozilla.webclient.WindowControl;
import org.mozilla.webclient.WrapperFactory;
public class CurrentPageImpl extends ImplObject implements CurrentPage
public class CurrentPageImpl extends ImplObjectNative implements CurrentPage
{
//
// Protected Constants
@@ -50,14 +49,6 @@ public class CurrentPageImpl extends ImplObject implements CurrentPage
// Relationship Instance Variables
/**
* a handle to the actual mozilla webShell, obtained from WindowControl
*/
private int nativeWebShell = -1;
//
// Constructors and Initializers
//
@@ -66,16 +57,6 @@ public CurrentPageImpl(WrapperFactory yourFactory,
BrowserControl yourBrowserControl)
{
super(yourFactory, yourBrowserControl);
// save the native webshell ptr
try {
WindowControl windowControl = (WindowControl)
myBrowserControl.queryInterface(BrowserControl.WINDOW_CONTROL_NAME);
nativeWebShell = windowControl.getNativeWebShell();
}
catch (Exception e) {
System.out.println(e.getMessage());
}
}
//
@@ -209,7 +190,7 @@ public static void main(String [] args)
Assert.setEnabled(true);
Log.setApplicationName("CurrentPageImpl");
Log.setApplicationVersion("0.0");
Log.setApplicationVersionDate("$Id: CurrentPageImpl.java,v 1.1 2000-03-04 01:10:55 edburns%acm.org Exp $");
Log.setApplicationVersionDate("$Id: CurrentPageImpl.java,v 1.2 2000-03-09 23:22:50 edburns%acm.org Exp $");
}

View File

@@ -27,7 +27,6 @@ import org.mozilla.util.Log;
import org.mozilla.util.ParameterCheck;
import org.mozilla.webclient.BrowserControl;
import org.mozilla.webclient.ImplObject;
import org.mozilla.webclient.EventRegistration;
import org.mozilla.webclient.WindowControl;
import org.mozilla.webclient.WrapperFactory;
@@ -36,7 +35,7 @@ import org.mozilla.webclient.DocumentLoadListener;
import org.mozilla.webclient.WebclientEvent;
import org.mozilla.webclient.WebclientEventListener;
public class EventRegistrationImpl extends ImplObject implements EventRegistration
public class EventRegistrationImpl extends ImplObjectNative implements EventRegistration
{
//
// Constants
@@ -54,15 +53,6 @@ public class EventRegistrationImpl extends ImplObject implements EventRegistrati
// Relationship Instance Variables
/**
* a handle to the actual mozilla webShell, obtained from WindowControl
*/
private int nativeWebShell = -1;
/**
* the Java thread for processing events, owned by WindowControlImpl
@@ -80,13 +70,11 @@ public EventRegistrationImpl(WrapperFactory yourFactory,
{
super(yourFactory, yourBrowserControl);
// save the native webshell ptr
// pull out the NativeEventThread from the WindowControl
try {
WindowControl windowControl = (WindowControl)
myBrowserControl.queryInterface(BrowserControl.WINDOW_CONTROL_NAME);
nativeWebShell = windowControl.getNativeWebShell();
// pull out the NativeEventThread from the WindowControl
if (windowControl instanceof WindowControlImpl) {
nativeEventThread =
((WindowControlImpl)windowControl).getNativeEventThread();
@@ -149,7 +137,7 @@ public static void main(String [] args)
Log.setApplicationName("EventRegistrationImpl");
Log.setApplicationVersion("0.0");
Log.setApplicationVersionDate("$Id: EventRegistrationImpl.java,v 1.1 2000-03-04 01:10:55 edburns%acm.org Exp $");
Log.setApplicationVersionDate("$Id: EventRegistrationImpl.java,v 1.2 2000-03-09 23:22:50 edburns%acm.org Exp $");
try {
org.mozilla.webclient.BrowserControlFactory.setAppData(args[0]);

View File

@@ -29,11 +29,10 @@ import org.mozilla.util.ParameterCheck;
import org.mozilla.webclient.BrowserControl;
import org.mozilla.webclient.History;
import org.mozilla.webclient.HistoryEntry;
import org.mozilla.webclient.ImplObject;
import org.mozilla.webclient.WindowControl;
import org.mozilla.webclient.WrapperFactory;
public class HistoryImpl extends ImplObject implements History
public class HistoryImpl extends ImplObjectNative implements History
{
//
// Protected Constants
@@ -51,14 +50,6 @@ public class HistoryImpl extends ImplObject implements History
// Relationship Instance Variables
/**
* a handle to the actual mozilla webShell, obtained from WindowControl
*/
private int nativeWebShell = -1;
//
// Constructors and Initializers
//
@@ -67,16 +58,6 @@ public HistoryImpl(WrapperFactory yourFactory,
BrowserControl yourBrowserControl)
{
super(yourFactory, yourBrowserControl);
// save the native webshell ptr
try {
WindowControl windowControl = (WindowControl)
myBrowserControl.queryInterface(BrowserControl.WINDOW_CONTROL_NAME);
nativeWebShell = windowControl.getNativeWebShell();
}
catch (Exception e) {
System.out.println(e.getMessage());
}
}
//
@@ -284,7 +265,7 @@ public static void main(String [] args)
Assert.setEnabled(true);
Log.setApplicationName("HistoryImpl");
Log.setApplicationVersion("0.0");
Log.setApplicationVersionDate("$Id: HistoryImpl.java,v 1.1 2000-03-04 01:10:55 edburns%acm.org Exp $");
Log.setApplicationVersionDate("$Id: HistoryImpl.java,v 1.2 2000-03-09 23:22:51 edburns%acm.org Exp $");
}

View File

@@ -0,0 +1,124 @@
/* -*- 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): Kirk Baker <kbaker@eb.com>
* Ian Wilkinson <iw@ennoble.com>
* Mark Lin <mark.lin@eng.sun.com>
* Mark Goddard
* Ed Burns <edburns@acm.org>
* Ann Sunhachawee
*/
package org.mozilla.webclient.wrapper_native;
// ImplObjectNative.java
import org.mozilla.util.Assert;
import org.mozilla.util.Log;
import org.mozilla.util.ParameterCheck;
import org.mozilla.webclient.ImplObject;
import org.mozilla.webclient.WrapperFactory;
import org.mozilla.webclient.BrowserControl;
import org.mozilla.webclient.WindowControl;
/**
* This is the base class for all implementations of the BrowserControl
* interfaces in the native browser wrapping code. It simply defines
* the common attributes for all native browser wrapping webclient
* implementation classes. It extends the ImplObject, which is the base
* class for all implementations of BrowserControl interfaces in either
* native or non-native code.
*/
public abstract class ImplObjectNative extends ImplObject
{
//
// Protected Constants
//
//
// Class Variables
//
//
// Instance Variables
//
// Attribute Instance Variables
// Relationship Instance Variables
/**
* My ivars are public for fast access from subclasses in the wrapper_*
* packages.
*/
/**
* a handle to the actual mozilla webShell, obtained from WindowControl
*/
public int nativeWebShell = -1;
//
// Constructors and Initializers
//
public ImplObjectNative(WrapperFactory yourFactory,
BrowserControl yourBrowserControl)
{
super(yourFactory, yourBrowserControl);
// If we're a WindowControlImpl instance, we can't ask ourself for
// the nativeWebShell, since it hasn't yet been created!
if (!(this instanceof WindowControlImpl)) {
// save the native webshell ptr
try {
WindowControl windowControl = (WindowControl)
myBrowserControl.queryInterface(BrowserControl.WINDOW_CONTROL_NAME);
nativeWebShell = windowControl.getNativeWebShell();
}
catch (Exception e) {
System.out.println(e.getMessage());
}
}
}
/**
* This constructor doesn't initialize the nativeWebshell ivar
*/
public ImplObjectNative(WrapperFactory yourFactory,
BrowserControl yourBrowserControl,
boolean notUsed)
{
super(yourFactory, yourBrowserControl);
}
} // end of class ImplObject

View File

@@ -27,14 +27,13 @@ import org.mozilla.util.Log;
import org.mozilla.util.ParameterCheck;
import org.mozilla.webclient.BrowserControl;
import org.mozilla.webclient.ImplObject;
import org.mozilla.webclient.Navigation;
import org.mozilla.webclient.WindowControl;
import org.mozilla.webclient.WrapperFactory;
import java.awt.Rectangle;
public class NavigationImpl extends ImplObject implements Navigation
public class NavigationImpl extends ImplObjectNative implements Navigation
{
//
// Protected Constants
@@ -52,15 +51,6 @@ public class NavigationImpl extends ImplObject implements Navigation
// Relationship Instance Variables
/**
* a handle to the actual mozilla webShell, obtained from WindowControl
*/
private int nativeWebShell = -1;
//
// Constructors and Initializers
//
@@ -69,16 +59,6 @@ public NavigationImpl(WrapperFactory yourFactory,
BrowserControl yourBrowserControl)
{
super(yourFactory, yourBrowserControl);
// save the native webshell ptr
try {
WindowControl windowControl = (WindowControl)
myBrowserControl.queryInterface(BrowserControl.WINDOW_CONTROL_NAME);
nativeWebShell = windowControl.getNativeWebShell();
}
catch (Exception e) {
System.out.println(e.getMessage());
}
}
//
@@ -145,7 +125,7 @@ public static void main(String [] args)
Log.setApplicationName("NavigationImpl");
Log.setApplicationVersion("0.0");
Log.setApplicationVersionDate("$Id: NavigationImpl.java,v 1.1 2000-03-04 01:10:56 edburns%acm.org Exp $");
Log.setApplicationVersionDate("$Id: NavigationImpl.java,v 1.2 2000-03-09 23:22:52 edburns%acm.org Exp $");
try {
org.mozilla.webclient.BrowserControlFactory.setAppData(args[0]);

View File

@@ -27,13 +27,12 @@ import org.mozilla.util.Log;
import org.mozilla.util.ParameterCheck;
import org.mozilla.webclient.BrowserControl;
import org.mozilla.webclient.ImplObject;
import org.mozilla.webclient.WindowControl;
import org.mozilla.webclient.WrapperFactory;
import java.awt.Rectangle;
public class WindowControlImpl extends ImplObject implements WindowControl
public class WindowControlImpl extends ImplObjectNative implements WindowControl
{
//
// Protected Constants
@@ -53,14 +52,6 @@ public class WindowControlImpl extends ImplObject implements WindowControl
protected NativeEventThread eventThread = null;
/**
* a handle to the actual mozilla webShell
*/
private int nativeWebShell = -1;
//
// Constructors and Initializers
//
@@ -68,7 +59,7 @@ private int nativeWebShell = -1;
public WindowControlImpl(WrapperFactory yourFactory,
BrowserControl yourBrowserControl)
{
super(yourFactory, yourBrowserControl);
super(yourFactory, yourBrowserControl, false);
}
//
@@ -108,7 +99,7 @@ public void setBounds(Rectangle newBounds)
public void createWindow(int nativeWindow, Rectangle bounds)
{
myFactory.throwExceptionIfNotInitialized();
synchronized(myBrowserControl) {
synchronized(this) {
nativeWebShell = nativeCreateInitContext(nativeWindow, bounds.x,
@@ -233,7 +224,7 @@ public static void main(String [] args)
Log.setApplicationName("WindowControlImpl");
Log.setApplicationVersion("0.0");
Log.setApplicationVersionDate("$Id: WindowControlImpl.java,v 1.2 2000-03-07 22:10:06 ashuk%eng.sun.com Exp $");
Log.setApplicationVersionDate("$Id: WindowControlImpl.java,v 1.3 2000-03-09 23:22:52 edburns%acm.org Exp $");
try {
org.mozilla.webclient.BrowserControlFactory.setAppData(args[0]);