Title: [111178] trunk/Source/WebKit2
Revision
111178
Author
[email protected]
Date
2012-03-19 07:42:17 -0700 (Mon, 19 Mar 2012)

Log Message

[Qt] Add experimental API for dynamically changing the UA string

Reviewed by Simon Hausmann.

This patch adds a new property named userAgent to the
QQuickWebViewExperimental type which allows us to dynamically change
the user agent string from the QML API.

* UIProcess/API/qt/qquickwebview.cpp:
(QQuickWebViewExperimental::userAgent):
(QQuickWebViewExperimental::setUserAgent):
* UIProcess/API/qt/qquickwebview_p.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (111177 => 111178)


--- trunk/Source/WebKit2/ChangeLog	2012-03-19 14:41:52 UTC (rev 111177)
+++ trunk/Source/WebKit2/ChangeLog	2012-03-19 14:42:17 UTC (rev 111178)
@@ -1,3 +1,18 @@
+2012-03-19  Alexander Færøy  <[email protected]>
+
+        [Qt] Add experimental API for dynamically changing the UA string
+
+        Reviewed by Simon Hausmann.
+
+        This patch adds a new property named userAgent to the
+        QQuickWebViewExperimental type which allows us to dynamically change
+        the user agent string from the QML API.
+
+        * UIProcess/API/qt/qquickwebview.cpp:
+        (QQuickWebViewExperimental::userAgent):
+        (QQuickWebViewExperimental::setUserAgent):
+        * UIProcess/API/qt/qquickwebview_p.h:
+
 2012-03-18  No'am Rosenthal  <[email protected]>
 
         [Qt][WK2] Avoid usage of manual scaling in the Qt scenegraph integration

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp (111177 => 111178)


--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp	2012-03-19 14:41:52 UTC (rev 111177)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp	2012-03-19 14:42:17 UTC (rev 111178)
@@ -961,6 +961,22 @@
     emit filePickerChanged();
 }
 
+QString QQuickWebViewExperimental::userAgent() const
+{
+    Q_D(const QQuickWebView);
+    return d->webPageProxy->userAgent();
+}
+
+void QQuickWebViewExperimental::setUserAgent(const QString& userAgent)
+{
+    Q_D(QQuickWebView);
+    if (userAgent == QString(d->webPageProxy->userAgent()))
+        return;
+
+    d->webPageProxy->setUserAgent(userAgent);
+    emit userAgentChanged();
+}
+
 QQuickUrlSchemeDelegate* QQuickWebViewExperimental::schemeDelegates_At(QDeclarativeListProperty<QQuickUrlSchemeDelegate>* property, int index)
 {
     const QObjectList children = property->object->children();

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h (111177 => 111178)


--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h	2012-03-19 14:41:52 UTC (rev 111177)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h	2012-03-19 14:42:17 UTC (rev 111178)
@@ -252,6 +252,7 @@
     Q_PROPERTY(QWebPreferences* preferences READ preferences CONSTANT FINAL)
     Q_PROPERTY(QWebViewportInfo* viewportInfo READ viewportInfo CONSTANT FINAL)
     Q_PROPERTY(QDeclarativeListProperty<QQuickUrlSchemeDelegate> urlSchemeDelegates READ schemeDelegates)
+    Q_PROPERTY(QString userAgent READ userAgent WRITE setUserAgent NOTIFY userAgentChanged)
     Q_ENUMS(NavigationRequestActionExperimental)
 
 public:
@@ -278,6 +279,8 @@
     void setProxyAuthenticationDialog(QDeclarativeComponent*);
     QDeclarativeComponent* filePicker() const;
     void setFilePicker(QDeclarativeComponent*);
+    QString userAgent() const;
+    void setUserAgent(const QString& userAgent);
 
     QWebViewportInfo* viewportInfo();
 
@@ -335,6 +338,7 @@
     void permissionRequested(QWebPermissionRequest* permission);
     void messageReceived(const QVariantMap& message);
     void proxyAuthenticationDialogChanged();
+    void userAgentChanged();
 
 private:
     QQuickWebView* q_ptr;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to