diff options
author | Jocelyn Turcotte <jocelyn.turcotte@digia.com> | 2014-02-05 14:01:54 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-13 12:50:43 +0100 |
commit | b81a337a63710c4f109dc537f7d4b73acc282596 (patch) | |
tree | 204dbb36ba13ab2e97df3d04f114f0b5dd58d372 /src/webengine/api/qquickwebenginenewviewrequest.cpp | |
parent | 185e8a020212756d4e7adfbcd69e16232c8d7dfd (diff) |
QQuickWebEngineView new window API refactoring
Improve the code and API in a few ways:
- Expose a more discoverable "request" argument in the signal.
- Use the request as the carrier of the backend WebContentsAdapter
and get rid of our handle.
- Put the adoption method (renamed to openIn) on the request object
and keep the view API clean of a context-specific adoptHandle method.
- Use an enum instead of strings for the new view destination.
- Do not let JavaScript own the request object since it won't be
necessary until we want to support asynchronous view attachment.
We can create the request object on the heap and let the JavaScript
engine own the object once we want to support it.
- Move the request class to its own header.
- Replace tabs.currentView by currentWebView in the quicknanobrowser
qml code since we now need this property on the root object anyway.
Change-Id: I40d7d15255f516ead9f3e414dd587bf345e6ca4b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/webengine/api/qquickwebenginenewviewrequest.cpp')
-rw-r--r-- | src/webengine/api/qquickwebenginenewviewrequest.cpp | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/src/webengine/api/qquickwebenginenewviewrequest.cpp b/src/webengine/api/qquickwebenginenewviewrequest.cpp new file mode 100644 index 000000000..8af8f5b49 --- /dev/null +++ b/src/webengine/api/qquickwebenginenewviewrequest.cpp @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtWebEngine 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 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 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 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qquickwebenginenewviewrequest_p.h" + +#include "qquickwebengineview_p_p.h" +#include "web_contents_adapter.h" + +QQuickWebEngineNewViewRequest::QQuickWebEngineNewViewRequest() +{ +} + +QQuickWebEngineNewViewRequest::~QQuickWebEngineNewViewRequest() +{ +} + +QQuickWebEngineView::NewViewDestination QQuickWebEngineNewViewRequest::destination() const +{ + return m_destination; +} + +bool QQuickWebEngineNewViewRequest::isPopup() const +{ + return m_isPopup; +} + +void QQuickWebEngineNewViewRequest::openIn(QQuickWebEngineView *view) +{ + if (view) { + view->d_func()->adoptWebContents(m_adapter.data()); + m_adapter.reset(); + } +} |