mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-04-10 01:45:53 +00:00

- make NavigationTest not run M build.xml - Move Win32BrowserControlCanvas up to parent package M classes_spec/org/mozilla/webclient/BrowserControlCanvas.java - You can't resize until you're initialized - pass visibility through to native layer M classes_spec/org/mozilla/webclient/impl/BrowserControlImpl.java - Use WrapperFactory to create the BrowserControlCanvas impl. A classes_spec/org/mozilla/webclient/impl/wrapper_native/Win32BrowserControlCanvas.java - moved up from child package M classes_spec/org/mozilla/webclient/impl/wrapper_native/WindowControlImpl.java - use the new thread model for nativeSetBounds(), nativeRealize(), nativeSetVisible(). M classes_spec/org/mozilla/webclient/impl/wrapper_native/WrapperFactoryImpl.java - make this create the BrowserControlCanvas instance. - honor the new package name for Win32BrowserControlCanvas. R classes_spec/org/mozilla/webclient/impl/wrapper_native/win32/Win32BrowserControlCanvas.java - moved up one level. M src_moz/EmbedWindow.cpp M src_moz/EmbedWindow.h - Take size parameters to CreateWindow_ M src_moz/Makefile.in - add WindowControlImpl.cpp M src_moz/NativeBrowserControl.cpp M src_moz/NativeBrowserControl.h - add size parameters to Realize(). M src_moz/WindowControlImpl.cpp - reactivate nativeRealize(), nativeSetVisible(), nativesetBounds(), M src_moz/win32/Win32BrowserControlCanvas.cpp - new package name M test/automated/src/classes/org/mozilla/webclient/NavigationTest.java - we have to create a Canvas to load a URL. Mozilla limitation. M test/automated/src/classes/org/mozilla/webclient/impl/wrapper_native/WrapperFactoryImplTest.java - remove unneeded test metdod
175 lines
5.1 KiB
C++
175 lines
5.1 KiB
C++
/* -*- 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>
|
|
* Ashutosh Kulkarni <ashuk@eng.sun.com>
|
|
* Ann Sunhachawee
|
|
*/
|
|
|
|
#include "nsIEventQueueService.h" // for PLEventQueue
|
|
#include "nsIServiceManager.h" // for do_GetService
|
|
#include "nsEmbedAPI.h" // for NS_HandleEmbeddingEvent
|
|
|
|
#include "EmbedWindow.h"
|
|
#include "NativeBrowserControl.h"
|
|
#include "ns_util.h"
|
|
|
|
|
|
NativeBrowserControl::NativeBrowserControl(void)
|
|
{
|
|
parentHWnd = nsnull;
|
|
mNavigation = nsnull;
|
|
mSessionHistory = nsnull;
|
|
mWindow = nsnull;
|
|
mChromeMask = 0;
|
|
mIsChrome = PR_FALSE;
|
|
mChromeLoaded = PR_FALSE;
|
|
mIsDestroyed = PR_FALSE;
|
|
}
|
|
|
|
NativeBrowserControl::~NativeBrowserControl()
|
|
{
|
|
// PENDING(edburns): assert that this widget has been destroyed
|
|
mChromeMask = 0;
|
|
mIsChrome = PR_FALSE;
|
|
mChromeLoaded = PR_FALSE;
|
|
}
|
|
|
|
nsresult
|
|
NativeBrowserControl::Init()
|
|
{
|
|
|
|
// Create our embed window, and create an owning reference to it and
|
|
// initialize it. It is assumed that this window will be destroyed
|
|
// when we go out of scope.
|
|
mWindow = new EmbedWindow();
|
|
mWindowGuard = NS_STATIC_CAST(nsIWebBrowserChrome *, mWindow);
|
|
mWindow->Init(this);
|
|
|
|
nsCOMPtr<nsIWebBrowser> webBrowser;
|
|
mWindow->GetWebBrowser(getter_AddRefs(webBrowser));
|
|
|
|
// get a handle on the navigation object
|
|
mNavigation = do_QueryInterface(webBrowser);
|
|
|
|
|
|
//
|
|
// create the WindowCreator: see
|
|
// NativeEventThread->InitializeWindowCreator
|
|
//
|
|
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
nsresult
|
|
NativeBrowserControl::Realize(void *parentWinPtr, PRBool *aAlreadyRealized,
|
|
PRUint32 width, PRUint32 height)
|
|
{
|
|
// Create our session history object and tell the navigation object
|
|
// to use it. We need to do this before we create the web browser
|
|
// window.
|
|
mSessionHistory = do_CreateInstance(NS_SHISTORY_CONTRACTID);
|
|
mNavigation->SetSessionHistory(mSessionHistory);
|
|
|
|
#ifdef XP_UNIX
|
|
PR_ASSERT(PR_FALSE);
|
|
GtkWidget *ownerAsWidget (GTK_WIDGET(parentWinPtr));
|
|
parentHWnd = ownerAsWidget;
|
|
width = ownerAsWidget->allocation.width;
|
|
height = ownerAsWidget->allocation.height;
|
|
#else
|
|
parentHWnd = (HWND) parentWinPtr;
|
|
#endif
|
|
|
|
// create the window
|
|
mWindow->CreateWindow_(width, height);
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
void
|
|
NativeBrowserControl::Unrealize(void)
|
|
{
|
|
}
|
|
|
|
void
|
|
NativeBrowserControl::Show(void)
|
|
{
|
|
// Get the nsIWebBrowser object for our embedded window.
|
|
nsCOMPtr<nsIWebBrowser> webBrowser;
|
|
mWindow->GetWebBrowser(getter_AddRefs(webBrowser));
|
|
|
|
// and set the visibility on the thing
|
|
nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(webBrowser);
|
|
baseWindow->SetVisibility(PR_TRUE);
|
|
}
|
|
|
|
void
|
|
NativeBrowserControl::Hide(void)
|
|
{
|
|
// Get the nsIWebBrowser object for our embedded window.
|
|
nsCOMPtr<nsIWebBrowser> webBrowser;
|
|
mWindow->GetWebBrowser(getter_AddRefs(webBrowser));
|
|
|
|
// and set the visibility on the thing
|
|
nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(webBrowser);
|
|
baseWindow->SetVisibility(PR_FALSE);
|
|
}
|
|
|
|
void
|
|
NativeBrowserControl::Resize(PRUint32 x, PRUint32 y,
|
|
PRUint32 aWidth, PRUint32 aHeight)
|
|
{
|
|
mWindow->SetDimensions(nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION |
|
|
nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER,
|
|
x, y, aWidth, aHeight);
|
|
}
|
|
|
|
void
|
|
NativeBrowserControl::Destroy(void)
|
|
{
|
|
mIsDestroyed = PR_TRUE;
|
|
// PENDING(edburns): take over the stuff from
|
|
// WindowControlActionEvents
|
|
// wsDeallocateInitContextEvent::handleEvent()
|
|
|
|
// This flag might have been set from
|
|
// EmbedWindow::DestroyBrowserWindow() as well if someone used a
|
|
// window.close() or something or some other script action to close
|
|
// the window. No harm setting it again.
|
|
|
|
// Get the nsIWebBrowser object for our embedded window.
|
|
nsCOMPtr<nsIWebBrowser> webBrowser;
|
|
mWindow->GetWebBrowser(getter_AddRefs(webBrowser));
|
|
|
|
// destroy our child window
|
|
mWindow->ReleaseChildren();
|
|
|
|
// release navigation
|
|
mNavigation = nsnull;
|
|
|
|
parentHWnd = nsnull;
|
|
}
|
|
|