diff options
author | Michal Klocek <michal.klocek@theqtcompany.com> | 2016-06-13 13:29:51 +0200 |
---|---|---|
committer | Kai Koehne <kai.koehne@qt.io> | 2016-08-31 09:11:47 +0000 |
commit | 3cbe59e29a2702a2c184be10845b9bdd342c24d0 (patch) | |
tree | ef3b6555857028147b9b57948a15e18626e213da /src/core | |
parent | 4f3425c0d17f5f53deba78ccf6d357c1c83529f0 (diff) |
Add dialog requests to qml api
Introduce qml APIs to support custom dialogs:
* http and proxy authentication
* javascript dialogs
* file pickers
* color pickers
* form validation messages
[ChangeLog][QtWebEngine][QML] Added ability to provide custom dialogs
for HTTP and proxy authentication, JavaScript alerts, file and color
picking, and form validation messages.
Task-number: QTBUG-51190
Change-Id: I559ca59264750feb36ba7d3dba0bf0647509306d
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/web_contents_adapter_client.h | 2 | ||||
-rw-r--r-- | src/core/web_contents_delegate_qt.cpp | 5 | ||||
-rw-r--r-- | src/core/web_contents_delegate_qt.h | 1 |
3 files changed, 5 insertions, 3 deletions
diff --git a/src/core/web_contents_adapter_client.h b/src/core/web_contents_adapter_client.h index 165d84e37..865fd55d7 100644 --- a/src/core/web_contents_adapter_client.h +++ b/src/core/web_contents_adapter_client.h @@ -227,7 +227,7 @@ public: virtual void requestFullScreenMode(const QUrl &origin, bool fullscreen) = 0; virtual bool isFullScreenMode() const = 0; virtual void javascriptDialog(QSharedPointer<JavaScriptDialogController>) = 0; - virtual void runFileChooser(FilePickerController *controller) = 0; + virtual void runFileChooser(QSharedPointer<FilePickerController>) = 0; virtual void showColorDialog(QSharedPointer<ColorChooserController>) = 0; virtual void didRunJavaScript(quint64 requestId, const QVariant& result) = 0; virtual void didFetchDocumentMarkup(quint64 requestId, const QString& result) = 0; diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index b96452093..6e7d1cddc 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -317,8 +317,9 @@ void WebContentsDelegateQt::RunFileChooser(content::WebContents *web_contents, c for (std::vector<base::string16>::const_iterator it = params.accept_types.begin(); it < params.accept_types.end(); ++it) acceptedMimeTypes.append(toQt(*it)); - FilePickerController *controller = new FilePickerController(static_cast<FilePickerController::FileChooserMode>(params.mode), web_contents, toQt(params.default_file_name.value()), acceptedMimeTypes); - m_viewClient->runFileChooser(controller); + m_filePickerController.reset(new FilePickerController(static_cast<FilePickerController::FileChooserMode>(params.mode), + web_contents, toQt(params.default_file_name.value()), acceptedMimeTypes)); + m_viewClient->runFileChooser(m_filePickerController); } bool WebContentsDelegateQt::AddMessageToConsole(content::WebContents *source, int32_t level, const base::string16 &message, int32_t line_no, const base::string16 &source_id) diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h index 9aa584369..d2459e79b 100644 --- a/src/core/web_contents_delegate_qt.h +++ b/src/core/web_contents_delegate_qt.h @@ -154,6 +154,7 @@ private: QVector<int64_t> m_loadingErrorFrameList; QScopedPointer<FaviconManager> m_faviconManager; SavePageInfo m_savePageInfo; + QSharedPointer<FilePickerController> m_filePickerController; }; } // namespace QtWebEngineCore |