browsercore/core/wrtbrowsercontainer.cpp
changeset 5 0f2326c2a325
parent 0 1450b09d0cfd
child 6 1c3b8676e58c
equal deleted inserted replaced
1:b0dd75e285d2 5:0f2326c2a325
     1 /*
     1 /*
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
     4 *
     9 * Initial Contributors:
     5 * This program is free software: you can redistribute it and/or modify
    10 * Nokia Corporation - initial contribution.
     6 * it under the terms of the GNU Lesser General Public License as published by
       
     7 * the Free Software Foundation, version 2.1 of the License.
       
     8 * 
       
     9 * This program is distributed in the hope that it will be useful,
       
    10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    12 * GNU Lesser General Public License for more details.
    11 *
    13 *
    12 * Contributors:
    14 * You should have received a copy of the GNU Lesser General Public License
       
    15 * along with this program.  If not, 
       
    16 * see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
    13 *
    17 *
    14 * Description: 
    18 * Description:
    15 *
    19 *
    16 */
    20 */
    17 
    21 
    18 
       
    19 #include "browserpagefactory.h"
    22 #include "browserpagefactory.h"
    20 #include "webcontentview.h"
       
    21 #include "wrtpage.h"
       
    22 #include "wrtbrowsercontainer_p.h"
    23 #include "wrtbrowsercontainer_p.h"
    23 #include "wrtbrowsercontainer.h"
    24 #include "wrtbrowsercontainer.h"
    24 #include "webpagedata.h"
    25 #include "webpagedata.h"
    25 #include "qwebhistory.h"
       
    26 #include "qwebframe.h"
       
    27 #include "SchemeHandlerBr.h"
    26 #include "SchemeHandlerBr.h"
    28 #include "webnetworkaccessmanager.h"
    27 #include "webnetworkaccessmanager.h"
    29 #ifdef QT_MOBILITY_BEARER_MANAGEMENT
       
    30 #include "WebNetworkConnectionManager.h"
       
    31 #endif // QT_MOBILITY_BEARER_MANAGEMENT
       
    32 #include "webcookiejar.h"
    28 #include "webcookiejar.h"
    33 #include "webnavigation.h"
       
    34 #include "secureuicontroller.h"
    29 #include "secureuicontroller.h"
    35 #include "LoadController.h"
    30 #include "LoadController.h"
    36 #include "WebDialogProvider.h"
    31 #include "WebDialogProvider.h"
    37 #include "bedrockprovisioning.h"
    32 #include "bedrockprovisioning.h"
    38 #include <QPainter>
    33 #include <QPainter>
    39 #include <QAuthenticator>
    34 #include <QAuthenticator>
    40 #include <QFile>
    35 #include <QFile>
    41 #include <QMessageBox>
    36 #include <QMessageBox>
       
    37 #include <QWebHistory>
       
    38 #include <QWebFrame>
       
    39 #include <QGraphicsWebView>
       
    40 
       
    41 QDataStream &operator<<(QDataStream &out, const WebPageData &myObj)
       
    42 {
       
    43    out << myObj.m_thumbnail << myObj.m_zoomFactor << myObj.m_contentsPos;
       
    44    return out;
       
    45 }
       
    46 
       
    47 QDataStream &operator>>(QDataStream &in, WebPageData &myObj)
       
    48 {
       
    49    in >> myObj.m_thumbnail >> myObj.m_zoomFactor >> myObj.m_contentsPos;
       
    50    return in;
       
    51 }
    42 
    52 
    43 namespace WRT
    53 namespace WRT
    44 {
    54 {
    45 
    55 const int historyItemsCount = 10;
    46 const int historyItemsCount = 20;
       
    47 
    56 
    48 WrtBrowserContainerPrivate::WrtBrowserContainerPrivate(QObject* parent,
    57 WrtBrowserContainerPrivate::WrtBrowserContainerPrivate(QObject* parent,
    49 		WrtBrowserContainer* page/*never NULL*/) : m_schemeHandler(new SchemeHandler())
    58 		WrtBrowserContainer* page/*never NULL*/) : m_schemeHandler(new SchemeHandler())
    50 ,   m_pageFactory(0)
    59 ,   m_pageFactory(0)
    51 ,   m_widget(0)
    60 ,   m_widget(0)
    52 {
    61 ,   m_fileChooser(0)
    53     assert(page);
    62 {
    54     m_page = page;
    63     m_page = page;
    55 
    64 
    56     m_secureController = new WRT::SecureUIController(parent);
    65     m_secureController = new WRT::SecureUIController(parent);
    57     m_loadController = new  WRT::LoadController();
    66     m_loadController = new  WRT::LoadController();
    58  
    67  
    68 	if (m_page)
    77 	if (m_page)
    69 		m_page->disconnect();
    78 		m_page->disconnect();
    70 	delete m_schemeHandler;
    79 	delete m_schemeHandler;
    71   delete m_secureController;
    80   delete m_secureController;
    72   delete m_loadController;
    81   delete m_loadController;
       
    82   delete m_fileChooser;
    73 }
    83 }
    74 
    84 
    75 /*!
    85 /*!
    76  * Static function which creates Wrt page with parent Widget
    86  * Static function which creates Wrt page with parent Widget
    77  * @param parent   : parent widget for the new page
    87  * @param parent   : parent widget for the new page
    88     else
    98     else
    89         return new WrtBrowserContainer(parent);
    99         return new WrtBrowserContainer(parent);
    90 }
   100 }
    91 
   101 
    92 /*!
   102 /*!
    93  * \class WrtBrowserContainer
       
    94  * \brief Description: This class is a handle to open page on which user can
       
    95  * load an url , view history items, load an history item into the page etc.
       
    96  * @see WrtPageManager
       
    97  */
       
    98 
       
    99 /*!
       
   100  * WrtBrowserContainer Constructor
   103  * WrtBrowserContainer Constructor
   101  * @param parent : Widget parent
   104  * @param parent : Widget parent
   102  */
   105  */
   103 WrtBrowserContainer::WrtBrowserContainer(QObject* parent) :
   106 WrtBrowserContainer::WrtBrowserContainer(QObject* parent) :
   104 	WrtPage(parent), d(new WrtBrowserContainerPrivate(this, this))
   107 	QWebPage(parent), d(new WrtBrowserContainerPrivate(this, this))
   105 {
   108 {
       
   109     
       
   110   settings()->setAttribute(QWebSettings::PluginsEnabled, true);
       
   111   settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, !BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->value("PopupBlocking").toInt());
   106 	// Download related enable "forwardUnsupportedContent" to redirect unsupported content to download manager
   112 	// Download related enable "forwardUnsupportedContent" to redirect unsupported content to download manager
   107 	setForwardUnsupportedContent(true);
   113 	setForwardUnsupportedContent(true);
   108 
   114 
   109 #ifndef NO_NETWORK_ACCESS_MANAGER	
   115 #ifndef NO_NETWORK_ACCESS_MANAGER	
   110 	setNetworkAccessManager(new WebNetworkAccessManager(this,this));
   116 	setNetworkAccessManager(new WebNetworkAccessManager(this,this));
   111 #endif
   117 #endif
   112 	
   118 	
   113 #ifdef QT_MOBILITY_BEARER_MANAGEMENT
       
   114 	setNetworkConnectionManager(new WebNetworkConnectionManager(this));
       
   115 #endif // QT_MOBILITY_BEARER_MANAGEMENT
       
   116 	history()->setMaximumItemCount(historyItemsCount);
   119 	history()->setMaximumItemCount(historyItemsCount);
   117 
       
   118 	connect(this,
       
   119 			SIGNAL(saveFrameStateRequested(QWebFrame*, QWebHistoryItem*)),
       
   120 			this, SLOT(savePageDataToHistoryItem(QWebFrame*, QWebHistoryItem*)));
       
   121 
   120 
   122     /* Connect secure related signals and slots */
   121     /* Connect secure related signals and slots */
   123     connect(mainFrame(), SIGNAL(urlChanged(QUrl)), d->m_secureController, SLOT(setTopLevelScheme(const QUrl &)));
   122     connect(mainFrame(), SIGNAL(urlChanged(QUrl)), d->m_secureController, SLOT(setTopLevelScheme(const QUrl &)));
   124     connect(this, SIGNAL(loadFinished(bool)), d->m_secureController, SLOT( endSecureCheck(bool) ) );
   123     connect(this, SIGNAL(loadFinished(bool)), d->m_secureController, SLOT( endSecureCheck(bool) ) );
   125     connect(d->m_secureController, SIGNAL(pageSecureState(int)), this, SLOT(pageSecureState(int)));
   124     connect(d->m_secureController, SIGNAL(pageSecureState(int)), this, SLOT(pageSecureState(int)));
   128     connect(this, SIGNAL(loadStarted()), d->m_loadController, SLOT(loadStarted()));
   127     connect(this, SIGNAL(loadStarted()), d->m_loadController, SLOT(loadStarted()));
   129     connect(this, SIGNAL(loadProgress(int)), d->m_loadController, SLOT(loadProgress(int)));
   128     connect(this, SIGNAL(loadProgress(int)), d->m_loadController, SLOT(loadProgress(int)));
   130     connect(this, SIGNAL(loadFinished(bool)), d->m_loadController, SLOT(loadFinished(bool)));
   129     connect(this, SIGNAL(loadFinished(bool)), d->m_loadController, SLOT(loadFinished(bool)));
   131     connect(mainFrame(), SIGNAL(urlChanged(QUrl)), d->m_loadController, SLOT(urlChanged(QUrl)));
   130     connect(mainFrame(), SIGNAL(urlChanged(QUrl)), d->m_loadController, SLOT(urlChanged(QUrl)));
   132     
   131     
   133 	// All pages in the browser share the same pageGroup.
       
   134 	d->m_pageGroupName = "nokia_page_group";
       
   135 	setPageGroupName(d->m_pageGroupName);
       
   136 }
   132 }
   137 
   133 
   138 /*!
   134 /*!
   139  * WrtBrowserContainer destructor
   135  * WrtBrowserContainer destructor
   140  */
   136  */
   144 	if (!disconnect())
   140 	if (!disconnect())
   145 		qWarning("WrtPage destructor blanket disconnect failed");
   141 		qWarning("WrtPage destructor blanket disconnect failed");
   146 
   142 
   147     //setNetworkAccessManager(NULL);
   143     //setNetworkAccessManager(NULL);
   148    delete d;
   144    delete d;
       
   145    
       
   146    // 
       
   147    QList<QWebHistoryItem> items = history()->items();
       
   148 
       
   149    for (int i = 0; i < history()->count(); i++) {
       
   150        QWebHistoryItem item = items.at(i);
       
   151        WebPageData* data = (WebPageData*)(item.userData().value<void*>());
       
   152        if(data){
       
   153            QVariant variant;
       
   154            item.setUserData(variant);
       
   155            delete data;
       
   156        }
       
   157    }
   149 }
   158 }
   150 
   159 
   151 QGraphicsWidget* WrtBrowserContainer::webWidget() const
   160 QGraphicsWidget* WrtBrowserContainer::webWidget() const
   152 {
   161 {
   153     return d->m_widget;
   162     return d->m_widget;
   154 }
   163 }
   155 
   164 
   156 void WrtBrowserContainer::setWebWidget(QGraphicsWidget* view)
   165 void WrtBrowserContainer::setWebWidget(QGraphicsWidget* view)
   157 {
   166 {
   158     if(d->m_widget) {
       
   159         disconnect(static_cast<WebContentWidget*>(webWidget()), SIGNAL(pageZoomMetaDataChange(QWebFrame*, ZoomMetaData)), this, SLOT(pageZoomMetaDataChange(QWebFrame*, ZoomMetaData)));
       
   160     }
       
   161 
       
   162     d->m_widget = view;
   167     d->m_widget = view;
   163 
   168 
   164     if (view)
   169     if (view)
   165     {
   170     {
   166         QGraphicsWebView* webView = static_cast<QGraphicsWebView*>(view);
   171         QGraphicsWebView* webView = static_cast<QGraphicsWebView*>(view);
   167         if(webView)
   172         if(webView)
   168             webView->setPage(this);
   173             webView->setPage(this);
   169 
   174 
   170         /* Currently connecting it here. Need to revisit if the dialog is enabled in the
       
   171          * context of multiple windows */
       
   172         connect( d->m_secureController, SIGNAL( showMessageBox(WRT::MessageBoxProxy*)), static_cast<WebContentWidget*>(webWidget())->view(), SLOT( showMessageBox(WRT::MessageBoxProxy*)));
       
   173 
       
   174         connect(static_cast<WebContentWidget*>(webWidget()), SIGNAL(pageZoomMetaDataChange(QWebFrame*, ZoomMetaData)), this, SLOT(pageZoomMetaDataChange(QWebFrame*, ZoomMetaData)));
       
   175     }
   175     }
   176 }
   176 }
   177  
   177  
   178 /*!
   178 /*!
   179  * Handles pageSecureState state 
   179  * Handles pageSecureState state 
   188  * Returns schemeHandler
   188  * Returns schemeHandler
   189  */
   189  */
   190 SchemeHandler* WrtBrowserContainer::schemeHandler() const
   190 SchemeHandler* WrtBrowserContainer::schemeHandler() const
   191 {
   191 {
   192    return d->m_schemeHandler;
   192    return d->m_schemeHandler;
   193 }
       
   194 
       
   195 /*!
       
   196  * Gets the history count for this page, i.e gets the number of urls loaded
       
   197  * onto this page
       
   198  * @return  History count of this page
       
   199  */
       
   200 int WrtBrowserContainer::getHistoryCount() const
       
   201 {
       
   202 	return history()->count();
       
   203 }
       
   204 
       
   205 /*!
       
   206  * Triggers public Action
       
   207  * @param WebAction : web action to be triggred
       
   208  * @param checked  : true/false
       
   209  * @see   WebAction
       
   210  */
       
   211 /*void WrtBrowserContainer::triggerAction(QWebPage::WebAction action, bool checked)
       
   212  {
       
   213  triggerAction(action, checked);
       
   214  }
       
   215  */
       
   216 
       
   217 /*!
       
   218  * clears cookies
       
   219  */
       
   220 void WrtBrowserContainer::clearCookies()
       
   221 {
       
   222 	return ((CookieJar*) networkAccessManager()->cookieJar())->clear();
       
   223 }
       
   224 
       
   225 bool WrtBrowserContainer::clearNetworkCache()
       
   226 {
       
   227    bool ok = false;
       
   228     QAbstractNetworkCache* diskCache = networkAccessManager()->cache();
       
   229     diskCache->clear();
       
   230     if (!diskCache->cacheSize()) { 
       
   231        // Unless there was failures clearing the cache cacheSize() should return 0 after a call to clear 
       
   232        ok = true;
       
   233    }
       
   234    return ok;
       
   235 }
   193 }
   236 
   194 
   237 /*!
   195 /*!
   238  * This function page thumbnail for this page as specified by X & Y co-ordinate scale factors
   196  * This function page thumbnail for this page as specified by X & Y co-ordinate scale factors
   239  * @param  scaleX :  X Co-ordinate scale factor for the page thumbnail
   197  * @param  scaleX :  X Co-ordinate scale factor for the page thumbnail
   251     painter.save();
   209     painter.save();
   252     painter.setBrush(Qt::white);
   210     painter.setBrush(Qt::white);
   253     painter.drawRect(r);
   211     painter.drawRect(r);
   254     painter.restore();
   212     painter.restore();
   255     mainFrame()->render(&painter, clip);
   213     mainFrame()->render(&painter, clip);
   256     return image;
   214     QImage thumbnail = image.scaled(scaleX * size.width(), scaleY * size.height());
   257 }
   215     return thumbnail;
   258 
   216 }
   259 /*!
       
   260  * sets the page zoom factor as specified by zoom
       
   261  * @param zoom : page zoom factor to be set
       
   262  */
       
   263 void WrtBrowserContainer::setPageZoomFactor(qreal zoom)
       
   264 {
       
   265    // FiX ME ... canvas zoom doesn't seem to support text-only zooming.
       
   266    //static_cast<WebCanvasWidget*>(webWidget())->canvas()->setPageZoomFactor(zoom);
       
   267 
       
   268 	bool isZoomTextOnly = BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->value(
       
   269 			"ZoomTextOnly").toBool();
       
   270 
       
   271 	if (!isZoomTextOnly)
       
   272 	{
       
   273 		// mainFrame()->setZoomFactor(zoom);
       
   274 		static_cast<WebContentWidget*> (webWidget())->setZoomFactor(zoom);
       
   275 	}
       
   276 	else
       
   277 	{
       
   278 		//mainFrame()->setTextSizeMultiplier(zoom);
       
   279 		static_cast<WebContentWidget*> (webWidget())->setTextSizeMultiplier(
       
   280 				zoom);
       
   281     }
       
   282 }
       
   283 
       
   284 /*!
       
   285  * setpageDirtyZoomFactor
       
   286  * @param zoom: page zoom factor to be set
       
   287  */
       
   288 void WrtBrowserContainer::setPageDirtyZoomFactor(qreal zoom)
       
   289 {
       
   290    // FIXME: dirty page zoom is not supported yet in single-buffer mode.
       
   291    static_cast<WebContentWidget*> (webWidget())->setDirtyZoomFactor(zoom);
       
   292 }
       
   293 
       
   294 /*!
       
   295  * setpageCenterZoomFactor
       
   296  * @param zoom: center page zoom factor to be set
       
   297  */
       
   298 // TODO: hold on this change until zoom/scrolling improvement 
       
   299 /*
       
   300  void WrtBrowserContainer::setPageCenterZoomFactor(qreal zoom)
       
   301  {
       
   302  static_cast<WebCanvasWidget*>(webWidget())->canvas()->setPageCenterZoomFactor(zoom);
       
   303  }
       
   304  */
       
   305 /*!
       
   306  * returns the current page zoom factor of this page
       
   307  * @return current zoom factor
       
   308  */
       
   309 qreal WrtBrowserContainer::pageZoomFactor() const
       
   310 {
       
   311    return static_cast<WebContentWidget*> (webWidget())->zoomFactor();
       
   312 }
       
   313 
       
   314 /*!
       
   315  * sets the Canvas ScaleFactor  for this page
       
   316  * @param  scaleX :  X Co-ordinate scale factor
       
   317  * @param  scaleY :  Y Co-ordinate scale factor
       
   318  */
       
   319 void WrtBrowserContainer::setCanvasScaleFactor(qreal scaleX, qreal scaleY)
       
   320 {
       
   321    QTransform transform;
       
   322    transform.scale(scaleX, scaleY);
       
   323    //     static_cast<ContentView*>(webWidget())->setTransform(transform);
       
   324 }
       
   325 
       
   326 /*!
       
   327  * allows offlineStorage for url
       
   328  * @param url : url for which offlinestorage has to be enabled
       
   329  */
       
   330 bool WrtBrowserContainer::allowOfflineStorage(const QUrl& url)
       
   331 {
       
   332    if (BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->value("SecurityLevel").toInt()
       
   333          != SecurityHigh)
       
   334       return true;
       
   335 
       
   336 	QStringList yesno;
       
   337 	yesno << "Yes" << "No";
       
   338 	return (WebDialogProvider::getButtonResponse(
       
   339 			0, /* webWidget(), Check, that widget is required */
       
   340 			QString(
       
   341 					"Offline Database: This host asking for storing data in offline database, allow?"),
       
   342 			yesno));
       
   343 }
       
   344 
       
   345 
   217 
   346 /*!
   218 /*!
   347  Pulic Slots:
   219  Pulic Slots:
   348  void savePageDataToHistoryItem(QWebFrame*, QWebHistoryItem* item);
   220  void savePageDataToHistoryItem(QWebFrame*, QWebHistoryItem* item);
   349  void slotAuthenticationRequired(QNetworkReply *, QAuthenticator *);
   221  void slotAuthenticationRequired(QNetworkReply *, QAuthenticator *);
   365     }
   237     }
   366     if (restoreSession()) return;
   238     if (restoreSession()) return;
   367     	
   239     	
   368     WebPageData data(this);
   240     WebPageData data(this);
   369     //   WebPageData data = item->userData().value<WebPageData>();
   241     //   WebPageData data = item->userData().value<WebPageData>();
   370     data.m_zoomFactor = pageZoomFactor();
   242     data.m_zoomFactor = 1.0; // Need to find a way to get this.  Not used right now anyway
   371     data.m_thumbnail = pageThumbnail(1.0, 1.0);//data.m_zoomFactor, data.m_zoomFactor);
   243     data.m_thumbnail = pageThumbnail(0.5, 0.5);//data.m_zoomFactor, data.m_zoomFactor);
   372 
   244 
   373     QPoint pos(0, 0);
   245     QPoint pos(0, 0);
   374     //    pos = static_cast<WebCanvasWidget*>(webWidget())->canvas()->canvasToDocument(pos);
   246     //    pos = static_cast<WebCanvasWidget*>(webWidget())->canvas()->canvasToDocument(pos);
   375     pos = mainFrame()->scrollPosition();
   247     pos = mainFrame()->scrollPosition();
   376     data.m_contentsPos = pos;
   248     data.m_contentsPos = pos;
   411 		authenticator->setUser(username);
   283 		authenticator->setUser(username);
   412 		authenticator->setPassword(password);
   284 		authenticator->setPassword(password);
   413     }
   285     }
   414 }
   286 }
   415 
   287 
   416 QWebPage* WrtBrowserContainer::createWindow(
       
   417     QWebPage::WebWindowType webWindowType)
       
   418 {
       
   419 
       
   420     /* When WrtPage is created, QWebSettings::JavascriptCanOpenWindows is initialized
       
   421      * to popup setting value. Need not do any check here 
       
   422      */
       
   423     if (d->m_pageFactory)
       
   424     {
       
   425         // no need to signal in this case
       
   426         return d->m_pageFactory->openPage();
       
   427     }
       
   428 
       
   429     WrtBrowserContainer* wrtPage = new WrtBrowserContainer();
       
   430     emit createNewWindow(wrtPage);
       
   431     return wrtPage;
       
   432 }
       
   433 
       
   434 void WrtBrowserContainer::setPageFactory(BrowserPageFactory* f)
   288 void WrtBrowserContainer::setPageFactory(BrowserPageFactory* f)
   435 {
   289 {
   436     d->m_pageFactory = f;
   290     d->m_pageFactory = f;
   437 }
       
   438 
       
   439 void WrtBrowserContainer::setElementType(
       
   440       wrtBrowserDefs::BrowserElementType& aElType)
       
   441 {
       
   442     m_elementType = aElType;
       
   443 }
       
   444 wrtBrowserDefs::BrowserElementType WrtBrowserContainer::getElementType()
       
   445 {
       
   446    return m_elementType;
       
   447 }
   291 }
   448 
   292 
   449 QString WrtBrowserContainer::pageTitle(){
   293 QString WrtBrowserContainer::pageTitle(){
   450 
   294 
   451     QString title = mainFrame()->title();
   295     QString title = mainFrame()->title();
   493         result = true;
   337         result = true;
   494 
   338 
   495     return result;
   339     return result;
   496 }
   340 }
   497 
   341 
   498 void WrtBrowserContainer::pageZoomMetaDataChange(QWebFrame* frame,  ZoomMetaData  zoomData ){
       
   499 
       
   500     //qDebug() << __func__ << "Frame " << frame << "My Frame " << mainFrame();
       
   501     if (frame == mainFrame()) {
       
   502         setPageZoomMetaData(zoomData);
       
   503     } 
       
   504 }
       
   505 
       
   506 ZoomMetaData WrtBrowserContainer::pageZoomMetaData() {
   342 ZoomMetaData WrtBrowserContainer::pageZoomMetaData() {
   507     return d->m_zoomData ;
   343     return d->m_zoomData ;
   508 
   344 
   509 }
   345 }
   510 void WrtBrowserContainer::setPageZoomMetaData( ZoomMetaData  zoomData ){
   346 void WrtBrowserContainer::setPageZoomMetaData( ZoomMetaData  zoomData ){
   511 
   347 
   512     d->m_zoomData = zoomData;
   348     d->m_zoomData = zoomData;
   513 }
   349 }
   514 
   350 
   515 
   351 
   516 }
   352 WrtBrowserFileChooser::~WrtBrowserFileChooser()
   517 
   353 {}
   518 
   354 
       
   355 void WrtBrowserContainer::setFileChooser(WrtBrowserFileChooser * chooser)
       
   356 {
       
   357     if (d->m_fileChooser) {
       
   358         delete d->m_fileChooser;
       
   359     }
       
   360 
       
   361     d->m_fileChooser = chooser;
       
   362 }
       
   363 
       
   364 QString WrtBrowserContainer::chooseFile(QWebFrame * parentFrame, const QString & suggestedFile)
       
   365 {
       
   366     if (d->m_fileChooser != 0) {
       
   367         return d->m_fileChooser->chooseFile(parentFrame, suggestedFile);
       
   368     }
       
   369 
       
   370     return QWebPage::chooseFile(parentFrame, suggestedFile);
       
   371 }
       
   372 
       
   373 WRT::WrtBrowserContainer* WrtBrowserContainer::createWindow(
       
   374     QWebPage::WebWindowType webWindowType)
       
   375 {
       
   376 
       
   377     /* When WrtPage is created, QWebSettings::JavascriptCanOpenWindows is initialized
       
   378      * to popup setting value. Need not do any check here 
       
   379      */
       
   380     if (d->m_pageFactory)
       
   381     {
       
   382         // no need to signal in this case
       
   383         return d->m_pageFactory->openPage();
       
   384     }
       
   385 
       
   386     WrtBrowserContainer* wrtPage = new WrtBrowserContainer();
       
   387     emit createNewWindow(wrtPage);
       
   388     return wrtPage;
       
   389 }
       
   390 
       
   391 
       
   392 } // namespace WRT
       
   393