summaryrefslogtreecommitdiffstats
path: root/lib/qwebcontentsview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/qwebcontentsview.cpp')
-rw-r--r--lib/qwebcontentsview.cpp25
1 files changed, 18 insertions, 7 deletions
diff --git a/lib/qwebcontentsview.cpp b/lib/qwebcontentsview.cpp
index 061d518cd..323bb3b60 100644
--- a/lib/qwebcontentsview.cpp
+++ b/lib/qwebcontentsview.cpp
@@ -40,6 +40,7 @@
****************************************************************************/
#include "qwebcontentsview.h"
+#include "qwebcontentsview_p.h"
// Needed to get access to content::GetContentClient()
#define CONTENT_IMPLEMENTATION
@@ -55,16 +56,10 @@
#include <QVBoxLayout>
#include <QUrl>
-class QWebContentsViewPrivate
-{
-public:
- scoped_refptr<WebEngineContext> context;
- scoped_ptr<WebContentsDelegateQt> webContentsDelegate;
-};
QWebContentsView::QWebContentsView()
{
- d.reset(new QWebContentsViewPrivate);
+ d.reset(new QWebContentsViewPrivate(this));
// This has to be the first thing we do.
d->context = WebEngineContext::current();
@@ -74,6 +69,11 @@ QWebContentsView::QWebContentsView()
layout->setContentsMargins(0, 0, 0, 0);
setLayout(layout);
+ WebContentsDelegateQt* delegate = d->webContentsDelegate.get();
+ connect(delegate, SIGNAL(titleChanged(const QString&)), this, SIGNAL(titleChanged(const QString&)));
+ connect(delegate, SIGNAL(urlChanged(const QUrl&)), this, SIGNAL(urlChanged(const QUrl&)));
+ connect(delegate, SIGNAL(loadingStateChanged()), d.data(), SLOT(loadingStateChanged()));
+
WebContentsViewQt* content_view = static_cast<WebContentsViewQt*>(d->webContentsDelegate->web_contents()->GetView());
layout->addLayout(content_view->windowContainer()->widget());
}
@@ -112,3 +112,14 @@ void QWebContentsView::reload()
d->webContentsDelegate->web_contents()->GetController().Reload(false);
d->webContentsDelegate->web_contents()->GetView()->Focus();
}
+
+void QWebContentsView::stop()
+{
+ content::NavigationController& controller = d->webContentsDelegate->web_contents()->GetController();
+
+ int index = controller.GetPendingEntryIndex();
+ if (index != -1)
+ controller.RemoveEntryAtIndex(index);
+
+ d->webContentsDelegate->web_contents()->GetView()->Focus();
+}