Back to index

lightning-sunbird  0.9+nobinonly
WebBrowserContainer.cpp
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *   Adam Lock <adamlock@eircom.net>
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either the GNU General Public License Version 2 or later (the "GPL"), or
00027  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 
00039 #include "stdafx.h"
00040 
00041 #include <limits.h>
00042 #include <shlobj.h>
00043 
00044 #include "WebBrowserContainer.h"
00045 
00046 #include "nsReadableUtils.h"
00047 
00048 #include "nsServiceManagerUtils.h"
00049 #include "nsIWebNavigationInfo.h"
00050 
00051 CWebBrowserContainer::CWebBrowserContainer(CMozillaBrowser *pOwner) :
00052     mOwner(pOwner),
00053     mEvents1(mOwner),
00054     mEvents2(mOwner),
00055     mVisible(PR_TRUE)
00056 {
00057 }
00058 
00059 
00060 CWebBrowserContainer::~CWebBrowserContainer()
00061 {
00062 }
00063 
00064 
00066 // nsISupports implementation
00067 
00068 NS_IMPL_ADDREF(CWebBrowserContainer)
00069 NS_IMPL_RELEASE(CWebBrowserContainer)
00070 
00071 NS_INTERFACE_MAP_BEGIN(CWebBrowserContainer)
00072     NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIWebBrowserChrome)
00073     NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
00074     NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChrome)
00075     NS_INTERFACE_MAP_ENTRY(nsIURIContentListener)
00076     NS_INTERFACE_MAP_ENTRY(nsIEmbeddingSiteWindow)
00077     NS_INTERFACE_MAP_ENTRY(nsIEmbeddingSiteWindow2)
00078     NS_INTERFACE_MAP_ENTRY(nsIRequestObserver)
00079     NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener)
00080     NS_INTERFACE_MAP_ENTRY(nsIContextMenuListener)
00081     NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChromeFocus)
00082 //    NS_INTERFACE_MAP_ENTRY(nsICommandHandler)
00083     NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
00084 NS_INTERFACE_MAP_END
00085 
00086 
00088 // nsIInterfaceRequestor
00089 
00090 NS_IMETHODIMP CWebBrowserContainer::GetInterface(const nsIID & aIID, void * *result)
00091 {
00092     *result = 0;
00093     if (aIID.Equals(NS_GET_IID(nsIDOMWindow)))
00094     {
00095         if (mOwner && mOwner->mWebBrowser)
00096         {
00097             return mOwner->mWebBrowser->GetContentDOMWindow((nsIDOMWindow **) result);
00098         }
00099         return NS_ERROR_NOT_INITIALIZED;
00100     }
00101     return QueryInterface(aIID, result);
00102 }
00103 
00104 
00106 // nsIContextMenuListener
00107 
00108 NS_IMETHODIMP CWebBrowserContainer::OnShowContextMenu(PRUint32 aContextFlags, nsIDOMEvent *aEvent, nsIDOMNode *aNode)
00109 {
00110     mOwner->ShowContextMenu(aContextFlags, aEvent, aNode);
00111     return NS_OK;
00112 }
00113 
00114 
00116 // nsIWebProgressListener
00117 
00118 /* void onProgressChange (in nsIWebProgress aProgress, in nsIRequest aRequest, in long curSelfProgress, in long maxSelfProgress, in long curTotalProgress, in long maxTotalProgress); */
00119 NS_IMETHODIMP CWebBrowserContainer::OnProgressChange(nsIWebProgress *aProgress, nsIRequest *aRequest, PRInt32 curSelfProgress, PRInt32 maxSelfProgress, PRInt32 curTotalProgress, PRInt32 maxTotalProgress)
00120 {
00121     NG_TRACE(_T("CWebBrowserContainer::OnProgressChange(...)\n"));
00122     
00123     long nProgress = curTotalProgress;
00124     long nProgressMax = maxTotalProgress;
00125 
00126     if (nProgress == 0)
00127     {
00128     }
00129     if (nProgressMax == 0)
00130     {
00131         nProgressMax = LONG_MAX;
00132     }
00133     if (nProgress > nProgressMax)
00134     {
00135         nProgress = nProgressMax; // Progress complete
00136     }
00137 
00138     mEvents1->Fire_ProgressChange(nProgress, nProgressMax);
00139     mEvents2->Fire_ProgressChange(nProgress, nProgressMax);
00140 
00141     return NS_OK;
00142 }
00143 
00144 /* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest request, in unsigned long progressStateFlags, in unsinged long aStatus); */
00145 NS_IMETHODIMP CWebBrowserContainer::OnStateChange(nsIWebProgress* aWebProgress, nsIRequest *aRequest, PRUint32 progressStateFlags, nsresult aStatus)
00146 {
00147     nsresult rv = NS_OK;
00148 
00149     NG_TRACE(_T("CWebBrowserContainer::OnStateChange(...)\n"));
00150 
00151     BOOL doFireCommandStateChange = FALSE;
00152 
00153     // determine whether or not the document load has started or stopped.
00154     if (progressStateFlags & STATE_IS_DOCUMENT)
00155     {
00156         if (progressStateFlags & STATE_START)
00157         {
00158             NG_TRACE(_T("CWebBrowserContainer::OnStateChange->Doc Start(...,  \"\")\n"));
00159 
00160             nsCOMPtr<nsIChannel> channel(do_QueryInterface(aRequest));
00161             if (channel)
00162             {
00163                 nsCOMPtr<nsIURI> uri;
00164                 rv = channel->GetURI(getter_AddRefs(uri));
00165                 if (NS_SUCCEEDED(rv))
00166                 {
00167                     nsCAutoString aURI;
00168                     uri->GetAsciiSpec(aURI);
00169                     NG_TRACE(_T("CWebBrowserContainer::OnStateChange->Doc Start(..., %s, \"\")\n"), A2CT(aURI.get()));
00170                 }
00171             }
00172 
00173             //Fire a DownloadBegin
00174             mEvents1->Fire_DownloadBegin();
00175             mEvents2->Fire_DownloadBegin();
00176         }
00177         else if (progressStateFlags & STATE_STOP)
00178         {
00179             NG_TRACE(_T("CWebBrowserContainer::OnStateChange->Doc Stop(...,  \"\")\n"));
00180 
00181             if (mOwner->mIERootDocument)
00182             {
00183                 // allow to keep old document around
00184                 mOwner->mIERootDocument->Release();
00185                 mOwner->mIERootDocument = NULL;
00186             }
00187 
00188             //Fire a DownloadComplete
00189             mEvents1->Fire_DownloadComplete();
00190             mEvents2->Fire_DownloadComplete();
00191 
00192             nsCOMPtr<nsIURI> pURI;
00193 
00194             nsCOMPtr<nsIChannel> aChannel = do_QueryInterface(aRequest);
00195             if (!aChannel) return NS_ERROR_NULL_POINTER;
00196 
00197             rv = aChannel->GetURI(getter_AddRefs(pURI));
00198             if (NS_FAILED(rv)) return NS_OK;
00199 
00200             nsCAutoString aURI;
00201             rv = pURI->GetAsciiSpec(aURI);
00202             if (NS_FAILED(rv)) return NS_OK;
00203 
00204             USES_CONVERSION;
00205             BSTR bstrURI = SysAllocString(A2OLE(aURI.get())); 
00206                 
00207             // Fire a DocumentComplete event
00208             CComVariant vURI(bstrURI);
00209             mEvents2->Fire_DocumentComplete(mOwner, &vURI);
00210             SysFreeString(bstrURI);
00211 
00212             //Fire a StatusTextChange event
00213             BSTR bstrStatus = SysAllocString(A2OLE((CHAR *) "Done"));
00214             mEvents1->Fire_StatusTextChange(bstrStatus);
00215             mEvents2->Fire_StatusTextChange(bstrStatus);
00216             SysFreeString(bstrStatus);
00217         }
00218 
00219         // state change notifications
00220         doFireCommandStateChange = TRUE;
00221     }
00222 
00223     if (progressStateFlags & STATE_IS_NETWORK)
00224     {
00225         if (progressStateFlags & STATE_START)
00226         {
00227         }
00228 
00229         if (progressStateFlags & STATE_STOP)
00230         {
00231             nsCAutoString aURI;
00232             if (mCurrentURI)
00233             {
00234                 mCurrentURI->GetAsciiSpec(aURI);
00235             }
00236 
00237             // Fire a NavigateComplete event
00238             USES_CONVERSION;
00239             BSTR bstrURI = SysAllocString(A2OLE(aURI.get()));
00240             mEvents1->Fire_NavigateComplete(bstrURI);
00241 
00242             // Fire a NavigateComplete2 event
00243             CComVariant vURI(bstrURI);
00244             mEvents2->Fire_NavigateComplete2(mOwner, &vURI);
00245 
00246             // Cleanup
00247             SysFreeString(bstrURI);
00248             mOwner->mBusyFlag = FALSE;
00249             mCurrentURI = nsnull;
00250         }
00251     }
00252 
00253     if (doFireCommandStateChange)
00254     {
00255         nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mOwner->mWebBrowser));
00256 
00257         // Fire the new NavigateForward state
00258         VARIANT_BOOL bEnableForward = VARIANT_FALSE;
00259         PRBool aCanGoForward = PR_FALSE;
00260         webNav->GetCanGoForward(&aCanGoForward);
00261         if (aCanGoForward == PR_TRUE)
00262         {
00263             bEnableForward = VARIANT_TRUE;
00264         }
00265         mEvents2->Fire_CommandStateChange(CSC_NAVIGATEFORWARD, bEnableForward);
00266 
00267         // Fire the new NavigateBack state
00268         VARIANT_BOOL bEnableBack = VARIANT_FALSE;
00269         PRBool aCanGoBack = PR_FALSE;
00270         webNav->GetCanGoBack(&aCanGoBack);
00271         if (aCanGoBack == PR_TRUE)
00272         {
00273             bEnableBack = VARIANT_TRUE;
00274         }
00275         mEvents2->Fire_CommandStateChange(CSC_NAVIGATEBACK, bEnableBack);
00276     }
00277 
00278     return NS_OK;
00279 }
00280 
00281 
00282 /* void onLocationChange (in nsIURI location); */
00283 NS_IMETHODIMP CWebBrowserContainer::OnLocationChange(nsIWebProgress* aWebProgress,
00284                                                      nsIRequest* aRequest,
00285                                                      nsIURI *location)
00286 {
00287 //    nsXPIDLCString aPath;
00288 //    location->GetPath(getter_Copies(aPath));
00289     return NS_OK;
00290 }
00291 
00292 NS_IMETHODIMP 
00293 CWebBrowserContainer::OnStatusChange(nsIWebProgress* aWebProgress,
00294                                      nsIRequest* aRequest,
00295                                      nsresult aStatus,
00296                                      const PRUnichar* aMessage)
00297 {
00298     NG_TRACE(_T("CWebBrowserContainer::OnStatusChange(...,  \"\")\n"));
00299 
00300     BSTR bstrStatus = SysAllocString(W2OLE((PRUnichar *) aMessage));
00301     mEvents1->Fire_StatusTextChange(bstrStatus);
00302     mEvents2->Fire_StatusTextChange(bstrStatus);
00303     SysFreeString(bstrStatus);
00304 
00305     return NS_OK;
00306 }
00307 
00308 NS_IMETHODIMP 
00309 CWebBrowserContainer::OnSecurityChange(nsIWebProgress *aWebProgress, 
00310                                        nsIRequest *aRequest, 
00311                                        PRUint32 state)
00312 {
00313     return NS_OK;
00314 }
00315 
00316 
00318 // nsIURIContentListener
00319 
00320 /* void onStartURIOpen (in nsIURI aURI, out boolean aAbortOpen); */
00321 NS_IMETHODIMP CWebBrowserContainer::OnStartURIOpen(nsIURI *pURI, PRBool *aAbortOpen)
00322 {
00323     USES_CONVERSION;
00324     NG_TRACE(_T("CWebBrowserContainer::OnStartURIOpen(...)\n"));
00325 
00326     mCurrentURI = pURI;
00327     NG_ASSERT(mCurrentURI);
00328 
00329     nsCAutoString aURI;
00330     mCurrentURI->GetSpec(aURI);
00331 
00332     // Setup the post data
00333     CComVariant vPostDataRef;
00334     CComVariant vPostData;
00335     vPostDataRef.vt = VT_BYREF | VT_VARIANT;
00336     vPostDataRef.pvarVal = &vPostData;
00337     // TODO get the post data passed in via the original call to Navigate()
00338 
00339 
00340     // Fire a BeforeNavigate event
00341     BSTR bstrURI = SysAllocString(A2OLE(aURI.get()));
00342     BSTR bstrTargetFrameName = NULL;
00343     BSTR bstrHeaders = NULL;
00344     VARIANT_BOOL bCancel = VARIANT_FALSE;
00345     long lFlags = 0;
00346 
00347     mEvents1->Fire_BeforeNavigate(bstrURI, lFlags, bstrTargetFrameName, &vPostDataRef, bstrHeaders, &bCancel);
00348 
00349     // Fire a BeforeNavigate2 event
00350     CComVariant vURI(bstrURI);
00351     CComVariant vFlags(lFlags);
00352     CComVariant vTargetFrameName(bstrTargetFrameName);
00353     CComVariant vHeaders(bstrHeaders);
00354 
00355     mEvents2->Fire_BeforeNavigate2(mOwner, &vURI, &vFlags, &vTargetFrameName, &vPostDataRef, &vHeaders, &bCancel);
00356 
00357     // Cleanup
00358     SysFreeString(bstrURI);
00359     SysFreeString(bstrTargetFrameName);
00360     SysFreeString(bstrHeaders);
00361 
00362     if (bCancel != VARIANT_FALSE)
00363     {
00364         *aAbortOpen = PR_TRUE;
00365         return NS_ERROR_ABORT;
00366     }
00367     else
00368     {
00369         mOwner->mBusyFlag = TRUE;
00370     }
00371 
00372     //NOTE:  The IE control fires a DownloadBegin after the first BeforeNavigate.
00373     //      It then fires a DownloadComplete after the engine has made it's
00374     //      initial connection to the server.  It then fires a second
00375     //      DownloadBegin/DownloadComplete pair around the loading of
00376     //      everything on the page.  These events get fired out of
00377     //      CWebBrowserContainer::StartDocumentLoad() and
00378     //      CWebBrowserContainer::EndDocumentLoad().
00379     //        We don't appear to distinguish between the initial connection to
00380     //      the server and the actual transfer of data.  Firing these events
00381     //      here simulates, appeasing applications that are expecting that
00382     //      initial pair.
00383 
00384     mEvents1->Fire_DownloadBegin();
00385     mEvents2->Fire_DownloadBegin();
00386     mEvents1->Fire_DownloadComplete();
00387     mEvents2->Fire_DownloadComplete();
00388 
00389     return NS_OK;
00390 }
00391 
00392 /* void doContent (in string aContentType, in boolean aIsContentPreferred, in nsIRequest request, out nsIStreamListener aContentHandler, out boolean aAbortProcess); */
00393 NS_IMETHODIMP CWebBrowserContainer::DoContent(const char *aContentType, PRBool aIsContentPreferred, nsIRequest *request, nsIStreamListener **aContentHandler, PRBool *aAbortProcess)
00394 {
00395     return NS_ERROR_NOT_IMPLEMENTED;
00396 }
00397 
00398 
00399 /* boolean isPreferred (in string aContentType, out string aDesiredContentType); */
00400 NS_IMETHODIMP CWebBrowserContainer::IsPreferred(const char *aContentType, char **aDesiredContentType, PRBool *_retval)
00401 {
00402     return CanHandleContent(aContentType, PR_TRUE, aDesiredContentType, _retval);
00403 }
00404 
00405 
00406 /* boolean canHandleContent (in string aContentType, in PRBool aIsContentPreferred, out string aDesiredContentType); */
00407 NS_IMETHODIMP CWebBrowserContainer::CanHandleContent(const char *aContentType, PRBool aIsContentPreferred, char **aDesiredContentType, PRBool *_retval)
00408 {
00409     *_retval = PR_FALSE;
00410     *aDesiredContentType = nsnull;
00411     
00412     if (aContentType)
00413     {
00414         nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mOwner->mWebBrowser));
00415         nsCOMPtr<nsIWebNavigationInfo> webNavInfo(
00416            do_GetService("@mozilla.org/webnavigation-info;1"));
00417         if (webNavInfo)
00418         {
00419             PRUint32 canHandle;
00420             nsresult rv =
00421                 webNavInfo->IsTypeSupported(nsDependentCString(aContentType),
00422                                             webNav,
00423                                             &canHandle);
00424             NS_ENSURE_SUCCESS(rv, rv);
00425             *_retval = (canHandle != nsIWebNavigationInfo::UNSUPPORTED);
00426         }
00427     }
00428 
00429     return NS_OK;
00430 }
00431 
00432 
00433 /* attribute nsISupports loadCookie; */
00434 NS_IMETHODIMP CWebBrowserContainer::GetLoadCookie(nsISupports * *aLoadCookie)
00435 {
00436     return NS_ERROR_NOT_IMPLEMENTED;
00437 }
00438 
00439 
00440 NS_IMETHODIMP CWebBrowserContainer::SetLoadCookie(nsISupports * aLoadCookie)
00441 {
00442     return NS_ERROR_NOT_IMPLEMENTED;
00443 }
00444 
00445 
00446 /* attribute nsIURIContentListener parentContentListener; */
00447 NS_IMETHODIMP CWebBrowserContainer::GetParentContentListener(nsIURIContentListener * *aParentContentListener)
00448 {
00449     return NS_ERROR_NOT_IMPLEMENTED;
00450 }
00451 
00452 
00453 NS_IMETHODIMP CWebBrowserContainer::SetParentContentListener(nsIURIContentListener * aParentContentListener)
00454 {
00455     return NS_ERROR_NOT_IMPLEMENTED;
00456 }
00457 
00458 
00460 // nsIEmbeddingSiteWindow
00461 
00462 NS_IMETHODIMP 
00463 CWebBrowserContainer::GetDimensions(PRUint32 aFlags, PRInt32 *x, PRInt32 *y, PRInt32 *cx, PRInt32 *cy)
00464 {
00465     RECT rc = { 0, 0, 1, 1 };
00466     mOwner->GetClientRect(&rc);
00467     if (aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION)
00468     {
00469         if (*x)
00470             *x = rc.left;
00471         if (*y)
00472             *y = rc.top;
00473     }
00474     if (aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER ||
00475         aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER)
00476     {
00477         if (*cx)
00478             *cx = rc.right - rc.left;
00479         if (*cy)
00480             *cy = rc.bottom - rc.top;
00481     }
00482     return NS_OK;
00483 }
00484 
00485 
00486 NS_IMETHODIMP 
00487 CWebBrowserContainer::SetDimensions(PRUint32 aFlags, PRInt32 x, PRInt32 y, PRInt32 cx, PRInt32 cy)
00488 {
00489     // Ignore
00490     return NS_OK;
00491 }
00492 
00493 
00494 NS_IMETHODIMP 
00495 CWebBrowserContainer::GetSiteWindow(void **aParentNativeWindow)
00496 {
00497     NS_ENSURE_ARG_POINTER(aParentNativeWindow);
00498     HWND *hwndDest = (HWND *) aParentNativeWindow;
00499     *hwndDest = mOwner->m_hWnd;
00500     return NS_OK;
00501 }
00502 
00503 
00504 NS_IMETHODIMP 
00505 CWebBrowserContainer::SetFocus(void)
00506 {
00507     return NS_OK;
00508 }
00509 
00510 
00511 NS_IMETHODIMP 
00512 CWebBrowserContainer::GetTitle(PRUnichar * *aTitle)
00513 {
00514     NG_ASSERT_POINTER(aTitle, PRUnichar **);
00515     if (!aTitle)
00516         return E_INVALIDARG;
00517 
00518     *aTitle = ToNewUnicode(mTitle);
00519 
00520     return NS_OK;
00521 }
00522 
00523 
00524 NS_IMETHODIMP 
00525 CWebBrowserContainer::SetTitle(const PRUnichar * aTitle)
00526 {
00527     NG_ASSERT_POINTER(aTitle, PRUnichar *);
00528     if (!aTitle)
00529         return E_INVALIDARG;
00530 
00531     mTitle = aTitle;
00532     // Fire a TitleChange event
00533     BSTR bstrTitle = SysAllocString(aTitle);
00534     mEvents1->Fire_TitleChange(bstrTitle);
00535     mEvents2->Fire_TitleChange(bstrTitle);
00536     SysFreeString(bstrTitle);
00537 
00538     return NS_OK;
00539 }
00540 
00541 
00542 NS_IMETHODIMP 
00543 CWebBrowserContainer::GetVisibility(PRBool *aVisibility)
00544 {
00545     NS_ENSURE_ARG_POINTER(aVisibility);
00546     *aVisibility = PR_TRUE;
00547     return NS_OK;
00548 }
00549 
00550 
00551 NS_IMETHODIMP 
00552 CWebBrowserContainer::SetVisibility(PRBool aVisibility)
00553 {
00554     VARIANT_BOOL visible = aVisibility ? VARIANT_TRUE : VARIANT_FALSE;
00555     mVisible = aVisibility;
00556     // Fire an OnVisible event
00557     mEvents2->Fire_OnVisible(visible);
00558     return NS_OK;
00559 }
00560 
00561 
00563 // nsIEmbeddingSiteWindow2
00564 
00565 
00566 NS_IMETHODIMP 
00567 CWebBrowserContainer::Blur()
00568 {
00569     return NS_OK;
00570 }
00571 
00572 
00574 // nsIWebBrowserChromeFocus implementation
00575 
00576 NS_IMETHODIMP
00577 CWebBrowserContainer::FocusNextElement()
00578 {
00579     ATLTRACE(_T("CWebBrowserContainer::FocusNextElement()\n"));
00580     mOwner->NextDlgControl();
00581     return NS_OK;
00582 }
00583 
00584 
00585 NS_IMETHODIMP
00586 CWebBrowserContainer::FocusPrevElement()
00587 {
00588     ATLTRACE(_T("CWebBrowserContainer::FocusPrevElement()\n"));
00589     mOwner->PrevDlgControl();
00590     return NS_OK;
00591 }
00592 
00593 
00595 // nsIWebBrowserChrome implementation
00596 
00597 NS_IMETHODIMP
00598 CWebBrowserContainer::SetStatus(PRUint32 statusType, const PRUnichar *status)
00599 {
00600     //Fire a StatusTextChange event
00601     BSTR bstrStatus = SysAllocString(status);
00602     mEvents1->Fire_StatusTextChange(bstrStatus);
00603     mEvents2->Fire_StatusTextChange(bstrStatus);
00604     SysFreeString(bstrStatus);
00605     return NS_OK;
00606 }
00607 
00608 
00609 NS_IMETHODIMP
00610 CWebBrowserContainer::GetWebBrowser(nsIWebBrowser * *aWebBrowser)
00611 {
00612     return NS_ERROR_FAILURE;
00613 }
00614 
00615 
00616 NS_IMETHODIMP
00617 CWebBrowserContainer::SetWebBrowser(nsIWebBrowser * aWebBrowser)
00618 {
00619     return NS_ERROR_FAILURE;
00620 }
00621 
00622 
00623 NS_IMETHODIMP
00624 CWebBrowserContainer::GetChromeFlags(PRUint32 *aChromeFlags)
00625 {
00626     return NS_ERROR_FAILURE;
00627 }
00628 
00629 
00630 NS_IMETHODIMP
00631 CWebBrowserContainer::SetChromeFlags(PRUint32 aChromeFlags)
00632 {
00633     return NS_ERROR_FAILURE;
00634 }
00635 
00636 
00637 NS_IMETHODIMP
00638 CWebBrowserContainer::DestroyBrowserWindow(void)
00639 {
00640     return NS_ERROR_FAILURE;
00641 }
00642 
00643 
00644 NS_IMETHODIMP
00645 CWebBrowserContainer::SizeBrowserTo(PRInt32 aCX, PRInt32 aCY)
00646 {
00647     return NS_ERROR_FAILURE;
00648 }
00649 
00650 
00651 NS_IMETHODIMP
00652 CWebBrowserContainer::ShowAsModal(void)
00653 {
00654     return NS_ERROR_FAILURE;
00655 }
00656 
00657 NS_IMETHODIMP
00658 CWebBrowserContainer::IsWindowModal(PRBool *_retval)
00659 {
00660     // we're not
00661     *_retval = PR_FALSE;
00662     return NS_OK;
00663 }
00664 
00665 NS_IMETHODIMP
00666 CWebBrowserContainer::ExitModalEventLoop(nsresult aStatus)
00667 {
00668     // Ignore request to exit modal loop
00669     return NS_OK;
00670 }
00671 
00673 // nsIRequestObserver implementation
00674 
00675 
00676 NS_IMETHODIMP
00677 CWebBrowserContainer::OnStartRequest(nsIRequest *request, nsISupports* aContext)
00678 {
00679     USES_CONVERSION;
00680     NG_TRACE(_T("CWebBrowserContainer::OnStartRequest(...)\n"));
00681 
00682     return NS_OK;
00683 }
00684 
00685 
00686 NS_IMETHODIMP
00687 CWebBrowserContainer::OnStopRequest(nsIRequest *request, nsISupports* aContext, nsresult aStatus)
00688 {
00689     USES_CONVERSION;
00690     NG_TRACE(_T("CWebBrowserContainer::OnStopRequest(..., %d)\n"), (int) aStatus);
00691 
00692     // Fire a DownloadComplete event
00693     mEvents1->Fire_DownloadComplete();
00694     mEvents2->Fire_DownloadComplete();
00695 
00696     return NS_OK;
00697 }
00698 
00700 // nsICommandHandler implementation
00701 
00702 /* void do (in string aCommand, in string aStatus); */
00703 NS_IMETHODIMP CWebBrowserContainer::Exec(const char *aCommand, const char *aStatus, char **aResult)
00704 {
00705     return NS_OK;
00706 }
00707 
00708 /* void query (in string aCommand, in string aStatus); */
00709 NS_IMETHODIMP CWebBrowserContainer::Query(const char *aCommand, const char *aStatus, char **aResult)
00710 {
00711     return NS_OK;
00712 }