Back to index

lightning-sunbird  0.9+nobinonly
qgeckoembed.cpp
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
00002  *
00003  * ***** BEGIN LICENSE BLOCK *****
00004  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00005  *
00006  * The contents of this file are subject to the Mozilla Public License Version
00007  * 1.1 (the "License"); you may not use this file except in compliance with
00008  * the License. You may obtain a copy of the License at
00009  * http://www.mozilla.org/MPL/
00010  *
00011  * Software distributed under the License is distributed on an "AS IS" basis,
00012  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00013  * for the specific language governing rights and limitations under the
00014  * License.
00015  *
00016  * The Original Code is mozilla.org code.
00017  *
00018  * The Initial Developer of the Original Code is
00019  *  Zack Rusin <zack@kde.org>.
00020  * Portions created by the Initial Developer are Copyright (C) 2004
00021  * the Initial Developer. All Rights Reserved.
00022  *
00023  * Contributor(s):
00024  *   Lars Knoll <knoll@kde.org>
00025  *   Zack Rusin <zack@kde.org>
00026  *
00027  * Alternatively, the contents of this file may be used under the terms of
00028  * either the GNU General Public License Version 2 or later (the "GPL"), or
00029  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00030  * in which case the provisions of the GPL or the LGPL are applicable instead
00031  * of those above. If you wish to allow use of your version of this file only
00032  * under the terms of either the GPL or the LGPL, and not to allow others to
00033  * use your version of this file under the terms of the MPL, indicate your
00034  * decision by deleting the provisions above and replace them with the notice
00035  * and other provisions required by the GPL or the LGPL. If you do not delete
00036  * the provisions above, a recipient may use your version of this file under
00037  * the terms of any one of the MPL, the GPL or the LGPL.
00038  *
00039  * ***** END LICENSE BLOCK ***** */
00040 #include "qgeckoembed.h"
00041 
00042 #include "EmbedWindow.h"
00043 #include "EmbedProgress.h"
00044 #include "EmbedStream.h"
00045 #include "EmbedEventListener.h"
00046 #include "EmbedContentListener.h"
00047 #include "EmbedWindowCreator.h"
00048 #include "qgeckoglobals.h"
00049 
00050 #include "nsIAppShell.h"
00051 #include <nsIDocShell.h>
00052 #include <nsIWebProgress.h>
00053 #include <nsIWebNavigation.h>
00054 #include <nsIWebBrowser.h>
00055 #include <nsISHistory.h>
00056 #include <nsIWebBrowserChrome.h>
00057 #include "nsIWidget.h"
00058 #include "nsCRT.h"
00059 #include <nsIWindowWatcher.h>
00060 #include <nsILocalFile.h>
00061 #include <nsEmbedAPI.h>
00062 #include <nsWidgetsCID.h>
00063 #include <nsIDOMUIEvent.h>
00064 #include <nsIInterfaceRequestor.h>
00065 #include <nsIComponentManager.h>
00066 #include <nsIFocusController.h>
00067 #include <nsProfileDirServiceProvider.h>
00068 #include <nsIGenericFactory.h>
00069 #include <nsIComponentRegistrar.h>
00070 #include <nsVoidArray.h>
00071 #include <nsIDOMDocument.h>
00072 #include <nsIDOMBarProp.h>
00073 #include <nsIDOMWindow.h>
00074 #include <nsIDOMEventReceiver.h>
00075 #include <nsCOMPtr.h>
00076 #include <nsPIDOMWindow.h>
00077 
00078 #include "prenv.h"
00079 
00080 #include <qlayout.h>
00081 
00082 class QGeckoEmbedPrivate
00083 {
00084 public:
00085     QGeckoEmbedPrivate(QGeckoEmbed *qq);
00086     ~QGeckoEmbedPrivate();
00087 
00088     QGeckoEmbed *q;
00089 
00090     QWidget *mMainWidget;
00091 
00092     // all of the objects that we own
00093     EmbedWindow                   *window;
00094     nsCOMPtr<nsISupports>          windowGuard;
00095     EmbedProgress                 *progress;
00096     nsCOMPtr<nsISupports>          progressGuard;
00097     EmbedContentListener          *contentListener;
00098     nsCOMPtr<nsISupports>          contentListenerGuard;
00099     EmbedEventListener            *eventListener;
00100     nsCOMPtr<nsISupports>          eventListenerGuard;
00101     EmbedStream                   *stream;
00102     nsCOMPtr<nsISupports>          streamGuard;
00103 
00104     nsCOMPtr<nsIWebNavigation>     navigation;
00105     nsCOMPtr<nsISHistory>          sessionHistory;
00106 
00107     // our event receiver
00108     nsCOMPtr<nsIDOMEventReceiver>  eventReceiver;
00109 
00110     // chrome mask
00111     PRUint32                       chromeMask;
00112 
00113     bool isChrome;
00114     bool chromeLoaded;
00115     bool listenersAttached;
00116 
00117     void initGUI();
00118     void init();
00119     void ApplyChromeMask();
00120 };
00121 
00122 
00123 QGeckoEmbedPrivate::QGeckoEmbedPrivate(QGeckoEmbed *qq)
00124     : q(qq),
00125       mMainWidget(0),
00126       chromeMask(nsIWebBrowserChrome::CHROME_ALL),
00127       isChrome(FALSE),
00128       chromeLoaded(FALSE),
00129       listenersAttached(FALSE)
00130 {
00131     initGUI();
00132     init();
00133 }
00134 
00135 QGeckoEmbedPrivate::~QGeckoEmbedPrivate()
00136 {
00137     QGeckoGlobals::removeEngine(q);
00138     QGeckoGlobals::popStartup();
00139 }
00140 
00141 void
00142 QGeckoEmbedPrivate::init()
00143 {
00144     QGeckoGlobals::initializeGlobalObjects();
00145     QGeckoGlobals::pushStartup();
00146     QGeckoGlobals::addEngine(q);
00147 
00148     // Create our embed window, and create an owning reference to it and
00149     // initialize it.  It is assumed that this window will be destroyed
00150     // when we go out of scope.
00151     window = new EmbedWindow();
00152     windowGuard = NS_STATIC_CAST(nsIWebBrowserChrome *, window);
00153     window->Init(q);
00154     // Create our progress listener object, make an owning reference,
00155     // and initialize it.  It is assumed that this progress listener
00156     // will be destroyed when we go out of scope.
00157     progress = new EmbedProgress(q);
00158     progressGuard = NS_STATIC_CAST(nsIWebProgressListener *,
00159                                    progress);
00160 
00161     // Create our content listener object, initialize it and attach it.
00162     // It is assumed that this will be destroyed when we go out of
00163     // scope.
00164     contentListener = new EmbedContentListener(q);
00165     contentListenerGuard = NS_STATIC_CAST(nsISupports*,
00166                                           NS_STATIC_CAST(nsIURIContentListener*, contentListener));
00167 
00168     // Create our key listener object and initialize it.  It is assumed
00169     // that this will be destroyed before we go out of scope.
00170     eventListener = new EmbedEventListener(q);
00171     eventListenerGuard =
00172         NS_STATIC_CAST(nsISupports *, NS_STATIC_CAST(nsIDOMKeyListener *,
00173                                                      eventListener));
00174 
00175     // has the window creator service been set up?
00176     static int initialized = PR_FALSE;
00177     // Set up our window creator ( only once )
00178     if (!initialized) {
00179         // create our local object
00180         nsCOMPtr<nsIWindowCreator> windowCreator = new EmbedWindowCreator();
00181 
00182         // Attach it via the watcher service
00183         nsCOMPtr<nsIWindowWatcher> watcher = do_GetService(NS_WINDOWWATCHER_CONTRACTID);
00184         if (watcher)
00185             watcher->SetWindowCreator(windowCreator);
00186         initialized = PR_TRUE;
00187     }
00188 
00189     // Get the nsIWebBrowser object for our embedded window.
00190     nsCOMPtr<nsIWebBrowser> webBrowser;
00191     window->GetWebBrowser(getter_AddRefs(webBrowser));
00192 
00193     // get a handle on the navigation object
00194     navigation = do_QueryInterface(webBrowser);
00195 
00196     // Create our session history object and tell the navigation object
00197     // to use it.  We need to do this before we create the web browser
00198     // window.
00199     sessionHistory = do_CreateInstance(NS_SHISTORY_CONTRACTID);
00200     navigation->SetSessionHistory(sessionHistory);
00201 
00202     // create the window
00203     window->CreateWindow();
00204 
00205     // bind the progress listener to the browser object
00206     nsCOMPtr<nsISupportsWeakReference> supportsWeak;
00207     supportsWeak = do_QueryInterface(progressGuard);
00208     nsCOMPtr<nsIWeakReference> weakRef;
00209     supportsWeak->GetWeakReference(getter_AddRefs(weakRef));
00210     webBrowser->AddWebBrowserListener(weakRef,
00211                                       nsIWebProgressListener::GetIID());
00212 
00213     // set ourselves as the parent uri content listener
00214     webBrowser->SetParentURIContentListener(contentListener);
00215 
00216     // save the window id of the newly created window
00217     nsCOMPtr<nsIWidget> qtWidget;
00218     window->mBaseWindow->GetMainWidget(getter_AddRefs(qtWidget));
00219     // get the native drawing area
00220     mMainWidget = NS_STATIC_CAST(QWidget*, qtWidget->GetNativeData(NS_NATIVE_WINDOW));
00221 
00222     // Apply the current chrome mask
00223     ApplyChromeMask();
00224 }
00225 
00226 void
00227 QGeckoEmbedPrivate::initGUI()
00228 {
00229     QBoxLayout *l = new QHBoxLayout(q);
00230     l->setAutoAdd(TRUE);
00231 }
00232 
00233 void
00234 QGeckoEmbedPrivate::ApplyChromeMask()
00235 {
00236    if (window) {
00237       nsCOMPtr<nsIWebBrowser> webBrowser;
00238       window->GetWebBrowser(getter_AddRefs(webBrowser));
00239 
00240       nsCOMPtr<nsIDOMWindow> domWindow;
00241       webBrowser->GetContentDOMWindow(getter_AddRefs(domWindow));
00242       if (domWindow) {
00243           nsCOMPtr<nsIDOMBarProp> scrollbars;
00244           domWindow->GetScrollbars(getter_AddRefs(scrollbars));
00245           if (scrollbars) {
00246 
00247               scrollbars->SetVisible(
00248                   chromeMask & nsIWebBrowserChrome::CHROME_SCROLLBARS ?
00249                   PR_TRUE : PR_FALSE);
00250           }
00251       }
00252    }
00253 }
00254 
00255 
00256 
00257 
00258 QGeckoEmbed::QGeckoEmbed(QWidget *parent, const char *name)
00259     : QWidget(parent, name)
00260 {
00261     d = new QGeckoEmbedPrivate(this);
00262 }
00263 
00264 QGeckoEmbed::~QGeckoEmbed()
00265 {
00266     delete d;
00267 }
00268 
00269 
00270 bool
00271 QGeckoEmbed::canGoBack() const
00272 {
00273     PRBool retval = PR_FALSE;
00274     if (d->navigation)
00275         d->navigation->GetCanGoBack(&retval);
00276     return retval;
00277 }
00278 
00279 bool
00280 QGeckoEmbed::canGoForward() const
00281 {
00282     PRBool retval = PR_FALSE;
00283     if (d->navigation)
00284         d->navigation->GetCanGoForward(&retval);
00285     return retval;
00286 }
00287 
00288 void
00289 QGeckoEmbed::loadURL(const QString &url)
00290 {
00291     if (!url.isEmpty()) {
00292         d->navigation->LoadURI((const PRUnichar*)url.ucs2(),
00293                                nsIWebNavigation::LOAD_FLAGS_NONE, // Load flags
00294                                nsnull,                            // Referring URI
00295                                nsnull,                            // Post data
00296                                nsnull);
00297     }
00298 }
00299 
00300 void
00301 QGeckoEmbed::stopLoad()
00302 {
00303     if (d->navigation)
00304         d->navigation->Stop(nsIWebNavigation::STOP_NETWORK);
00305 }
00306 
00307 void
00308 QGeckoEmbed::goForward()
00309 {
00310     if (d->navigation)
00311         d->navigation->GoForward();
00312 }
00313 
00314 void
00315 QGeckoEmbed::goBack()
00316 {
00317     if (d->navigation)
00318         d->navigation->GoBack();
00319 }
00320 
00321 void
00322 QGeckoEmbed::renderData(const QCString &data, const QString &baseURI,
00323                             const QString &mimeType)
00324 {
00325     openStream(baseURI, mimeType);
00326     appendData(data);
00327     closeStream();
00328 }
00329 
00330 int
00331 QGeckoEmbed::openStream(const QString &baseURI, const QString &mimeType)
00332 {
00333     nsresult rv;
00334 
00335     if (!d->stream) {
00336         d->stream = new EmbedStream();
00337         d->streamGuard = do_QueryInterface(d->stream);
00338         d->stream->InitOwner(this);
00339         rv = d->stream->Init();
00340         if (NS_FAILED(rv))
00341             return rv;
00342     }
00343 
00344     rv = d->stream->OpenStream(baseURI, mimeType);
00345     return rv;
00346 }
00347 
00348 int
00349 QGeckoEmbed::appendData(const QCString &data)
00350 {
00351     if (!d->stream)
00352         return NS_ERROR_FAILURE;
00353 
00354     // Attach listeners to this document since in some cases we don't
00355     // get updates for content added this way.
00356     contentStateChanged();
00357 
00358     return d->stream->AppendToStream(data, data.length());
00359 }
00360 
00361 int
00362 QGeckoEmbed::closeStream()
00363 {
00364     nsresult rv;
00365 
00366     if (!d->stream)
00367         return NS_ERROR_FAILURE;
00368     rv = d->stream->CloseStream();
00369 
00370     // release
00371     d->stream = 0;
00372     d->streamGuard = 0;
00373 
00374     return rv;
00375 }
00376 
00377 void
00378 QGeckoEmbed::reload(ReloadFlags flags)
00379 {
00380     int qeckoFlags = 0;
00381     switch(flags) {
00382     case Normal:
00383         qeckoFlags = 0;
00384         break;
00385     case BypassCache:
00386         qeckoFlags = nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE;
00387         break;
00388     case BypassProxy:
00389         qeckoFlags = nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY;
00390         break;
00391     case BypassProxyAndCache:
00392         qeckoFlags = nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE |
00393                      nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY;
00394         break;
00395     case CharsetChange:
00396         qeckoFlags = nsIWebNavigation::LOAD_FLAGS_CHARSET_CHANGE;
00397         break;
00398     default:
00399         qeckoFlags = 0;
00400         break;
00401     }
00402 
00403 
00404     nsCOMPtr<nsIWebNavigation> wn;
00405 
00406     if (d->sessionHistory) {
00407         wn = do_QueryInterface(d->sessionHistory);
00408     }
00409     if (!wn)
00410         wn = d->navigation;
00411 
00412     if (wn)
00413         wn->Reload(qeckoFlags);
00414 }
00415 
00416 bool
00417 QGeckoEmbed::domKeyDownEvent(nsIDOMKeyEvent *keyEvent)
00418 {
00419     emit domKeyDown(keyEvent);
00420     return false;
00421 }
00422 
00423 bool
00424 QGeckoEmbed::domKeyPressEvent(nsIDOMKeyEvent *keyEvent)
00425 {
00426     emit domKeyPress(keyEvent);
00427     return false;
00428 }
00429 
00430 bool
00431 QGeckoEmbed::domKeyUpEvent(nsIDOMKeyEvent *keyEvent)
00432 {
00433     emit domKeyUp(keyEvent);
00434     return false;
00435 }
00436 
00437 bool
00438 QGeckoEmbed::domMouseDownEvent(nsIDOMMouseEvent *mouseEvent)
00439 {
00440     emit domMouseDown(mouseEvent);
00441     return false;
00442 }
00443 
00444 bool
00445 QGeckoEmbed::domMouseUpEvent(nsIDOMMouseEvent *mouseEvent)
00446 {
00447     emit domMouseUp(mouseEvent);
00448     return false;
00449 }
00450 
00451 bool
00452 QGeckoEmbed::domMouseClickEvent(nsIDOMMouseEvent *mouseEvent)
00453 {
00454     emit domMouseClick(mouseEvent);
00455     return false;
00456 }
00457 
00458 bool
00459 QGeckoEmbed::domMouseDblClickEvent(nsIDOMMouseEvent *mouseEvent)
00460 {
00461     emit domMouseDblClick(mouseEvent);
00462     return false;
00463 }
00464 
00465 bool
00466 QGeckoEmbed::domMouseOverEvent(nsIDOMMouseEvent *mouseEvent)
00467 {
00468     emit domMouseOver(mouseEvent);
00469     return false;
00470 }
00471 
00472 bool
00473 QGeckoEmbed::domMouseOutEvent(nsIDOMMouseEvent *mouseEvent)
00474 {
00475     emit domMouseOut(mouseEvent);
00476     return false;
00477 }
00478 
00479 bool
00480 QGeckoEmbed::domActivateEvent(nsIDOMUIEvent *event)
00481 {
00482     emit domActivate(event);
00483     return false;
00484 }
00485 
00486 bool
00487 QGeckoEmbed::domFocusInEvent(nsIDOMUIEvent *event)
00488 {
00489     emit domFocusIn(event);
00490     return false;
00491 }
00492 
00493 bool
00494 QGeckoEmbed::domFocusOutEvent(nsIDOMUIEvent *event)
00495 {
00496     emit domFocusOut(event);
00497     return false;
00498 }
00499 
00500 void
00501 QGeckoEmbed::emitScriptStatus(const QString &str)
00502 {
00503     emit jsStatusMessage(str);
00504 }
00505 
00506 void
00507 QGeckoEmbed::emitLinkStatus(const QString &str)
00508 {
00509     emit linkMessage(str);
00510 }
00511 
00512 int
00513 QGeckoEmbed::chromeMask() const
00514 {
00515     return d->chromeMask;
00516 }
00517 
00518 void
00519 QGeckoEmbed::setChromeMask(int mask)
00520 {
00521     d->chromeMask = mask;
00522 
00523     d->ApplyChromeMask();
00524 }
00525 
00526 void
00527 QGeckoEmbed::resizeEvent(QResizeEvent *e)
00528 {
00529     d->window->SetDimensions(nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER,
00530                               0, 0, e->size().width(), e->size().height());
00531 }
00532 
00533 nsIDOMDocument*
00534 QGeckoEmbed::document() const
00535 {
00536     nsIDOMDocument *doc = 0;
00537 
00538     nsCOMPtr<nsIDOMWindow> window;
00539     nsCOMPtr<nsIWebBrowser> webBrowser;
00540 
00541     d->window->GetWebBrowser(getter_AddRefs(webBrowser));
00542 
00543     webBrowser->GetContentDOMWindow(getter_AddRefs(window));
00544     if (window) {
00545         window->GetDocument(&doc);
00546     }
00547 
00548     return doc;
00549 }
00550 
00551 void
00552 QGeckoEmbed::contentStateChanged()
00553 {
00554     // we don't attach listeners to chrome
00555     if (d->listenersAttached && !d->isChrome)
00556         return;
00557 
00558     setupListener();
00559 
00560     if (!d->eventReceiver)
00561         return;
00562 
00563     attachListeners();
00564 }
00565 
00566 void
00567 QGeckoEmbed::contentFinishedLoading()
00568 {
00569     if (d->isChrome) {
00570         // We're done loading.
00571         d->chromeLoaded = PR_TRUE;
00572 
00573         // get the web browser
00574         nsCOMPtr<nsIWebBrowser> webBrowser;
00575         d->window->GetWebBrowser(getter_AddRefs(webBrowser));
00576 
00577         // get the content DOM window for that web browser
00578         nsCOMPtr<nsIDOMWindow> domWindow;
00579         webBrowser->GetContentDOMWindow(getter_AddRefs(domWindow));
00580         if (!domWindow) {
00581             NS_WARNING("no dom window in content finished loading\n");
00582             return;
00583         }
00584 
00585         // resize the content
00586         domWindow->SizeToContent();
00587 
00588         // and since we're done loading show the window, assuming that the
00589         // visibility flag has been set.
00590         PRBool visibility;
00591         d->window->GetVisibility(&visibility);
00592         if (visibility)
00593             d->window->SetVisibility(PR_TRUE);
00594     }
00595 }
00596 
00597 void
00598 QGeckoEmbed::setupListener()
00599 {
00600     if (d->eventReceiver)
00601         return;
00602 
00603     nsCOMPtr<nsPIDOMWindow> piWin;
00604     GetPIDOMWindow(getter_AddRefs(piWin));
00605 
00606     if (!piWin)
00607         return;
00608 
00609     d->eventReceiver = do_QueryInterface(piWin->GetChromeEventHandler());
00610 }
00611 
00612 void
00613 QGeckoEmbed::attachListeners()
00614 {
00615     if (!d->eventReceiver || d->listenersAttached)
00616         return;
00617 
00618     nsIDOMEventListener *eventListener =
00619         NS_STATIC_CAST(nsIDOMEventListener *,
00620                        NS_STATIC_CAST(nsIDOMKeyListener *, d->eventListener));
00621 
00622     // add the key listener
00623     nsresult rv;
00624     rv = d->eventReceiver->AddEventListenerByIID(eventListener,
00625                                                  NS_GET_IID(nsIDOMKeyListener));
00626     if (NS_FAILED(rv)) {
00627         NS_WARNING("Failed to add key listener\n");
00628         return;
00629     }
00630 
00631     rv = d->eventReceiver->AddEventListenerByIID(eventListener,
00632                                                  NS_GET_IID(nsIDOMMouseListener));
00633     if (NS_FAILED(rv)) {
00634         NS_WARNING("Failed to add mouse listener\n");
00635         return;
00636     }
00637 
00638     rv = d->eventReceiver->AddEventListenerByIID(eventListener,
00639                                                 NS_GET_IID(nsIDOMUIListener));
00640     if (NS_FAILED(rv)) {
00641         NS_WARNING("Failed to add UI listener\n");
00642         return;
00643     }
00644 
00645     // ok, all set.
00646     d->listenersAttached = PR_TRUE;
00647 }
00648 
00649 EmbedWindow * QGeckoEmbed::window() const
00650 {
00651     return d->window;
00652 }
00653 
00654 
00655 int QGeckoEmbed::GetPIDOMWindow(nsPIDOMWindow **aPIWin)
00656 {
00657     *aPIWin = nsnull;
00658 
00659     // get the web browser
00660     nsCOMPtr<nsIWebBrowser> webBrowser;
00661     d->window->GetWebBrowser(getter_AddRefs(webBrowser));
00662 
00663     // get the content DOM window for that web browser
00664     nsCOMPtr<nsIDOMWindow> domWindow;
00665     webBrowser->GetContentDOMWindow(getter_AddRefs(domWindow));
00666     if (!domWindow)
00667         return NS_ERROR_FAILURE;
00668 
00669     // get the private DOM window
00670     nsCOMPtr<nsPIDOMWindow> domWindowPrivate = do_QueryInterface(domWindow);
00671     // and the root window for that DOM window
00672     *aPIWin = domWindowPrivate->GetPrivateRoot();
00673 
00674     if (*aPIWin) {
00675         NS_ADDREF(*aPIWin);
00676         return NS_OK;
00677     }
00678 
00679     return NS_ERROR_FAILURE;
00680 
00681 }
00682 
00683 void QGeckoEmbed::setIsChrome(bool isChrome)
00684 {
00685     d->isChrome = isChrome;
00686 }
00687 
00688 bool QGeckoEmbed::isChrome() const
00689 {
00690     return d->isChrome;
00691 }
00692 
00693 bool QGeckoEmbed::chromeLoaded() const
00694 {
00695     return d->chromeLoaded;
00696 }
00697 
00698 QString QGeckoEmbed::url() const
00699 {
00700     nsCOMPtr<nsIURI> uri;
00701     d->navigation->GetCurrentURI(getter_AddRefs(uri));
00702     nsCAutoString acstring;
00703     uri->GetSpec(acstring);
00704 
00705     return QString::fromUtf8(acstring.get());
00706 }
00707 
00708 QString QGeckoEmbed::resolvedUrl(const QString &relativepath) const
00709 {
00710     nsCOMPtr<nsIURI> uri;
00711     d->navigation->GetCurrentURI(getter_AddRefs(uri));
00712     nsCAutoString rel;
00713     rel.Assign(relativepath.utf8().data());
00714     nsCAutoString resolved;
00715     uri->Resolve(rel, resolved);
00716 
00717     return QString::fromUtf8(resolved.get());
00718 }
00719 
00720 void QGeckoEmbed::initialize(const char *aDir, const char *aName)
00721 {
00722     QGeckoGlobals::setProfilePath(aDir, aName);
00723 }
00724