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

Side by Side Diff: content/renderer/render_frame_impl.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/renderer/render_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 3609 matching lines...) Expand 10 before | Expand all | Expand 10 after
3620 bool ok = RunJavaScriptMessage(JAVASCRIPT_MESSAGE_TYPE_PROMPT, 3620 bool ok = RunJavaScriptMessage(JAVASCRIPT_MESSAGE_TYPE_PROMPT,
3621 message, 3621 message,
3622 default_value, 3622 default_value,
3623 frame_->document().url(), 3623 frame_->document().url(),
3624 &result); 3624 &result);
3625 if (ok) 3625 if (ok)
3626 actual_value->assign(result); 3626 actual_value->assign(result);
3627 return ok; 3627 return ok;
3628 } 3628 }
3629 3629
3630 bool RenderFrameImpl::runModalBeforeUnloadDialog( 3630 bool RenderFrameImpl::runModalBeforeUnloadDialog(bool is_reload) {
3631 bool is_reload,
3632 const blink::WebString& message) {
3633 // If we are swapping out, we have already run the beforeunload handler. 3631 // If we are swapping out, we have already run the beforeunload handler.
3634 // TODO(creis): Fix OnSwapOut to clear the frame without running beforeunload 3632 // TODO(creis): Fix OnSwapOut to clear the frame without running beforeunload
3635 // at all, to avoid running it twice. 3633 // at all, to avoid running it twice.
3636 if (is_swapped_out_) 3634 if (is_swapped_out_)
3637 return true; 3635 return true;
3638 3636
3639 // Don't allow further dialogs if we are waiting to swap out, since the 3637 // Don't allow further dialogs if we are waiting to swap out, since the
3640 // PageGroupLoadDeferrer in our stack prevents it. 3638 // PageGroupLoadDeferrer in our stack prevents it.
3641 if (render_view()->suppress_dialogs_until_swap_out_) 3639 if (render_view()->suppress_dialogs_until_swap_out_)
3642 return false; 3640 return false;
3643 3641
3644 bool success = false; 3642 bool success = false;
3645 // This is an ignored return value, but is included so we can accept the same 3643 // This is an ignored return value, but is included so we can accept the same
3646 // response as RunJavaScriptMessage. 3644 // response as RunJavaScriptMessage.
3647 base::string16 ignored_result; 3645 base::string16 ignored_result;
3648 render_view()->SendAndRunNestedMessageLoop( 3646 render_view()->SendAndRunNestedMessageLoop(
3649 new FrameHostMsg_RunBeforeUnloadConfirm( 3647 new FrameHostMsg_RunBeforeUnloadConfirm(
3650 routing_id_, frame_->document().url(), message, is_reload, 3648 routing_id_, frame_->document().url(), is_reload,
3651 &success, &ignored_result)); 3649 &success, &ignored_result));
3652 return success; 3650 return success;
3653 } 3651 }
3654 3652
3655 void RenderFrameImpl::showContextMenu(const blink::WebContextMenuData& data) { 3653 void RenderFrameImpl::showContextMenu(const blink::WebContextMenuData& data) {
3656 ContextMenuParams params = ContextMenuParamsBuilder::Build(data); 3654 ContextMenuParams params = ContextMenuParamsBuilder::Build(data);
3657 blink::WebRect position_in_window(params.x, params.y, 0, 0); 3655 blink::WebRect position_in_window(params.x, params.y, 0, 0);
3658 GetRenderWidget()->convertViewportToWindow(&position_in_window); 3656 GetRenderWidget()->convertViewportToWindow(&position_in_window);
3659 params.x = position_in_window.x; 3657 params.x = position_in_window.x;
3660 params.y = position_in_window.y; 3658 params.y = position_in_window.y;
(...skipping 2471 matching lines...) Expand 10 before | Expand all | Expand 10 after
6132 int match_count, 6130 int match_count,
6133 int ordinal, 6131 int ordinal,
6134 const WebRect& selection_rect, 6132 const WebRect& selection_rect,
6135 bool final_status_update) { 6133 bool final_status_update) {
6136 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, 6134 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count,
6137 selection_rect, ordinal, 6135 selection_rect, ordinal,
6138 final_status_update)); 6136 final_status_update));
6139 } 6137 }
6140 6138
6141 } // namespace content 6139 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/shell/browser/layout_test/layout_test_javascript_dialog_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698