browsercore/core/wrtbrowsercontainer.h
branchGCC_SURGE
changeset 8 2e16851ffecd
parent 6 1c3b8676e58c
equal deleted inserted replaced
2:bf4420e9fa4d 8:2e16851ffecd
     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 
       
    18 
    21 
    19 #ifndef __WRTBROWSERCONTAINER_H__
    22 #ifndef __WRTBROWSERCONTAINER_H__
    20 #define __WRTBROWSERCONTAINER_H__
    23 #define __WRTBROWSERCONTAINER_H__
    21 
    24 
    22 #include "brtglobal.h"
    25 #include "brtglobal.h"
    23 
    26 
    24 #include "qwebpage.h"
    27 #include <QWebPage>
    25 #include "wrtpage.h"
       
    26 #include "wrtbrowsercontainer_p.h"
    28 #include "wrtbrowsercontainer_p.h"
    27 #include "wrtBrowserDefs.h"
    29 #include "wrtBrowserDefs.h"
    28 #include "ZoomMetaData.h"
    30 #include "ZoomMetaData.h"
    29 
    31 
    30 
    32 
    40 class QNetworkProxy;
    42 class QNetworkProxy;
    41 class QNetworkAccessManager;
    43 class QNetworkAccessManager;
    42 
    44 
    43 namespace WRT {
    45 namespace WRT {
    44 
    46 
    45 class WrtPage;
       
    46 class WrtController;
    47 class WrtController;
    47 class WrtBrowserContainerPrivate;
    48 class WrtBrowserContainerPrivate;
    48 class SchemeHandler;
    49 class SchemeHandler;
    49 class SecureUIController;
    50 class SecureUIController;
    50 class LoadController;
    51 class LoadController;
    51 
    52 
    52 class WRT_BROWSER_EXPORT WrtBrowserContainer : public WrtPage
    53 class WRT_BROWSER_EXPORT WrtBrowserFileChooser
       
    54 {
       
    55 public:
       
    56     virtual ~WrtBrowserFileChooser();
       
    57     virtual QString chooseFile(QWebFrame * parentFrame, const QString & suggestedFile) = 0;
       
    58 };
       
    59 
       
    60 class WRT_BROWSER_EXPORT WrtBrowserContainer : public QWebPage
    53 {
    61 {
    54     Q_OBJECT
    62     Q_OBJECT
    55 public:
       
    56    /*!
       
    57     * enum for security Level
       
    58     */
       
    59     enum {
       
    60         /**Low security*/
       
    61         SecurityLow,
       
    62         /**Meduium Security*/
       
    63         SecurityMedium,
       
    64         /**High Security*/
       
    65         SecurityHigh
       
    66     };
       
    67 
       
    68 public:
    63 public:
    69     static WrtBrowserContainer* createPageWithWidgetParent(QObject* parent=0,WrtBrowserContainer* page=0);
    64     static WrtBrowserContainer* createPageWithWidgetParent(QObject* parent=0,WrtBrowserContainer* page=0);
    70     explicit WrtBrowserContainer(QObject* parent = 0);
    65     explicit WrtBrowserContainer(QObject* parent = 0);
    71     virtual ~WrtBrowserContainer();
    66     virtual ~WrtBrowserContainer();
    72     
    67     
       
    68     virtual WrtBrowserContainer* createWindow(QWebPage::WebWindowType);
       
    69 
    73     QGraphicsWidget* webWidget() const;
    70     QGraphicsWidget* webWidget() const;
    74     void setWebWidget(QGraphicsWidget* view);
    71     void setWebWidget(QGraphicsWidget* view);
    75     SchemeHandler* schemeHandler() const;
    72     SchemeHandler* schemeHandler() const;
    76 
    73 
    77     int getHistoryCount() const;
       
    78     void clearCookies();
       
    79     bool clearNetworkCache();
       
    80 	
       
    81     QImage pageThumbnail(qreal scaleX, qreal scaley);
    74     QImage pageThumbnail(qreal scaleX, qreal scaley);
    82     void setPageZoomFactor(qreal zoom);
       
    83     void setPageDirtyZoomFactor(qreal zoom);
       
    84 //   TODO: Hold on this hookup after zooming and scrolling improvment	
       
    85 //    void setPageCenterZoomFactor(qreal zoom); 
       
    86     qreal pageZoomFactor() const;
       
    87     void setCanvasScaleFactor(qreal scaleX, qreal scaleY);
       
    88 
    75 
    89     bool allowOfflineStorage(const QUrl& url);
       
    90 
       
    91     QWebPage* createWindow(QWebPage::WebWindowType webWindowType);
       
    92     void setPageFactory(BrowserPageFactory* f);
    76     void setPageFactory(BrowserPageFactory* f);
    93     wrtBrowserDefs::BrowserElementType getElementType();
       
    94 
    77 
    95     QString pageTitle();
    78     QString pageTitle();
    96     
    79     
    97     int secureState();
    80     int secureState();
    98     WRT::LoadController * loadController( ) {return d->m_loadController;}
    81     WRT::LoadController * loadController( ) {return d->m_loadController;}
   101     void setPageZoomMetaData( ZoomMetaData zoomData );
    84     void setPageZoomMetaData( ZoomMetaData zoomData );
   102     
    85     
   103     /* Indicates whether this is a blank window with no page loaded*/
    86     /* Indicates whether this is a blank window with no page loaded*/
   104     bool emptyWindow();
    87     bool emptyWindow();
   105     bool restoreSession();
    88     bool restoreSession();
       
    89 
       
    90     void setFileChooser(WrtBrowserFileChooser * chooser);
   106     
    91     
       
    92     void setUpdateThumbnail(bool update) { d->m_needUpdateThumbnail = update; }
       
    93     bool needUpdateThumbnail() { return d->m_needUpdateThumbnail; }
       
    94 
       
    95 protected:
       
    96     virtual QString chooseFile(QWebFrame * parentFrame, const QString & suggestedFile);
       
    97     virtual QString userAgentForUrl(const QUrl& url) const;
       
    98 
       
    99 
   107 Q_SIGNALS:
   100 Q_SIGNALS:
       
   101 
   108     void createNewWindow(WrtBrowserContainer* page);
   102     void createNewWindow(WrtBrowserContainer* page);
   109 
       
   110     void pageScrollPositionZero();
   103     void pageScrollPositionZero();
   111 
   104 
   112     void longPressEvent();
       
   113     void secureStateChange(int);
   105     void secureStateChange(int);
   114 
   106 
   115 public slots:
   107 public slots:
   116     void savePageDataToHistoryItem(QWebFrame*, QWebHistoryItem* item);
   108     void savePageDataToHistoryItem(QWebFrame*, QWebHistoryItem* item);
   117     void slotAuthenticationRequired(QNetworkReply *, QAuthenticator *);
   109     void slotAuthenticationRequired(QNetworkReply *, QAuthenticator *);
   118     void slotProxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *);
   110     void slotProxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *);
   119     
   111     
   120 private slots:
   112 private slots:
   121     void setElementType(wrtBrowserDefs::BrowserElementType& aElType);
       
   122     void pageSecureState(int);
   113     void pageSecureState(int);
   123     void pageZoomMetaDataChange(QWebFrame*, ZoomMetaData);
       
   124 
   114 
   125 private:
   115 private:
   126     WrtBrowserContainerPrivate* d;
   116     WrtBrowserContainerPrivate* d;
   127     wrtBrowserDefs::BrowserElementType m_elementType;
       
   128 };
   117 };
   129 
   118 
   130 }
   119 }
   131 #endif
   120 #endif