summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/core/file_picker_controller.cpp17
-rw-r--r--src/core/file_picker_controller.h8
-rw-r--r--src/core/web_contents_delegate_qt.cpp2
3 files changed, 13 insertions, 14 deletions
diff --git a/src/core/file_picker_controller.cpp b/src/core/file_picker_controller.cpp
index 74b097ef6..158ff7f67 100644
--- a/src/core/file_picker_controller.cpp
+++ b/src/core/file_picker_controller.cpp
@@ -49,18 +49,18 @@
namespace QtWebEngineCore {
-FilePickerController::FilePickerController(FileChooserMode mode, content::WebContents *contents, const QString &defaultFileName, const QStringList &acceptedMimeTypes, QObject *parent)
+FilePickerController::FilePickerController(FileChooserMode mode, content::RenderFrameHost *frameHost, const QString &defaultFileName, const QStringList &acceptedMimeTypes, QObject *parent)
: QObject(parent)
, m_defaultFileName(defaultFileName)
, m_acceptedMimeTypes(acceptedMimeTypes)
- , m_contents(contents)
+ , m_frameHost(frameHost)
, m_mode(mode)
{
}
void FilePickerController::accepted(const QStringList &files)
{
- FilePickerController::filesSelectedInChooser(files, m_contents);
+ FilePickerController::filesSelectedInChooser(files, m_frameHost);
}
void FilePickerController::accepted(const QVariant &files)
@@ -76,12 +76,12 @@ void FilePickerController::accepted(const QVariant &files)
qWarning("An unhandled type '%s' was provided in FilePickerController::accepted(QVariant)", files.typeName());
}
- FilePickerController::filesSelectedInChooser(stringList, m_contents);
+ FilePickerController::filesSelectedInChooser(stringList, m_frameHost);
}
void FilePickerController::rejected()
{
- FilePickerController::filesSelectedInChooser(QStringList(), m_contents);
+ FilePickerController::filesSelectedInChooser(QStringList(), m_frameHost);
}
static QStringList listRecursively(const QDir &dir)
@@ -103,15 +103,14 @@ ASSERT_ENUMS_MATCH(FilePickerController::OpenMultiple, content::FileChooserParam
ASSERT_ENUMS_MATCH(FilePickerController::UploadFolder, content::FileChooserParams::UploadFolder)
ASSERT_ENUMS_MATCH(FilePickerController::Save, content::FileChooserParams::Save)
-void FilePickerController::filesSelectedInChooser(const QStringList &filesList, content::WebContents *contents)
+void FilePickerController::filesSelectedInChooser(const QStringList &filesList, content::RenderFrameHost *frameHost)
{
- content::RenderViewHost *rvh = contents->GetRenderViewHost();
- Q_ASSERT(rvh);
+ Q_ASSERT(frameHost);
QStringList files(filesList);
if (this->m_mode == UploadFolder && !filesList.isEmpty()
&& QFileInfo(filesList.first()).isDir()) // Enumerate the directory
files = listRecursively(QDir(filesList.first()));
- rvh->GetMainFrame()->FilesSelectedInChooser(toVector<content::FileChooserFileInfo>(files), static_cast<content::FileChooserParams::Mode>(this->m_mode));
+ frameHost->FilesSelectedInChooser(toVector<content::FileChooserFileInfo>(files), static_cast<content::FileChooserParams::Mode>(this->m_mode));
}
QStringList FilePickerController::acceptedMimeTypes() const
diff --git a/src/core/file_picker_controller.h b/src/core/file_picker_controller.h
index 14e8de42d..66f28c3fc 100644
--- a/src/core/file_picker_controller.h
+++ b/src/core/file_picker_controller.h
@@ -45,7 +45,7 @@
#include <QStringList>
namespace content {
- class WebContents;
+ class RenderFrameHost;
}
namespace QtWebEngineCore {
@@ -60,7 +60,7 @@ public:
Save
};
- FilePickerController(FileChooserMode mode, content::WebContents *contents, const QString &defaultFileName, const QStringList &acceptedMimeTypes, QObject * = 0);
+ FilePickerController(FileChooserMode mode, content::RenderFrameHost *contents, const QString &defaultFileName, const QStringList &acceptedMimeTypes, QObject * = 0);
QStringList acceptedMimeTypes() const;
QString defaultFileName() const;
FileChooserMode mode() const;
@@ -71,10 +71,10 @@ public Q_SLOTS:
void rejected();
private:
- void filesSelectedInChooser(const QStringList &filesList, content::WebContents *contents);
+ void filesSelectedInChooser(const QStringList &filesList, content::RenderFrameHost *contents);
QString m_defaultFileName;
QStringList m_acceptedMimeTypes;
- content::WebContents *m_contents;
+ content::RenderFrameHost *m_frameHost;
FileChooserMode m_mode;
};
diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp
index 87badc189..83fed35a0 100644
--- a/src/core/web_contents_delegate_qt.cpp
+++ b/src/core/web_contents_delegate_qt.cpp
@@ -327,7 +327,7 @@ void WebContentsDelegateQt::RunFileChooser(content::RenderFrameHost *frameHost,
acceptedMimeTypes.append(toQt(*it));
m_filePickerController.reset(new FilePickerController(static_cast<FilePickerController::FileChooserMode>(params.mode),
- web_contents(), toQt(params.default_file_name.value()), acceptedMimeTypes));
+ frameHost, toQt(params.default_file_name.value()), acceptedMimeTypes));
// Defer the call to not block base::MessageLoop::RunTask with modal dialogs.
QTimer::singleShot(0, [this] () {