summaryrefslogtreecommitdiffstats
path: root/src/webview/qwebviewinterface_p.h
diff options
context:
space:
mode:
authorChristian Strømme <christian.stromme@theqtcompany.com>2015-01-16 11:04:58 +0100
committerChristian Stromme <christian.stromme@theqtcompany.com>2015-02-09 16:35:06 +0000
commit56da39587414f127774e1b5e9f88a84f8f27db08 (patch)
tree5d7bcc9e60df41ca8c70b3ae1ad1adeff4bc5669 /src/webview/qwebviewinterface_p.h
parentea443a6960316d5070c1a3a5dbe21037a96ff7e4 (diff)
Refactor QWebView code.
In an attempt to make the code more future proof, this patch tries to improve the abstraction between the native WebViews/View controllers and the public APIs. This should make it easier to add new platforms and alternative public interfaces, e.g., a Window/Widget API. It should also make it easier to implement a plugin system if needed. In addition the following changes were done: - reload() implementation in the android controller. - reload() calls the native reload function on both Android and iOS. - loadProgress() calls the native getProgress() directly on Android. - isLoading() calls loading() on the UIWebView (iOS) - runJavaScript() will now only pass the script and an id to the platform implementation to avoid creating a strong coupling to QJSValue. Change-Id: I3cbd81c7fd8d93bacf9134be32ad061d1f9e1183 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Diffstat (limited to 'src/webview/qwebviewinterface_p.h')
-rw-r--r--src/webview/qwebviewinterface_p.h81
1 files changed, 81 insertions, 0 deletions
diff --git a/src/webview/qwebviewinterface_p.h b/src/webview/qwebviewinterface_p.h
new file mode 100644
index 0000000..86d370c
--- /dev/null
+++ b/src/webview/qwebviewinterface_p.h
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtWebView module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWEBVIEWINTERFACE_H
+#define QWEBVIEWINTERFACE_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtWebView/qwebview_global.h>
+
+#include <QtCore/qobject.h>
+#include <QtCore/qurl.h>
+#include <QtGui/qimage.h>
+
+
+QT_BEGIN_NAMESPACE
+
+class QJSValue;
+
+class QWebViewInterface
+{
+public:
+ virtual ~QWebViewInterface() {}
+ virtual QUrl url() const = 0;
+ virtual void setUrl(const QUrl &url) = 0;
+ virtual bool canGoBack() const = 0;
+ virtual bool canGoForward() const = 0;
+ virtual QString title() const = 0;
+ virtual int loadProgress() const = 0;
+ virtual bool isLoading() const = 0;
+
+ // Q_SLOTS
+ virtual void goBack() = 0;
+ virtual void goForward() = 0;
+ virtual void stop() = 0;
+ virtual void reload() = 0;
+};
+
+#endif // QWEBVIEWINTERFACE_H