зеркало из https://github.com/mozilla/pjs.git
Add application launcher dialog to activex control, plus some member variable cleanup. b=126245 r=chak@netscape.com sr=rpotts@netscape.com
This commit is contained in:
Родитель
5a4fc11bdc
Коммит
783379e0a4
|
@ -48,6 +48,7 @@
|
|||
#include "IEHtmlDocument.h"
|
||||
#include "PropertyDlg.h"
|
||||
#include "PromptService.h"
|
||||
#include "HelperAppDlg.h"
|
||||
#include "WindowCreator.h"
|
||||
|
||||
#include "nsCWebBrowser.h"
|
||||
|
@ -75,7 +76,11 @@ static HANDLE s_hHackedNonReentrancy = NULL;
|
|||
#define NS_PROMPTSERVICE_CID \
|
||||
{0xa2112d6a, 0x0e28, 0x421f, {0xb4, 0x6a, 0x25, 0xc0, 0xb3, 0x8, 0xcb, 0xd0}}
|
||||
|
||||
#define NS_HELPERAPPLAUNCHERDIALOG_CID \
|
||||
{0xf68578eb, 0x6ec2, 0x4169, {0xae, 0x19, 0x8c, 0x62, 0x43, 0xf0, 0xab, 0xe1}}
|
||||
|
||||
static NS_DEFINE_CID(kPromptServiceCID, NS_PROMPTSERVICE_CID);
|
||||
static NS_DEFINE_CID(kHelperAppLauncherDialogCID, NS_HELPERAPPLAUNCHERDIALOG_CID);
|
||||
|
||||
// Macros to return errors from bad calls to the automation
|
||||
// interfaces and sets a descriptive string on IErrorInfo so VB programmers
|
||||
|
@ -735,7 +740,7 @@ LRESULT CMozillaBrowser::OnViewSource(WORD wNotifyCode, WORD wID, HWND hWndCtl,
|
|||
{
|
||||
NG_TRACE_METHOD(CMozillaBrowser::OnViewSource);
|
||||
|
||||
if (mWebBrowserContainer->m_pCurrentURI)
|
||||
if (mWebBrowserContainer->mCurrentURI)
|
||||
{
|
||||
// No URI to view!
|
||||
NG_ASSERT(0);
|
||||
|
@ -744,7 +749,7 @@ LRESULT CMozillaBrowser::OnViewSource(WORD wNotifyCode, WORD wID, HWND hWndCtl,
|
|||
|
||||
// Get the current URI
|
||||
nsCAutoString aURI;
|
||||
mWebBrowserContainer->m_pCurrentURI->GetSpec(aURI);
|
||||
mWebBrowserContainer->mCurrentURI->GetSpec(aURI);
|
||||
|
||||
nsAutoString strURI;
|
||||
strURI.Assign(NS_LITERAL_STRING("view-source:"));
|
||||
|
@ -1045,6 +1050,15 @@ HRESULT CMozillaBrowser::Initialize()
|
|||
promptFactory,
|
||||
PR_TRUE); // replace existing
|
||||
|
||||
// Helper app launcher dialog
|
||||
nsCOMPtr<nsIFactory> helperAppDlgFactory;
|
||||
rv = NS_NewHelperAppLauncherDlgFactory(getter_AddRefs(helperAppDlgFactory));
|
||||
rv = nsComponentManager::RegisterFactory(kHelperAppLauncherDialogCID,
|
||||
"Helper App Launcher Dialog",
|
||||
"@mozilla.org/helperapplauncherdialog;1",
|
||||
helperAppDlgFactory,
|
||||
PR_TRUE); // replace existing
|
||||
|
||||
// create our local object
|
||||
CWindowCreator *creator = new CWindowCreator();
|
||||
nsCOMPtr<nsIWindowCreator> windowCreator;
|
||||
|
@ -1104,8 +1118,6 @@ HRESULT CMozillaBrowser::CreateBrowser()
|
|||
|
||||
nsresult rv;
|
||||
|
||||
PRBool aAllowPlugins = PR_TRUE;
|
||||
|
||||
// Create the web browser
|
||||
mWebBrowser = do_CreateInstance(NS_WEBBROWSER_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
|
@ -1118,8 +1130,14 @@ HRESULT CMozillaBrowser::CreateBrowser()
|
|||
|
||||
// Configure what the web browser can and cannot do
|
||||
nsCOMPtr<nsIWebBrowserSetup> webBrowserAsSetup(do_QueryInterface(mWebBrowser));
|
||||
// webBrowserAsSetup->SetProperty(nsIWebBrowserSetup::SETUP_ALLOW_PLUGINS, aAllowPlugins);
|
||||
// webBrowserAsSetup->SetProperty(nsIWebBrowserSetup::SETUP_CONTAINS_CHROME, PR_TRUE);
|
||||
|
||||
// Allow plugins?
|
||||
const PRBool kAllowPlugins = PR_TRUE;
|
||||
webBrowserAsSetup->SetProperty(nsIWebBrowserSetup::SETUP_ALLOW_PLUGINS, kAllowPlugins);
|
||||
|
||||
// Host chrome or content?
|
||||
const PRBool kHostChrome = PR_FALSE; // Hardcoded for now
|
||||
webBrowserAsSetup->SetProperty(nsIWebBrowserSetup::SETUP_IS_CHROME_WRAPPER, PR_FALSE);
|
||||
|
||||
// Create the webbrowser window
|
||||
mWebBrowserAsWin = do_QueryInterface(mWebBrowser);
|
||||
|
|
|
@ -106,6 +106,10 @@ SOURCE=.\guids.cpp
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\HelperAppDlg.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\IEHtmlDocument.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
@ -210,6 +214,10 @@ SOURCE=.\guids.h
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\HelperAppDlg.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\IEHtmlDocument.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
|
@ -217,9 +217,9 @@ STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
|||
CAPTION "Confirmation"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "0",IDC_BUTTON0,204,74,50,14
|
||||
PUSHBUTTON "2",IDC_BUTTON2,88,74,50,14
|
||||
PUSHBUTTON "1",IDC_BUTTON1,146,74,50,14
|
||||
DEFPUSHBUTTON "0",IDC_BUTTON0,195,75,65,14
|
||||
PUSHBUTTON "2",IDC_BUTTON2,55,75,65,14
|
||||
PUSHBUTTON "1",IDC_BUTTON1,125,75,65,14
|
||||
ICON IDI_MOZILLABROWSER,IDC_QUESTION,7,7,20,20
|
||||
LTEXT "Message",IDC_MESSAGE,36,7,220,41
|
||||
CONTROL "Check Msg",IDC_CHECKMSG,"Button",BS_AUTOCHECKBOX |
|
||||
|
@ -357,6 +357,95 @@ END
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// 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_HELPERAPP DIALOG DISCARDABLE 0, 0, 285, 161
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Downloading"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
ICON IDI_MOZILLABROWSER,IDC_STATIC,7,7,21,20
|
||||
LTEXT "You have chosen to download a file that requires special handling. What would you like to do with this file?",
|
||||
IDC_MESSAGE,34,7,244,21
|
||||
CONTROL "Open with the specified application",IDC_OPENWITHAPP,
|
||||
"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,7,40,
|
||||
219,10
|
||||
PUSHBUTTON "&Choose...",IDC_CHOOSE,228,38,50,14
|
||||
CONTROL "Save to file",IDC_SAVETOFILE,"Button",
|
||||
BS_AUTORADIOBUTTON,7,53,51,10
|
||||
GROUPBOX "Details",IDC_STATIC,7,68,271,67
|
||||
DEFPUSHBUTTON "OK",IDOK,173,139,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,228,139,50,14
|
||||
LTEXT "Location:",IDC_STATIC,13,82,30,8
|
||||
EDITTEXT IDC_URL,63,79,208,14,ES_AUTOHSCROLL | ES_READONLY
|
||||
LTEXT "Content Type:",IDC_STATIC,13,99,46,8
|
||||
EDITTEXT IDC_CONTENTTYPE,63,96,208,14,ES_AUTOHSCROLL |
|
||||
ES_READONLY
|
||||
LTEXT "Application:",IDC_STATIC,13,116,38,8
|
||||
EDITTEXT IDC_APPLICATION,63,113,208,14,ES_AUTOHSCROLL |
|
||||
ES_READONLY
|
||||
END
|
||||
|
||||
IDD_PROGRESS DIALOG DISCARDABLE 0, 0, 244, 102
|
||||
STYLE DS_MODALFRAME | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION |
|
||||
WS_SYSMENU
|
||||
CAPTION "Dialog"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
LTEXT "Download progress:",IDC_STATIC,7,7,150,8
|
||||
CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER,7,
|
||||
23,230,10
|
||||
LTEXT "Source:",IDC_STATIC,7,44,26,8
|
||||
EDITTEXT IDC_SOURCE,50,42,187,14,ES_AUTOHSCROLL | ES_READONLY
|
||||
LTEXT "Destination:",IDC_STATIC,7,64,38,8
|
||||
EDITTEXT IDC_DESTINATION,50,62,187,14,ES_AUTOHSCROLL |
|
||||
ES_READONLY
|
||||
PUSHBUTTON "Cancel",IDCANCEL,96,81,50,14
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO DISCARDABLE
|
||||
BEGIN
|
||||
IDD_HELPERAPP, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 278
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 153
|
||||
END
|
||||
|
||||
IDD_PROGRESS, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 237
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 95
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#endif // English (Ireland) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -47,13 +47,13 @@
|
|||
#include "nsICategoryManager.h"
|
||||
#include "nsReadableUtils.h"
|
||||
|
||||
CWebBrowserContainer::CWebBrowserContainer(CMozillaBrowser *pOwner)
|
||||
CWebBrowserContainer::CWebBrowserContainer(CMozillaBrowser *pOwner) :
|
||||
mOwner(pOwner),
|
||||
mEvents1(mOwner),
|
||||
mEvents2(mOwner),
|
||||
mVisible(PR_TRUE)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
m_pOwner = pOwner;
|
||||
m_pEvents1 = m_pOwner;
|
||||
m_pEvents2 = m_pOwner;
|
||||
m_pCurrentURI = nsnull;
|
||||
}
|
||||
|
||||
|
||||
|
@ -74,6 +74,7 @@ NS_INTERFACE_MAP_BEGIN(CWebBrowserContainer)
|
|||
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChrome)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIURIContentListener)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIEmbeddingSiteWindow)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIEmbeddingSiteWindow2)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIRequestObserver)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIContextMenuListener)
|
||||
|
@ -97,7 +98,7 @@ NS_IMETHODIMP CWebBrowserContainer::GetInterface(const nsIID & uuid, void * *res
|
|||
|
||||
NS_IMETHODIMP CWebBrowserContainer::OnShowContextMenu(PRUint32 aContextFlags, nsIDOMEvent *aEvent, nsIDOMNode *aNode)
|
||||
{
|
||||
m_pOwner->ShowContextMenu(aContextFlags, aEvent, aNode);
|
||||
mOwner->ShowContextMenu(aContextFlags, aEvent, aNode);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -125,15 +126,12 @@ NS_IMETHODIMP CWebBrowserContainer::OnProgressChange(nsIWebProgress *aProgress,
|
|||
nProgress = nProgressMax; // Progress complete
|
||||
}
|
||||
|
||||
m_pEvents1->Fire_ProgressChange(nProgress, nProgressMax);
|
||||
m_pEvents2->Fire_ProgressChange(nProgress, nProgressMax);
|
||||
mEvents1->Fire_ProgressChange(nProgress, nProgressMax);
|
||||
mEvents2->Fire_ProgressChange(nProgress, nProgressMax);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest request, in unsigned long progressStateFlags, in unsinged long aStatus); */
|
||||
NS_IMETHODIMP CWebBrowserContainer::OnStateChange(nsIWebProgress* aWebProgress, nsIRequest *aRequest, PRUint32 progressStateFlags, nsresult aStatus)
|
||||
{
|
||||
|
@ -162,23 +160,23 @@ NS_IMETHODIMP CWebBrowserContainer::OnStateChange(nsIWebProgress* aWebProgress,
|
|||
}
|
||||
|
||||
//Fire a DownloadBegin
|
||||
m_pEvents1->Fire_DownloadBegin();
|
||||
m_pEvents2->Fire_DownloadBegin();
|
||||
mEvents1->Fire_DownloadBegin();
|
||||
mEvents2->Fire_DownloadBegin();
|
||||
}
|
||||
else if (progressStateFlags & STATE_STOP)
|
||||
{
|
||||
NG_TRACE(_T("CWebBrowserContainer::OnStateChange->Doc Stop(..., \"\")\n"));
|
||||
|
||||
if (m_pOwner->mIERootDocument)
|
||||
if (mOwner->mIERootDocument)
|
||||
{
|
||||
// allow to keep old document around
|
||||
m_pOwner->mIERootDocument->Release();
|
||||
m_pOwner->mIERootDocument = NULL;
|
||||
mOwner->mIERootDocument->Release();
|
||||
mOwner->mIERootDocument = NULL;
|
||||
}
|
||||
|
||||
//Fire a DownloadComplete
|
||||
m_pEvents1->Fire_DownloadComplete();
|
||||
m_pEvents2->Fire_DownloadComplete();
|
||||
mEvents1->Fire_DownloadComplete();
|
||||
mEvents2->Fire_DownloadComplete();
|
||||
|
||||
nsCOMPtr<nsIURI> pURI;
|
||||
|
||||
|
@ -197,13 +195,13 @@ NS_IMETHODIMP CWebBrowserContainer::OnStateChange(nsIWebProgress* aWebProgress,
|
|||
|
||||
// Fire a DocumentComplete event
|
||||
CComVariant vURI(bstrURI);
|
||||
m_pEvents2->Fire_DocumentComplete(m_pOwner, &vURI);
|
||||
mEvents2->Fire_DocumentComplete(mOwner, &vURI);
|
||||
SysFreeString(bstrURI);
|
||||
|
||||
//Fire a StatusTextChange event
|
||||
BSTR bstrStatus = SysAllocString(A2OLE((CHAR *) "Done"));
|
||||
m_pEvents1->Fire_StatusTextChange(bstrStatus);
|
||||
m_pEvents2->Fire_StatusTextChange(bstrStatus);
|
||||
mEvents1->Fire_StatusTextChange(bstrStatus);
|
||||
mEvents2->Fire_StatusTextChange(bstrStatus);
|
||||
SysFreeString(bstrStatus);
|
||||
}
|
||||
|
||||
|
@ -211,7 +209,6 @@ NS_IMETHODIMP CWebBrowserContainer::OnStateChange(nsIWebProgress* aWebProgress,
|
|||
|
||||
if (progressStateFlags & STATE_IS_NETWORK)
|
||||
{
|
||||
|
||||
if (progressStateFlags & STATE_START)
|
||||
{
|
||||
// TODO
|
||||
|
@ -220,24 +217,24 @@ NS_IMETHODIMP CWebBrowserContainer::OnStateChange(nsIWebProgress* aWebProgress,
|
|||
if (progressStateFlags & STATE_STOP)
|
||||
{
|
||||
nsCAutoString aURI;
|
||||
if (m_pCurrentURI)
|
||||
if (mCurrentURI)
|
||||
{
|
||||
m_pCurrentURI->GetAsciiSpec(aURI);
|
||||
mCurrentURI->GetAsciiSpec(aURI);
|
||||
}
|
||||
|
||||
// Fire a NavigateComplete event
|
||||
USES_CONVERSION;
|
||||
BSTR bstrURI = SysAllocString(A2OLE(aURI.get()));
|
||||
m_pEvents1->Fire_NavigateComplete(bstrURI);
|
||||
mEvents1->Fire_NavigateComplete(bstrURI);
|
||||
|
||||
// Fire a NavigateComplete2 event
|
||||
CComVariant vURI(bstrURI);
|
||||
m_pEvents2->Fire_NavigateComplete2(m_pOwner, &vURI);
|
||||
mEvents2->Fire_NavigateComplete2(mOwner, &vURI);
|
||||
|
||||
// Cleanup
|
||||
SysFreeString(bstrURI);
|
||||
|
||||
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(m_pOwner->mWebBrowser));
|
||||
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mOwner->mWebBrowser));
|
||||
|
||||
// Fire the new NavigateForward state
|
||||
VARIANT_BOOL bEnableForward = VARIANT_FALSE;
|
||||
|
@ -247,7 +244,7 @@ NS_IMETHODIMP CWebBrowserContainer::OnStateChange(nsIWebProgress* aWebProgress,
|
|||
{
|
||||
bEnableForward = VARIANT_TRUE;
|
||||
}
|
||||
m_pEvents2->Fire_CommandStateChange(CSC_NAVIGATEFORWARD, bEnableForward);
|
||||
mEvents2->Fire_CommandStateChange(CSC_NAVIGATEFORWARD, bEnableForward);
|
||||
|
||||
// Fire the new NavigateBack state
|
||||
VARIANT_BOOL bEnableBack = VARIANT_FALSE;
|
||||
|
@ -257,14 +254,11 @@ NS_IMETHODIMP CWebBrowserContainer::OnStateChange(nsIWebProgress* aWebProgress,
|
|||
{
|
||||
bEnableBack = VARIANT_TRUE;
|
||||
}
|
||||
m_pEvents2->Fire_CommandStateChange(CSC_NAVIGATEBACK, bEnableBack);
|
||||
mEvents2->Fire_CommandStateChange(CSC_NAVIGATEBACK, bEnableBack);
|
||||
|
||||
m_pOwner->mBusyFlag = FALSE;
|
||||
mOwner->mBusyFlag = FALSE;
|
||||
|
||||
if (m_pCurrentURI)
|
||||
{
|
||||
NS_RELEASE(m_pCurrentURI);
|
||||
}
|
||||
mCurrentURI = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -291,8 +285,8 @@ CWebBrowserContainer::OnStatusChange(nsIWebProgress* aWebProgress,
|
|||
NG_TRACE(_T("CWebBrowserContainer::OnStatusChange(..., \"\")\n"));
|
||||
|
||||
BSTR bstrStatus = SysAllocString(W2OLE((PRUnichar *) aMessage));
|
||||
m_pEvents1->Fire_StatusTextChange(bstrStatus);
|
||||
m_pEvents2->Fire_StatusTextChange(bstrStatus);
|
||||
mEvents1->Fire_StatusTextChange(bstrStatus);
|
||||
mEvents2->Fire_StatusTextChange(bstrStatus);
|
||||
SysFreeString(bstrStatus);
|
||||
|
||||
return NS_OK;
|
||||
|
@ -316,16 +310,11 @@ NS_IMETHODIMP CWebBrowserContainer::OnStartURIOpen(nsIURI *pURI, PRBool *aAbortO
|
|||
USES_CONVERSION;
|
||||
NG_TRACE(_T("CWebBrowserContainer::OnStartURIOpen(...)\n"));
|
||||
|
||||
if (m_pCurrentURI)
|
||||
{
|
||||
NS_RELEASE(m_pCurrentURI);
|
||||
}
|
||||
m_pCurrentURI = pURI;
|
||||
NG_ASSERT(m_pCurrentURI);
|
||||
m_pCurrentURI->AddRef();
|
||||
mCurrentURI = pURI;
|
||||
NG_ASSERT(mCurrentURI);
|
||||
|
||||
nsCAutoString aURI;
|
||||
m_pCurrentURI->GetSpec(aURI);
|
||||
mCurrentURI->GetSpec(aURI);
|
||||
|
||||
// Setup the post data
|
||||
CComVariant vPostDataRef;
|
||||
|
@ -342,7 +331,7 @@ NS_IMETHODIMP CWebBrowserContainer::OnStartURIOpen(nsIURI *pURI, PRBool *aAbortO
|
|||
VARIANT_BOOL bCancel = VARIANT_FALSE;
|
||||
long lFlags = 0;
|
||||
|
||||
m_pEvents1->Fire_BeforeNavigate(bstrURI, lFlags, bstrTargetFrameName, &vPostDataRef, bstrHeaders, &bCancel);
|
||||
mEvents1->Fire_BeforeNavigate(bstrURI, lFlags, bstrTargetFrameName, &vPostDataRef, bstrHeaders, &bCancel);
|
||||
|
||||
// Fire a BeforeNavigate2 event
|
||||
CComVariant vURI(bstrURI);
|
||||
|
@ -350,7 +339,7 @@ NS_IMETHODIMP CWebBrowserContainer::OnStartURIOpen(nsIURI *pURI, PRBool *aAbortO
|
|||
CComVariant vTargetFrameName(bstrTargetFrameName);
|
||||
CComVariant vHeaders(bstrHeaders);
|
||||
|
||||
m_pEvents2->Fire_BeforeNavigate2(m_pOwner, &vURI, &vFlags, &vTargetFrameName, &vPostDataRef, &vHeaders, &bCancel);
|
||||
mEvents2->Fire_BeforeNavigate2(mOwner, &vURI, &vFlags, &vTargetFrameName, &vPostDataRef, &vHeaders, &bCancel);
|
||||
|
||||
// Cleanup
|
||||
SysFreeString(bstrURI);
|
||||
|
@ -364,10 +353,10 @@ NS_IMETHODIMP CWebBrowserContainer::OnStartURIOpen(nsIURI *pURI, PRBool *aAbortO
|
|||
}
|
||||
else
|
||||
{
|
||||
m_pOwner->mBusyFlag = TRUE;
|
||||
mOwner->mBusyFlag = TRUE;
|
||||
}
|
||||
|
||||
//NOTE: The IE control fires a DownloadBegin after the first BeforeNavigate.
|
||||
//NOTE: The IE control fires a DownloadBegin after the first BeforeNavigate.
|
||||
// It then fires a DownloadComplete after the engine has made it's
|
||||
// initial connection to the server. It then fires a second
|
||||
// DownloadBegin/DownloadComplete pair around the loading of
|
||||
|
@ -379,10 +368,10 @@ NS_IMETHODIMP CWebBrowserContainer::OnStartURIOpen(nsIURI *pURI, PRBool *aAbortO
|
|||
// here simulates, appeasing applications that are expecting that
|
||||
// initial pair.
|
||||
|
||||
m_pEvents1->Fire_DownloadBegin();
|
||||
m_pEvents2->Fire_DownloadBegin();
|
||||
m_pEvents1->Fire_DownloadComplete();
|
||||
m_pEvents2->Fire_DownloadComplete();
|
||||
mEvents1->Fire_DownloadBegin();
|
||||
mEvents2->Fire_DownloadBegin();
|
||||
mEvents1->Fire_DownloadComplete();
|
||||
mEvents2->Fire_DownloadComplete();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -460,28 +449,49 @@ NS_IMETHODIMP CWebBrowserContainer::SetParentContentListener(nsIURIContentListen
|
|||
NS_IMETHODIMP
|
||||
CWebBrowserContainer::GetDimensions(PRUint32 aFlags, PRInt32 *x, PRInt32 *y, PRInt32 *cx, PRInt32 *cy)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
RECT rc = { 0, 0, 1, 1 };
|
||||
mOwner->GetClientRect(&rc);
|
||||
if (aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION)
|
||||
{
|
||||
if (*x)
|
||||
*x = rc.left;
|
||||
if (*y)
|
||||
*y = rc.top;
|
||||
}
|
||||
if (aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER ||
|
||||
aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER)
|
||||
{
|
||||
if (*cx)
|
||||
*cx = rc.right - rc.left;
|
||||
if (*cy)
|
||||
*cy = rc.bottom - rc.top;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebBrowserContainer::SetDimensions(PRUint32 aFlags, PRInt32 x, PRInt32 y, PRInt32 cx, PRInt32 cy)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
// Ignore
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebBrowserContainer::GetSiteWindow(void **aParentNativeWindow)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ENSURE_ARG_POINTER(aParentNativeWindow);
|
||||
HWND *hwndDest = (HWND *) aParentNativeWindow;
|
||||
*hwndDest = mOwner->m_hWnd;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebBrowserContainer::SetFocus(void)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
@ -492,7 +502,7 @@ CWebBrowserContainer::GetTitle(PRUnichar * *aTitle)
|
|||
if (!aTitle)
|
||||
return E_INVALIDARG;
|
||||
|
||||
*aTitle = ToNewUnicode(m_sTitle);
|
||||
*aTitle = ToNewUnicode(mTitle);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -505,11 +515,11 @@ CWebBrowserContainer::SetTitle(const PRUnichar * aTitle)
|
|||
if (!aTitle)
|
||||
return E_INVALIDARG;
|
||||
|
||||
m_sTitle = aTitle;
|
||||
mTitle = aTitle;
|
||||
// Fire a TitleChange event
|
||||
BSTR bstrTitle = SysAllocString(aTitle);
|
||||
m_pEvents1->Fire_TitleChange(bstrTitle);
|
||||
m_pEvents2->Fire_TitleChange(bstrTitle);
|
||||
mEvents1->Fire_TitleChange(bstrTitle);
|
||||
mEvents2->Fire_TitleChange(bstrTitle);
|
||||
SysFreeString(bstrTitle);
|
||||
|
||||
return NS_OK;
|
||||
|
@ -519,14 +529,31 @@ CWebBrowserContainer::SetTitle(const PRUnichar * aTitle)
|
|||
NS_IMETHODIMP
|
||||
CWebBrowserContainer::GetVisibility(PRBool *aVisibility)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
NS_ENSURE_ARG_POINTER(aVisibility);
|
||||
*aVisibility = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebBrowserContainer::SetVisibility(PRBool aVisibility)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
VARIANT_BOOL visible = aVisibility ? VARIANT_TRUE : VARIANT_FALSE;
|
||||
mVisible = aVisibility;
|
||||
// Fire an OnVisible event
|
||||
mEvents2->Fire_OnVisible(visible);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// nsIEmbeddingSiteWindow2
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebBrowserContainer::Blur()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
@ -537,18 +564,20 @@ NS_IMETHODIMP
|
|||
CWebBrowserContainer::FocusNextElement()
|
||||
{
|
||||
ATLTRACE(_T("CWebBrowserContainer::FocusNextElement()\n"));
|
||||
m_pOwner->NextDlgControl();
|
||||
mOwner->NextDlgControl();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
CWebBrowserContainer::FocusPrevElement()
|
||||
{
|
||||
ATLTRACE(_T("CWebBrowserContainer::FocusPrevElement()\n"));
|
||||
m_pOwner->PrevDlgControl();
|
||||
mOwner->PrevDlgControl();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// nsIWebBrowserChrome implementation
|
||||
|
||||
|
@ -557,8 +586,8 @@ CWebBrowserContainer::SetStatus(PRUint32 statusType, const PRUnichar *status)
|
|||
{
|
||||
//Fire a StatusTextChange event
|
||||
BSTR bstrStatus = SysAllocString(status);
|
||||
m_pEvents1->Fire_StatusTextChange(bstrStatus);
|
||||
m_pEvents2->Fire_StatusTextChange(bstrStatus);
|
||||
mEvents1->Fire_StatusTextChange(bstrStatus);
|
||||
mEvents2->Fire_StatusTextChange(bstrStatus);
|
||||
SysFreeString(bstrStatus);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -648,8 +677,8 @@ CWebBrowserContainer::OnStopRequest(nsIRequest *request, nsISupports* aContext,
|
|||
NG_TRACE(_T("CWebBrowserContainer::OnStopRequest(..., %d)\n"), (int) aStatus);
|
||||
|
||||
// Fire a DownloadComplete event
|
||||
m_pEvents1->Fire_DownloadComplete();
|
||||
m_pEvents2->Fire_DownloadComplete();
|
||||
mEvents1->Fire_DownloadComplete();
|
||||
mEvents2->Fire_DownloadComplete();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "nsITooltipListener.h"
|
||||
#include "nsICommandHandler.h"
|
||||
#include "nsIEmbeddingSiteWindow.h"
|
||||
#include "nsIEmbeddingSiteWindow2.h"
|
||||
#include "nsIURIContentListener.h"
|
||||
#include "nsIWebBrowserChromeFocus.h"
|
||||
#include "nsWeakReference.h"
|
||||
|
@ -51,7 +52,7 @@
|
|||
// interfaces into the web shell and so forth.
|
||||
|
||||
class CWebBrowserContainer :
|
||||
public nsIEmbeddingSiteWindow,
|
||||
public nsIEmbeddingSiteWindow2,
|
||||
public nsIWebBrowserChrome,
|
||||
public nsIWebProgressListener,
|
||||
public nsIRequestObserver,
|
||||
|
@ -73,15 +74,17 @@ protected:
|
|||
|
||||
// Protected members
|
||||
protected:
|
||||
CMozillaBrowser *m_pOwner;
|
||||
nsString m_sTitle;
|
||||
nsIURI *m_pCurrentURI;
|
||||
CDWebBrowserEvents1 *m_pEvents1;
|
||||
CDWebBrowserEvents2 *m_pEvents2;
|
||||
CMozillaBrowser *mOwner;
|
||||
nsCOMPtr<nsIURI> mCurrentURI;
|
||||
CDWebBrowserEvents1 *mEvents1;
|
||||
CDWebBrowserEvents2 *mEvents2;
|
||||
nsString mTitle;
|
||||
PRPackedBool mVisible;
|
||||
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIEMBEDDINGSITEWINDOW
|
||||
NS_DECL_NSIEMBEDDINGSITEWINDOW2
|
||||
NS_DECL_NSIWEBBROWSERCHROME
|
||||
NS_DECL_NSIURICONTENTLISTENER
|
||||
NS_DECL_NSIREQUESTOBSERVER
|
||||
|
|
|
@ -76,9 +76,9 @@ CWindowCreator::CreateChromeWindow(nsIWebBrowserChrome *aParent, PRUint32 aChrom
|
|||
VARIANT_BOOL bCancel = VARIANT_FALSE;
|
||||
|
||||
// Test if the event sink can give us a new window to navigate into
|
||||
if (pContainer->m_pEvents2)
|
||||
if (pContainer->mEvents2)
|
||||
{
|
||||
pContainer->m_pEvents2->Fire_NewWindow2(&dispNew, &bCancel);
|
||||
pContainer->mEvents2->Fire_NewWindow2(&dispNew, &bCancel);
|
||||
if ((bCancel == VARIANT_FALSE) && dispNew)
|
||||
{
|
||||
CComQIPtr<IMozControlBridge> cpBridge = dispNew;
|
||||
|
|
|
@ -26,9 +26,20 @@
|
|||
#define IDD_PPAGE_LINK 210
|
||||
#define IDC_ADDRESS 210
|
||||
#define IDD_CONFIRMEX 211
|
||||
#define IDD_HELPERAPP 212
|
||||
#define IDC_VALUE 213
|
||||
#define IDD_PROGRESS 213
|
||||
#define IDC_USERNAME 214
|
||||
#define IDC_PASSWORD 215
|
||||
#define IDC_CHOOSE 218
|
||||
#define IDC_URL 222
|
||||
#define IDC_CONTENTTYPE 223
|
||||
#define IDC_APPLICATION 224
|
||||
#define IDC_SOURCE 225
|
||||
#define IDC_DESTINATION 226
|
||||
#define IDC_PROGRESS 227
|
||||
#define IDC_OPENWITHAPP 300
|
||||
#define IDC_SAVETOFILE 301
|
||||
#define IDS_LOCATEMOZILLA 1000
|
||||
#define IDS_LOCATEMOZILLATITLE 1001
|
||||
#define IDS_CANNOTCREATEPREFS 1002
|
||||
|
@ -78,9 +89,9 @@
|
|||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 211
|
||||
#define _APS_NEXT_RESOURCE_VALUE 214
|
||||
#define _APS_NEXT_COMMAND_VALUE 32792
|
||||
#define _APS_NEXT_CONTROL_VALUE 216
|
||||
#define _APS_NEXT_CONTROL_VALUE 228
|
||||
#define _APS_NEXT_SYMED_VALUE 102
|
||||
#endif
|
||||
#endif
|
||||
|
|
Загрузка…
Ссылка в новой задаче