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

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 2684093002: Rename JavaScript "messages" to "dialogs". (Closed)
Patch Set: win fox Created 3 years, 10 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/browser/frame_host/render_frame_host_impl.h" 5 #include "content/browser/frame_host/render_frame_host_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 OnDocumentOnLoadCompleted) 715 OnDocumentOnLoadCompleted)
716 IPC_MESSAGE_HANDLER(FrameHostMsg_BeforeUnload_ACK, OnBeforeUnloadACK) 716 IPC_MESSAGE_HANDLER(FrameHostMsg_BeforeUnload_ACK, OnBeforeUnloadACK)
717 IPC_MESSAGE_HANDLER(FrameHostMsg_SwapOut_ACK, OnSwapOutACK) 717 IPC_MESSAGE_HANDLER(FrameHostMsg_SwapOut_ACK, OnSwapOutACK)
718 IPC_MESSAGE_HANDLER(FrameHostMsg_ContextMenu, OnContextMenu) 718 IPC_MESSAGE_HANDLER(FrameHostMsg_ContextMenu, OnContextMenu)
719 IPC_MESSAGE_HANDLER(FrameHostMsg_JavaScriptExecuteResponse, 719 IPC_MESSAGE_HANDLER(FrameHostMsg_JavaScriptExecuteResponse,
720 OnJavaScriptExecuteResponse) 720 OnJavaScriptExecuteResponse)
721 IPC_MESSAGE_HANDLER(FrameHostMsg_VisualStateResponse, 721 IPC_MESSAGE_HANDLER(FrameHostMsg_VisualStateResponse,
722 OnVisualStateResponse) 722 OnVisualStateResponse)
723 IPC_MESSAGE_HANDLER(FrameHostMsg_SmartClipDataExtracted, 723 IPC_MESSAGE_HANDLER(FrameHostMsg_SmartClipDataExtracted,
724 OnSmartClipDataExtracted) 724 OnSmartClipDataExtracted)
725 IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunJavaScriptMessage, 725 IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunJavaScriptDialog,
726 OnRunJavaScriptMessage) 726 OnRunJavaScriptDialog)
727 IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunBeforeUnloadConfirm, 727 IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunBeforeUnloadConfirm,
728 OnRunBeforeUnloadConfirm) 728 OnRunBeforeUnloadConfirm)
729 IPC_MESSAGE_HANDLER(FrameHostMsg_RunFileChooser, OnRunFileChooser) 729 IPC_MESSAGE_HANDLER(FrameHostMsg_RunFileChooser, OnRunFileChooser)
730 IPC_MESSAGE_HANDLER(FrameHostMsg_DidAccessInitialDocument, 730 IPC_MESSAGE_HANDLER(FrameHostMsg_DidAccessInitialDocument,
731 OnDidAccessInitialDocument) 731 OnDidAccessInitialDocument)
732 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeOpener, OnDidChangeOpener) 732 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeOpener, OnDidChangeOpener)
733 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeName, OnDidChangeName) 733 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeName, OnDidChangeName)
734 IPC_MESSAGE_HANDLER(FrameHostMsg_DidSetFeaturePolicyHeader, 734 IPC_MESSAGE_HANDLER(FrameHostMsg_DidSetFeaturePolicyHeader,
735 OnDidSetFeaturePolicyHeader) 735 OnDidSetFeaturePolicyHeader)
736 IPC_MESSAGE_HANDLER(FrameHostMsg_DidAddContentSecurityPolicy, 736 IPC_MESSAGE_HANDLER(FrameHostMsg_DidAddContentSecurityPolicy,
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after
1681 void RenderFrameHostImpl::OnVisualStateResponse(uint64_t id) { 1681 void RenderFrameHostImpl::OnVisualStateResponse(uint64_t id) {
1682 auto it = visual_state_callbacks_.find(id); 1682 auto it = visual_state_callbacks_.find(id);
1683 if (it != visual_state_callbacks_.end()) { 1683 if (it != visual_state_callbacks_.end()) {
1684 it->second.Run(true); 1684 it->second.Run(true);
1685 visual_state_callbacks_.erase(it); 1685 visual_state_callbacks_.erase(it);
1686 } else { 1686 } else {
1687 NOTREACHED() << "Received script response for unknown request"; 1687 NOTREACHED() << "Received script response for unknown request";
1688 } 1688 }
1689 } 1689 }
1690 1690
1691 void RenderFrameHostImpl::OnRunJavaScriptMessage( 1691 void RenderFrameHostImpl::OnRunJavaScriptDialog(
1692 const base::string16& message, 1692 const base::string16& message,
1693 const base::string16& default_prompt, 1693 const base::string16& default_prompt,
1694 const GURL& frame_url, 1694 const GURL& frame_url,
1695 JavaScriptMessageType type, 1695 JavaScriptDialogType dialog_type,
1696 IPC::Message* reply_msg) { 1696 IPC::Message* reply_msg) {
1697 if (!is_active()) { 1697 if (!is_active()) {
1698 JavaScriptDialogClosed(reply_msg, true, base::string16(), true); 1698 JavaScriptDialogClosed(reply_msg, true, base::string16(), true);
1699 return; 1699 return;
1700 } 1700 }
1701 1701
1702 int32_t message_length = static_cast<int32_t>(message.length()); 1702 int32_t message_length = static_cast<int32_t>(message.length());
1703 if (GetParent()) { 1703 if (GetParent()) {
1704 UMA_HISTOGRAM_COUNTS("JSDialogs.CharacterCount.Subframe", message_length); 1704 UMA_HISTOGRAM_COUNTS("JSDialogs.CharacterCount.Subframe", message_length);
1705 } else { 1705 } else {
1706 UMA_HISTOGRAM_COUNTS("JSDialogs.CharacterCount.MainFrame", message_length); 1706 UMA_HISTOGRAM_COUNTS("JSDialogs.CharacterCount.MainFrame", message_length);
1707 } 1707 }
1708 1708
1709 // While a JS message dialog is showing, tabs in the same process shouldn't 1709 // While a JS message dialog is showing, tabs in the same process shouldn't
1710 // process input events. 1710 // process input events.
1711 GetProcess()->SetIgnoreInputEvents(true); 1711 GetProcess()->SetIgnoreInputEvents(true);
1712 render_view_host_->GetWidget()->StopHangMonitorTimeout(); 1712 render_view_host_->GetWidget()->StopHangMonitorTimeout();
1713 delegate_->RunJavaScriptMessage(this, message, default_prompt, 1713 delegate_->RunJavaScriptDialog(this, message, default_prompt, frame_url,
1714 frame_url, type, reply_msg); 1714 dialog_type, reply_msg);
1715 } 1715 }
1716 1716
1717 void RenderFrameHostImpl::OnRunBeforeUnloadConfirm( 1717 void RenderFrameHostImpl::OnRunBeforeUnloadConfirm(
1718 const GURL& frame_url, 1718 const GURL& frame_url,
1719 bool is_reload, 1719 bool is_reload,
1720 IPC::Message* reply_msg) { 1720 IPC::Message* reply_msg) {
1721 // While a JS beforeunload dialog is showing, tabs in the same process 1721 // While a JS beforeunload dialog is showing, tabs in the same process
1722 // shouldn't process input events. 1722 // shouldn't process input events.
1723 GetProcess()->SetIgnoreInputEvents(true); 1723 GetProcess()->SetIgnoreInputEvents(true);
1724 render_view_host_->GetWidget()->StopHangMonitorTimeout(); 1724 render_view_host_->GetWidget()->StopHangMonitorTimeout();
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after
2673 ? RendererUnresponsiveType::RENDERER_UNRESPONSIVE_BEFORE_UNLOAD 2673 ? RendererUnresponsiveType::RENDERER_UNRESPONSIVE_BEFORE_UNLOAD
2674 : RendererUnresponsiveType::RENDERER_UNRESPONSIVE_UNLOAD; 2674 : RendererUnresponsiveType::RENDERER_UNRESPONSIVE_UNLOAD;
2675 } 2675 }
2676 render_view_host_->GetWidget()->StartHangMonitorTimeout( 2676 render_view_host_->GetWidget()->StartHangMonitorTimeout(
2677 success 2677 success
2678 ? TimeDelta::FromMilliseconds(RenderViewHostImpl::kUnloadTimeoutMS) 2678 ? TimeDelta::FromMilliseconds(RenderViewHostImpl::kUnloadTimeoutMS)
2679 : render_view_host_->GetWidget()->hung_renderer_delay(), 2679 : render_view_host_->GetWidget()->hung_renderer_delay(),
2680 blink::WebInputEvent::Undefined, type); 2680 blink::WebInputEvent::Undefined, type);
2681 } 2681 }
2682 2682
2683 FrameHostMsg_RunJavaScriptMessage::WriteReplyParams(reply_msg, 2683 FrameHostMsg_RunJavaScriptDialog::WriteReplyParams(reply_msg, success,
2684 success, user_input); 2684 user_input);
2685 Send(reply_msg); 2685 Send(reply_msg);
2686 2686
2687 // If we are waiting for an unload or beforeunload ack and the user has 2687 // If we are waiting for an unload or beforeunload ack and the user has
2688 // suppressed messages, kill the tab immediately; a page that's spamming 2688 // suppressed messages, kill the tab immediately; a page that's spamming
2689 // alerts in onbeforeunload is presumably malicious, so there's no point in 2689 // alerts in onbeforeunload is presumably malicious, so there's no point in
2690 // continuing to run its script and dragging out the process. 2690 // continuing to run its script and dragging out the process.
2691 // This must be done after sending the reply since RenderView can't close 2691 // This must be done after sending the reply since RenderView can't close
2692 // correctly while waiting for a response. 2692 // correctly while waiting for a response.
2693 if (is_waiting && dialog_was_suppressed) { 2693 if (is_waiting && dialog_was_suppressed) {
2694 render_view_host_->GetWidget()->delegate()->RendererUnresponsive( 2694 render_view_host_->GetWidget()->delegate()->RendererUnresponsive(
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after
3480 // There is no pending NavigationEntry in these cases, so pass 0 as the 3480 // There is no pending NavigationEntry in these cases, so pass 0 as the
3481 // pending_nav_entry_id. If the previous handle was a prematurely aborted 3481 // pending_nav_entry_id. If the previous handle was a prematurely aborted
3482 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. 3482 // navigation loaded via LoadDataWithBaseURL, propagate the entry id.
3483 return NavigationHandleImpl::Create( 3483 return NavigationHandleImpl::Create(
3484 params.url, params.redirects, frame_tree_node_, is_renderer_initiated, 3484 params.url, params.redirects, frame_tree_node_, is_renderer_initiated,
3485 params.was_within_same_page, base::TimeTicks::Now(), 3485 params.was_within_same_page, base::TimeTicks::Now(),
3486 entry_id_for_data_nav, false); // started_from_context_menu 3486 entry_id_for_data_nav, false); // started_from_context_menu
3487 } 3487 }
3488 3488
3489 } // namespace content 3489 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.h ('k') | content/browser/frame_host/render_frame_host_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698