Commit 94ae0a83 authored by Noel Gordon's avatar Noel Gordon Committed by Chromium LUCI CQ

[filesapp] Don't show JS dialogs in PDF files in Files app QuickView

Bug: 1144419
Change-Id: Ie2872cea95965d15e38dc319897d315f02f9b4b3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2635383
Commit-Queue: Noel Gordon <noel@chromium.org>
Reviewed-by: default avatarKevin McNee <mcnee@chromium.org>
Reviewed-by: default avatarK. Moon <kmoon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#845127}
parent 6fc4a19d
...@@ -51,6 +51,17 @@ void JavaScriptDialogHelper::RunJavaScriptDialog( ...@@ -51,6 +51,17 @@ void JavaScriptDialogHelper::RunJavaScriptDialog(
const base::string16& default_prompt_text, const base::string16& default_prompt_text,
DialogClosedCallback callback, DialogClosedCallback callback,
bool* did_suppress_message) { bool* did_suppress_message) {
WebViewPermissionHelper* web_view_permission_helper =
WebViewPermissionHelper::FromWebContents(web_contents);
// crbug.com/1144419: Exit if the permission helper is missing.
// TODO(mcnee) - if |web_contents| is an inner MimeHandlerView,
// this will be null. We should get the WebViewPermissionHelper
// from our WebViewGuest instead.
if (!web_view_permission_helper) {
std::move(callback).Run(false, base::string16());
return;
}
base::DictionaryValue request_info; base::DictionaryValue request_info;
request_info.SetString(webview::kDefaultPromptText, request_info.SetString(webview::kDefaultPromptText,
base::UTF16ToUTF8(default_prompt_text)); base::UTF16ToUTF8(default_prompt_text));
...@@ -60,8 +71,7 @@ void JavaScriptDialogHelper::RunJavaScriptDialog( ...@@ -60,8 +71,7 @@ void JavaScriptDialogHelper::RunJavaScriptDialog(
JavaScriptDialogTypeToString(dialog_type)); JavaScriptDialogTypeToString(dialog_type));
request_info.SetString(guest_view::kUrl, request_info.SetString(guest_view::kUrl,
render_frame_host->GetLastCommittedURL().spec()); render_frame_host->GetLastCommittedURL().spec());
WebViewPermissionHelper* web_view_permission_helper =
WebViewPermissionHelper::FromWebContents(web_contents);
web_view_permission_helper->RequestPermission( web_view_permission_helper->RequestPermission(
WEB_VIEW_PERMISSION_TYPE_JAVASCRIPT_DIALOG, request_info, WEB_VIEW_PERMISSION_TYPE_JAVASCRIPT_DIALOG, request_info,
base::BindOnce(&JavaScriptDialogHelper::OnPermissionResponse, base::BindOnce(&JavaScriptDialogHelper::OnPermissionResponse,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment