Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Side by Side Diff: extensions/browser/guest_view/web_view/javascript_dialog_helper.cc

Issue 1714573002: Remove the ability of webpages to specify strings for the onbeforeunload dialog. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase again Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "extensions/browser/guest_view/web_view/javascript_dialog_helper.h" 5 #include "extensions/browser/guest_view/web_view/javascript_dialog_helper.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "components/guest_view/common/guest_view_constants.h" 9 #include "components/guest_view/common/guest_view_constants.h"
10 #include "extensions/browser/guest_view/web_view/web_view_constants.h" 10 #include "extensions/browser/guest_view/web_view/web_view_constants.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 WEB_VIEW_PERMISSION_TYPE_JAVASCRIPT_DIALOG, 65 WEB_VIEW_PERMISSION_TYPE_JAVASCRIPT_DIALOG,
66 request_info, 66 request_info,
67 base::Bind(&JavaScriptDialogHelper::OnPermissionResponse, 67 base::Bind(&JavaScriptDialogHelper::OnPermissionResponse,
68 base::Unretained(this), 68 base::Unretained(this),
69 callback), 69 callback),
70 false /* allowed_by_default */); 70 false /* allowed_by_default */);
71 } 71 }
72 72
73 void JavaScriptDialogHelper::RunBeforeUnloadDialog( 73 void JavaScriptDialogHelper::RunBeforeUnloadDialog(
74 content::WebContents* web_contents, 74 content::WebContents* web_contents,
75 const base::string16& message_text,
76 bool is_reload, 75 bool is_reload,
77 const DialogClosedCallback& callback) { 76 const DialogClosedCallback& callback) {
78 // This is called if the guest has a beforeunload event handler. 77 // This is called if the guest has a beforeunload event handler.
79 // This callback allows navigation to proceed. 78 // This callback allows navigation to proceed.
80 callback.Run(true, base::string16()); 79 callback.Run(true, base::string16());
81 } 80 }
82 81
83 bool JavaScriptDialogHelper::HandleJavaScriptDialog( 82 bool JavaScriptDialogHelper::HandleJavaScriptDialog(
84 content::WebContents* web_contents, 83 content::WebContents* web_contents,
85 bool accept, 84 bool accept,
(...skipping 11 matching lines...) Expand all
97 96
98 void JavaScriptDialogHelper::OnPermissionResponse( 97 void JavaScriptDialogHelper::OnPermissionResponse(
99 const DialogClosedCallback& callback, 98 const DialogClosedCallback& callback,
100 bool allow, 99 bool allow,
101 const std::string& user_input) { 100 const std::string& user_input) {
102 callback.Run(allow && web_view_guest_->attached(), 101 callback.Run(allow && web_view_guest_->attached(),
103 base::UTF8ToUTF16(user_input)); 102 base::UTF8ToUTF16(user_input));
104 } 103 }
105 104
106 } // namespace extensions 105 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698