Index: android_webview/native/aw_web_contents_delegate.cc |
diff --git a/android_webview/native/aw_web_contents_delegate.cc b/android_webview/native/aw_web_contents_delegate.cc |
index 8026a6fcb087467fa9572ea0525f7fefd8187e84..c825f63b22e85ebfce19bf6a0aa0766bcc7531e4 100644 |
--- a/android_webview/native/aw_web_contents_delegate.cc |
+++ b/android_webview/native/aw_web_contents_delegate.cc |
@@ -20,6 +20,7 @@ |
#include "base/strings/string_util.h" |
#include "base/strings/utf_string_conversions.h" |
#include "base/threading/thread_task_runner_handle.h" |
+#include "content/public/browser/render_frame_host.h" |
#include "content/public/browser/render_process_host.h" |
#include "content/public/browser/render_view_host.h" |
#include "content/public/browser/render_widget_host.h" |
@@ -91,8 +92,9 @@ void AwWebContentsDelegate::CanDownload( |
callback.Run(false); |
} |
-void AwWebContentsDelegate::RunFileChooser(WebContents* web_contents, |
- const FileChooserParams& params) { |
+void AwWebContentsDelegate::RunFileChooser( |
+ content::RenderFrameHost* render_frame_host, |
+ const FileChooserParams& params) { |
JNIEnv* env = AttachCurrentThread(); |
ScopedJavaLocalRef<jobject> java_delegate = GetJavaDelegate(env); |
if (!java_delegate.obj()) |
@@ -106,24 +108,24 @@ void AwWebContentsDelegate::RunFileChooser(WebContents* web_contents, |
mode_flags |= kFileChooserModeOpenMultiple | kFileChooserModeOpenFolder; |
} else if (params.mode == FileChooserParams::Save) { |
// Save not supported, so cancel it. |
- web_contents->GetRenderViewHost()->FilesSelectedInChooser( |
- std::vector<content::FileChooserFileInfo>(), |
- params.mode); |
+ render_frame_host->FilesSelectedInChooser( |
+ std::vector<content::FileChooserFileInfo>(), params.mode); |
return; |
} else { |
DCHECK_EQ(FileChooserParams::Open, params.mode); |
} |
- Java_AwWebContentsDelegate_runFileChooser(env, |
- java_delegate.obj(), |
- web_contents->GetRenderProcessHost()->GetID(), |
- web_contents->GetRenderViewHost()->GetRoutingID(), |
- mode_flags, |
- ConvertUTF16ToJavaString(env, |
- base::JoinString(params.accept_types, base::ASCIIToUTF16(","))).obj(), |
- params.title.empty() ? NULL : |
- ConvertUTF16ToJavaString(env, params.title).obj(), |
- params.default_file_name.empty() ? NULL : |
- ConvertUTF8ToJavaString(env, params.default_file_name.value()).obj(), |
+ Java_AwWebContentsDelegate_runFileChooser( |
+ env, java_delegate.obj(), render_frame_host->GetProcess()->GetID(), |
+ render_frame_host->GetRoutingID(), mode_flags, |
+ ConvertUTF16ToJavaString( |
+ env, base::JoinString(params.accept_types, base::ASCIIToUTF16(","))) |
+ .obj(), |
+ params.title.empty() ? NULL |
+ : ConvertUTF16ToJavaString(env, params.title).obj(), |
+ params.default_file_name.empty() |
+ ? NULL |
+ : ConvertUTF8ToJavaString(env, params.default_file_name.value()) |
+ .obj(), |
params.capture); |
} |
@@ -271,9 +273,9 @@ static void FilesSelectedInChooser( |
jint mode_flags, |
const JavaParamRef<jobjectArray>& file_paths, |
const JavaParamRef<jobjectArray>& display_names) { |
- content::RenderViewHost* rvh = content::RenderViewHost::FromID(process_id, |
- render_id); |
- if (!rvh) |
+ content::RenderFrameHost* rfh = |
+ content::RenderFrameHost::FromID(process_id, render_id); |
+ if (!rfh) |
return; |
std::vector<std::string> file_path_str; |
@@ -310,7 +312,7 @@ static void FilesSelectedInChooser( |
} |
DVLOG(0) << "File Chooser result: mode = " << mode |
<< ", file paths = " << base::JoinString(file_path_str, ":"); |
- rvh->FilesSelectedInChooser(files, mode); |
+ rfh->FilesSelectedInChooser(files, mode); |
} |
bool RegisterAwWebContentsDelegate(JNIEnv* env) { |