Back to index

lightning-sunbird  0.9+nobinonly
WebBrowserChrome.cpp
Go to the documentation of this file.
00001 /* ***** BEGIN LICENSE BLOCK *****
00002  * Version: Mozilla-sample-code 1.0
00003  *
00004  * Copyright (c) 2002 Netscape Communications Corporation and
00005  * other contributors
00006  *
00007  * Permission is hereby granted, free of charge, to any person obtaining a
00008  * copy of this Mozilla sample software and associated documentation files
00009  * (the "Software"), to deal in the Software without restriction, including
00010  * without limitation the rights to use, copy, modify, merge, publish,
00011  * distribute, sublicense, and/or sell copies of the Software, and to permit
00012  * persons to whom the Software is furnished to do so, subject to the
00013  * following conditions:
00014  *
00015  * The above copyright notice and this permission notice shall be included
00016  * in all copies or substantial portions of the Software.
00017  *
00018  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00019  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00020  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
00021  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00022  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
00023  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
00024  * DEALINGS IN THE SOFTWARE.
00025  *
00026  * Contributor(s):
00027  *
00028  * ***** END LICENSE BLOCK ***** */
00029 
00030 // Mozilla Includes
00031 #include "nsIGenericFactory.h"
00032 #include "nsIComponentManager.h"
00033 #include "nsString.h"
00034 #include "nsXPIDLString.h"
00035 #include "nsIURI.h"
00036 #include "nsIWebProgress.h"
00037 #include "nsIDocShellTreeItem.h"
00038 #include "nsIDOMWindow.h"
00039 #include "nsIInterfaceRequestor.h"
00040 #include "nsIRequest.h"
00041 #include "nsCWebBrowser.h"
00042 #include "nsIProfileChangeStatus.h"
00043 
00044 // Local includes
00045 #include "resource.h"
00046 
00047 #include "winEmbed.h"
00048 #include "WebBrowserChrome.h"
00049 
00050 
00051 WebBrowserChrome::WebBrowserChrome()
00052 {
00053     mNativeWindow = nsnull;
00054     mSizeSet = PR_FALSE;
00055 }
00056 
00057 WebBrowserChrome::~WebBrowserChrome()
00058 {
00059     WebBrowserChromeUI::Destroyed(this);
00060 }
00061 
00062 nsresult WebBrowserChrome::CreateBrowser(PRInt32 aX, PRInt32 aY,
00063                                          PRInt32 aCX, PRInt32 aCY,
00064                                          nsIWebBrowser **aBrowser)
00065 {
00066     NS_ENSURE_ARG_POINTER(aBrowser);
00067     *aBrowser = nsnull;
00068 
00069     mWebBrowser = do_CreateInstance(NS_WEBBROWSER_CONTRACTID);
00070     
00071     if (!mWebBrowser)
00072         return NS_ERROR_FAILURE;
00073 
00074     (void)mWebBrowser->SetContainerWindow(NS_STATIC_CAST(nsIWebBrowserChrome*, this));
00075 
00076     nsCOMPtr<nsIDocShellTreeItem> dsti = do_QueryInterface(mWebBrowser);
00077     dsti->SetItemType(nsIDocShellTreeItem::typeContentWrapper);
00078 
00079     nsCOMPtr<nsIBaseWindow> browserBaseWindow = do_QueryInterface(mWebBrowser);
00080 
00081     mNativeWindow = WebBrowserChromeUI::CreateNativeWindow(NS_STATIC_CAST(nsIWebBrowserChrome*, this));
00082 
00083     if (!mNativeWindow)
00084         return NS_ERROR_FAILURE;
00085 
00086     browserBaseWindow->InitWindow( mNativeWindow,
00087                              nsnull, 
00088                              aX, aY, aCX, aCY);
00089     browserBaseWindow->Create();
00090 
00091     nsCOMPtr<nsIWebProgressListener> listener(NS_STATIC_CAST(nsIWebProgressListener*, this));
00092     nsCOMPtr<nsIWeakReference> thisListener(do_GetWeakReference(listener));
00093     (void)mWebBrowser->AddWebBrowserListener(thisListener, 
00094         NS_GET_IID(nsIWebProgressListener));
00095 
00096     // The window has been created. Now register for history notifications
00097     mWebBrowser->AddWebBrowserListener(thisListener, NS_GET_IID(nsISHistoryListener));
00098 
00099     if (mWebBrowser)
00100     {
00101       *aBrowser = mWebBrowser;
00102       NS_ADDREF(*aBrowser);
00103       return NS_OK;
00104     }
00105     return NS_ERROR_FAILURE;
00106 }
00107 
00108 //*****************************************************************************
00109 // WebBrowserChrome::nsISupports
00110 //*****************************************************************************   
00111 
00112 NS_IMPL_ADDREF(WebBrowserChrome)
00113 NS_IMPL_RELEASE(WebBrowserChrome)
00114 
00115 NS_INTERFACE_MAP_BEGIN(WebBrowserChrome)
00116    NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIWebBrowserChrome)
00117    NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
00118    NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChrome)
00119    NS_INTERFACE_MAP_ENTRY(nsIEmbeddingSiteWindow)
00120    NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener) // optional
00121    NS_INTERFACE_MAP_ENTRY(nsISHistoryListener)
00122    NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
00123    NS_INTERFACE_MAP_ENTRY(nsIObserver)
00124    NS_INTERFACE_MAP_ENTRY(nsIContextMenuListener)
00125    NS_INTERFACE_MAP_ENTRY(nsITooltipListener)
00126 NS_INTERFACE_MAP_END
00127 
00128 //*****************************************************************************
00129 // WebBrowserChrome::nsIInterfaceRequestor
00130 //*****************************************************************************   
00131 
00132 NS_IMETHODIMP WebBrowserChrome::GetInterface(const nsIID &aIID, void** aInstancePtr)
00133 {
00134     NS_ENSURE_ARG_POINTER(aInstancePtr);
00135 
00136     *aInstancePtr = 0;
00137     if (aIID.Equals(NS_GET_IID(nsIDOMWindow)))
00138     {
00139         if (mWebBrowser)
00140         {
00141             return mWebBrowser->GetContentDOMWindow((nsIDOMWindow **) aInstancePtr);
00142         }
00143         return NS_ERROR_NOT_INITIALIZED;
00144     }
00145     return QueryInterface(aIID, aInstancePtr);
00146 }
00147 
00148 //*****************************************************************************
00149 // WebBrowserChrome::nsIWebBrowserChrome
00150 //*****************************************************************************   
00151 
00152 NS_IMETHODIMP WebBrowserChrome::SetStatus(PRUint32 aType, const PRUnichar* aStatus)
00153 {
00154     WebBrowserChromeUI::UpdateStatusBarText(this, aStatus);
00155     return NS_OK;
00156 }
00157 
00158 NS_IMETHODIMP WebBrowserChrome::GetWebBrowser(nsIWebBrowser** aWebBrowser)
00159 {
00160     NS_ENSURE_ARG_POINTER(aWebBrowser);
00161     *aWebBrowser = mWebBrowser;
00162     NS_IF_ADDREF(*aWebBrowser);
00163     return NS_OK;
00164 }
00165 
00166 NS_IMETHODIMP WebBrowserChrome::SetWebBrowser(nsIWebBrowser* aWebBrowser)
00167 {
00168     mWebBrowser = aWebBrowser;
00169     return NS_OK;
00170 }
00171 
00172 NS_IMETHODIMP WebBrowserChrome::GetChromeFlags(PRUint32* aChromeMask)
00173 {
00174     *aChromeMask = mChromeFlags;
00175     return NS_OK;
00176 }
00177 
00178 NS_IMETHODIMP WebBrowserChrome::SetChromeFlags(PRUint32 aChromeMask)
00179 {
00180     mChromeFlags = aChromeMask;
00181     return NS_OK;
00182 }
00183 
00184 NS_IMETHODIMP WebBrowserChrome::DestroyBrowserWindow(void)
00185 {
00186     WebBrowserChromeUI::Destroy(this);
00187     return NS_OK;
00188 }
00189 
00190 
00191 // IN: The desired browser client area dimensions.
00192 NS_IMETHODIMP WebBrowserChrome::SizeBrowserTo(PRInt32 aWidth, PRInt32 aHeight)
00193 {
00194   /* This isn't exactly correct: we're setting the whole window to
00195      the size requested for the browser. At time of writing, though,
00196      it's fine and useful for winEmbed's purposes. */
00197   WebBrowserChromeUI::SizeTo(this, aWidth, aHeight);
00198   mSizeSet = PR_TRUE;
00199   return NS_OK;
00200 }
00201 
00202 
00203 NS_IMETHODIMP WebBrowserChrome::ShowAsModal(void)
00204 {
00205   if (mDependentParent)
00206     AppCallbacks::EnableChromeWindow(mDependentParent, PR_FALSE);
00207 
00208   mContinueModalLoop = PR_TRUE;
00209   AppCallbacks::RunEventLoop(mContinueModalLoop);
00210 
00211   if (mDependentParent)
00212     AppCallbacks::EnableChromeWindow(mDependentParent, PR_TRUE);
00213 
00214   return NS_OK;
00215 }
00216 
00217 NS_IMETHODIMP WebBrowserChrome::IsWindowModal(PRBool *_retval)
00218 {
00219     *_retval = PR_FALSE;
00220     return NS_ERROR_NOT_IMPLEMENTED;
00221 }
00222 
00223 NS_IMETHODIMP WebBrowserChrome::ExitModalEventLoop(nsresult aStatus)
00224 {
00225   mContinueModalLoop = PR_FALSE;
00226   return NS_OK;
00227 }
00228 
00229 //*****************************************************************************
00230 // WebBrowserChrome::nsIWebBrowserChromeFocus
00231 //*****************************************************************************
00232 
00233 NS_IMETHODIMP WebBrowserChrome::FocusNextElement()
00234 {
00235     return NS_ERROR_NOT_IMPLEMENTED;
00236 }
00237 
00238 NS_IMETHODIMP WebBrowserChrome::FocusPrevElement()
00239 {
00240     return NS_ERROR_NOT_IMPLEMENTED;
00241 }
00242 
00243 //*****************************************************************************
00244 // WebBrowserChrome::nsIWebProgressListener
00245 //*****************************************************************************   
00246 
00247 NS_IMETHODIMP WebBrowserChrome::OnProgressChange(nsIWebProgress *progress, nsIRequest *request,
00248                                                   PRInt32 curSelfProgress, PRInt32 maxSelfProgress,
00249                                                   PRInt32 curTotalProgress, PRInt32 maxTotalProgress)
00250 {
00251     WebBrowserChromeUI::UpdateProgress(this, curTotalProgress, maxTotalProgress);
00252     return NS_OK;
00253 }
00254 
00255 NS_IMETHODIMP WebBrowserChrome::OnStateChange(nsIWebProgress *progress, nsIRequest *request,
00256                                                PRUint32 progressStateFlags, nsresult status)
00257 {
00258     if ((progressStateFlags & STATE_START) && (progressStateFlags & STATE_IS_DOCUMENT))
00259     {
00260         WebBrowserChromeUI::UpdateBusyState(this, PR_TRUE);
00261     }
00262 
00263     if ((progressStateFlags & STATE_STOP) && (progressStateFlags & STATE_IS_DOCUMENT))
00264     {
00265         WebBrowserChromeUI::UpdateBusyState(this, PR_FALSE);
00266         WebBrowserChromeUI::UpdateProgress(this, 0, 100);
00267         WebBrowserChromeUI::UpdateStatusBarText(this, nsnull);
00268         ContentFinishedLoading();
00269     }
00270 
00271     return NS_OK;
00272 }
00273 
00274 
00275 NS_IMETHODIMP WebBrowserChrome::OnLocationChange(nsIWebProgress* aWebProgress,
00276                                                  nsIRequest* aRequest,
00277                                                  nsIURI *location)
00278 {
00279   PRBool isSubFrameLoad = PR_FALSE; // Is this a subframe load
00280   if (aWebProgress) {
00281     nsCOMPtr<nsIDOMWindow>  domWindow;
00282     nsCOMPtr<nsIDOMWindow>  topDomWindow;
00283     aWebProgress->GetDOMWindow(getter_AddRefs(domWindow));
00284     if (domWindow) { // Get root domWindow
00285       domWindow->GetTop(getter_AddRefs(topDomWindow));
00286     }
00287     if (domWindow != topDomWindow)
00288       isSubFrameLoad = PR_TRUE;
00289   }
00290   if (!isSubFrameLoad)
00291     WebBrowserChromeUI::UpdateCurrentURI(this);
00292   return NS_OK;
00293 }
00294 
00295 NS_IMETHODIMP 
00296 WebBrowserChrome::OnStatusChange(nsIWebProgress* aWebProgress,
00297                                  nsIRequest* aRequest,
00298                                  nsresult aStatus,
00299                                  const PRUnichar* aMessage)
00300 {
00301     WebBrowserChromeUI::UpdateStatusBarText(this, aMessage);
00302     return NS_OK;
00303 }
00304 
00305 
00306 
00307 NS_IMETHODIMP 
00308 WebBrowserChrome::OnSecurityChange(nsIWebProgress *aWebProgress, 
00309                                     nsIRequest *aRequest, 
00310                                     PRUint32 state)
00311 {
00312     return NS_OK;
00313 }
00314 
00315 //*****************************************************************************
00316 // WebBrowserChrome::nsISHistoryListener
00317 //*****************************************************************************   
00318 
00319 NS_IMETHODIMP
00320 WebBrowserChrome::OnHistoryNewEntry(nsIURI * aNewURI)
00321 {
00322     return SendHistoryStatusMessage(aNewURI, "add");
00323 }
00324 
00325 NS_IMETHODIMP
00326 WebBrowserChrome::OnHistoryGoBack(nsIURI * aBackURI, PRBool * aContinue)
00327 {
00328     // For now, let the operation continue
00329     *aContinue = PR_TRUE;
00330     return SendHistoryStatusMessage(aBackURI, "back");
00331 }
00332 
00333 
00334 NS_IMETHODIMP
00335 WebBrowserChrome::OnHistoryGoForward(nsIURI * aForwardURI, PRBool * aContinue)
00336 {
00337     // For now, let the operation continue
00338     *aContinue = PR_TRUE;
00339     return SendHistoryStatusMessage(aForwardURI, "forward");
00340 }
00341 
00342 
00343 NS_IMETHODIMP
00344 WebBrowserChrome::OnHistoryGotoIndex(PRInt32 aIndex, nsIURI * aGotoURI, PRBool * aContinue)
00345 {
00346     // For now, let the operation continue
00347     *aContinue = PR_TRUE;
00348     return SendHistoryStatusMessage(aGotoURI, "goto", aIndex);
00349 }
00350 
00351 NS_IMETHODIMP
00352 WebBrowserChrome::OnHistoryReload(nsIURI * aURI, PRUint32 aReloadFlags, PRBool * aContinue)
00353 {
00354     // For now, let the operation continue
00355     *aContinue = PR_TRUE;
00356     return SendHistoryStatusMessage(aURI, "reload", 0 /* no info to pass here */, aReloadFlags);
00357 }
00358 
00359 NS_IMETHODIMP
00360 WebBrowserChrome::OnHistoryPurge(PRInt32 aNumEntries, PRBool *aContinue)
00361 {
00362     // For now let the operation continue
00363     *aContinue = PR_FALSE;
00364     return SendHistoryStatusMessage(nsnull, "purge", aNumEntries);
00365 }
00366 
00367 nsresult
00368 WebBrowserChrome::SendHistoryStatusMessage(nsIURI * aURI, char * operation, PRInt32 info1, PRUint32 aReloadFlags)
00369 {
00370     nsCAutoString uriCStr;
00371     if (aURI)
00372     {
00373         aURI->GetSpec(uriCStr);
00374     }
00375 
00376     nsString uriAStr;
00377 
00378     if(!(strcmp(operation, "back")))
00379     {
00380         // Going back. XXX Get string from a resource file
00381         uriAStr.AppendLiteral("Going back to url:");
00382         AppendUTF8toUTF16(uriCStr, uriAStr);
00383     }
00384     else if (!(strcmp(operation, "forward")))
00385     {
00386         // Going forward. XXX Get string from a resource file
00387         uriAStr.AppendLiteral("Going forward to url:");
00388         AppendUTF8toUTF16(uriCStr, uriAStr);
00389     }
00390     else if (!(strcmp(operation, "reload")))
00391     {
00392         // Reloading. XXX Get string from a resource file
00393         if (aReloadFlags & nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY && 
00394             aReloadFlags & nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE)
00395         {
00396             uriAStr.Append(NS_LITERAL_STRING("Reloading url,(bypassing proxy and cache) :"));
00397         }
00398         else if (aReloadFlags & nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY)
00399         {
00400             uriAStr.Append(NS_LITERAL_STRING("Reloading url, (bypassing proxy):"));
00401         }
00402         else if (aReloadFlags & nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE)
00403         {
00404             uriAStr.Append(NS_LITERAL_STRING("Reloading url, (bypassing cache):"));
00405         }
00406         else
00407         {
00408             uriAStr.Append(NS_LITERAL_STRING("Reloading url, (normal):"));
00409         }
00410         AppendUTF8toUTF16(uriCStr, uriAStr);
00411     }
00412     else if (!(strcmp(operation, "add")))
00413     {
00414         // Adding new entry. XXX Get string from a resource file
00415         AppendUTF8toUTF16(uriCStr, uriAStr);
00416         uriAStr.AppendLiteral(" added to session History");
00417     }
00418     else if (!(strcmp(operation, "goto")))
00419     {
00420         // Goto. XXX Get string from a resource file
00421         uriAStr.AppendLiteral("Going to HistoryIndex:");
00422         uriAStr.AppendInt(info1);
00423         uriAStr.AppendLiteral(" Url:");
00424         AppendUTF8toUTF16(uriCStr, uriAStr);
00425     }
00426     else if (!(strcmp(operation, "purge")))
00427     {
00428         // Purging old entries
00429         uriAStr.AppendInt(info1);
00430         uriAStr.AppendLiteral(" purged from Session History");
00431     }
00432 
00433     WebBrowserChromeUI::UpdateStatusBarText(this, uriAStr.get());
00434 
00435     return NS_OK;
00436 }
00437 
00438 void WebBrowserChrome::ContentFinishedLoading()
00439 {
00440   // if it was a chrome window and no one has already specified a size,
00441   // size to content
00442   if (mWebBrowser && !mSizeSet &&
00443      (mChromeFlags & nsIWebBrowserChrome::CHROME_OPENAS_CHROME)) {
00444     nsCOMPtr<nsIDOMWindow> contentWin;
00445     mWebBrowser->GetContentDOMWindow(getter_AddRefs(contentWin));
00446     if (contentWin)
00447         contentWin->SizeToContent();
00448     WebBrowserChromeUI::ShowWindow(this, PR_TRUE);
00449   }
00450 }
00451 
00452 
00453 //*****************************************************************************
00454 // WebBrowserChrome::nsIEmbeddingSiteWindow
00455 //*****************************************************************************   
00456 
00457 NS_IMETHODIMP WebBrowserChrome::SetDimensions(PRUint32 aFlags, PRInt32 x, PRInt32 y, PRInt32 cx, PRInt32 cy)
00458 {
00459     return NS_ERROR_NOT_IMPLEMENTED;
00460 }
00461 
00462 NS_IMETHODIMP WebBrowserChrome::GetDimensions(PRUint32 aFlags, PRInt32 *x, PRInt32 *y, PRInt32 *cx, PRInt32 *cy)
00463 {
00464     if (aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION)
00465     {
00466         *x = 0;
00467         *y = 0;
00468     }
00469     if (aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER ||
00470         aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER)
00471     {
00472         *cx = 0;
00473         *cy = 0;
00474     }
00475     return NS_ERROR_NOT_IMPLEMENTED;
00476 }
00477 
00478 /* void setFocus (); */
00479 NS_IMETHODIMP WebBrowserChrome::SetFocus()
00480 {
00481     WebBrowserChromeUI::SetFocus(this);
00482     return NS_OK;
00483 }
00484 
00485 /* attribute wstring title; */
00486 NS_IMETHODIMP WebBrowserChrome::GetTitle(PRUnichar * *aTitle)
00487 {
00488    NS_ENSURE_ARG_POINTER(aTitle);
00489 
00490    *aTitle = nsnull;
00491    
00492    return NS_ERROR_NOT_IMPLEMENTED;
00493 }
00494 NS_IMETHODIMP WebBrowserChrome::SetTitle(const PRUnichar * aTitle)
00495 {
00496     return NS_ERROR_NOT_IMPLEMENTED;
00497 }
00498 
00499 /* attribute boolean visibility; */
00500 NS_IMETHODIMP WebBrowserChrome::GetVisibility(PRBool * aVisibility)
00501 {
00502     NS_ENSURE_ARG_POINTER(aVisibility);
00503     *aVisibility = PR_TRUE;
00504     return NS_OK;
00505 }
00506 NS_IMETHODIMP WebBrowserChrome::SetVisibility(PRBool aVisibility)
00507 {
00508     return NS_OK;
00509 }
00510 
00511 /* attribute nativeSiteWindow siteWindow */
00512 NS_IMETHODIMP WebBrowserChrome::GetSiteWindow(void * *aSiteWindow)
00513 {
00514    NS_ENSURE_ARG_POINTER(aSiteWindow);
00515 
00516    *aSiteWindow = mNativeWindow;
00517    return NS_OK;
00518 }
00519 
00520 
00521 //*****************************************************************************
00522 // WebBrowserChrome::nsIObserver
00523 //*****************************************************************************   
00524 
00525 NS_IMETHODIMP WebBrowserChrome::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *someData)
00526 {
00527     nsresult rv = NS_OK;
00528     if (strcmp(aTopic, "profile-change-teardown") == 0)
00529     {
00530         // A profile change means death for this window
00531         WebBrowserChromeUI::Destroy(this);
00532     }
00533     return rv;
00534 }
00535 
00536 //*****************************************************************************
00537 // WebBrowserChrome::nsIContextMenuListener
00538 //*****************************************************************************   
00539 
00540 /* void OnShowContextMenu (in unsigned long aContextFlags, in nsIDOMEvent aEvent, in nsIDOMNode aNode); */
00541 NS_IMETHODIMP WebBrowserChrome::OnShowContextMenu(PRUint32 aContextFlags, nsIDOMEvent *aEvent, nsIDOMNode *aNode)
00542 {
00543     WebBrowserChromeUI::ShowContextMenu(this, aContextFlags, aEvent, aNode);
00544     return NS_OK;
00545 }
00546 
00547 //*****************************************************************************
00548 // WebBrowserChrome::nsITooltipListener
00549 //*****************************************************************************   
00550 
00551 /* void OnShowTooltip (in long aXCoords, in long aYCoords, in wstring aTipText); */
00552 NS_IMETHODIMP WebBrowserChrome::OnShowTooltip(PRInt32 aXCoords, PRInt32 aYCoords, const PRUnichar *aTipText)
00553 {
00554     WebBrowserChromeUI::ShowTooltip(this, aXCoords, aYCoords, aTipText);
00555     return NS_OK;
00556 }
00557 
00558 /* void OnHideTooltip (); */
00559 NS_IMETHODIMP WebBrowserChrome::OnHideTooltip()
00560 {
00561     WebBrowserChromeUI::HideTooltip(this);
00562     return NS_OK;
00563 }