| OLD | NEW |
| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 1583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1594 if (GetParent()) { | 1594 if (GetParent()) { |
| 1595 UMA_HISTOGRAM_COUNTS("JSDialogs.CharacterCount.Subframe", message_length); | 1595 UMA_HISTOGRAM_COUNTS("JSDialogs.CharacterCount.Subframe", message_length); |
| 1596 } else { | 1596 } else { |
| 1597 UMA_HISTOGRAM_COUNTS("JSDialogs.CharacterCount.MainFrame", message_length); | 1597 UMA_HISTOGRAM_COUNTS("JSDialogs.CharacterCount.MainFrame", message_length); |
| 1598 } | 1598 } |
| 1599 | 1599 |
| 1600 // While a JS message dialog is showing, tabs in the same process shouldn't | 1600 // While a JS message dialog is showing, tabs in the same process shouldn't |
| 1601 // process input events. | 1601 // process input events. |
| 1602 GetProcess()->SetIgnoreInputEvents(true); | 1602 GetProcess()->SetIgnoreInputEvents(true); |
| 1603 render_view_host_->GetWidget()->StopHangMonitorTimeout(); | 1603 render_view_host_->GetWidget()->StopHangMonitorTimeout(); |
| 1604 render_view_host_->GetWidget()->SetHangMonitorKnownUnresponsive(true); |
| 1605 is_within_javascript_dialog_ = true; |
| 1604 delegate_->RunJavaScriptMessage(this, message, default_prompt, | 1606 delegate_->RunJavaScriptMessage(this, message, default_prompt, |
| 1605 frame_url, type, reply_msg); | 1607 frame_url, type, reply_msg); |
| 1606 } | 1608 } |
| 1607 | 1609 |
| 1608 void RenderFrameHostImpl::OnRunBeforeUnloadConfirm( | 1610 void RenderFrameHostImpl::OnRunBeforeUnloadConfirm( |
| 1609 const GURL& frame_url, | 1611 const GURL& frame_url, |
| 1610 bool is_reload, | 1612 bool is_reload, |
| 1611 IPC::Message* reply_msg) { | 1613 IPC::Message* reply_msg) { |
| 1612 // While a JS beforeunload dialog is showing, tabs in the same process | 1614 // While a JS beforeunload dialog is showing, tabs in the same process |
| 1613 // shouldn't process input events. | 1615 // shouldn't process input events. |
| 1614 GetProcess()->SetIgnoreInputEvents(true); | 1616 GetProcess()->SetIgnoreInputEvents(true); |
| 1615 render_view_host_->GetWidget()->StopHangMonitorTimeout(); | 1617 render_view_host_->GetWidget()->StopHangMonitorTimeout(); |
| 1618 render_view_host_->GetWidget()->SetHangMonitorKnownUnresponsive(true); |
| 1619 is_within_javascript_dialog_ = true; |
| 1616 delegate_->RunBeforeUnloadConfirm(this, is_reload, reply_msg); | 1620 delegate_->RunBeforeUnloadConfirm(this, is_reload, reply_msg); |
| 1617 } | 1621 } |
| 1618 | 1622 |
| 1619 void RenderFrameHostImpl::OnRunFileChooser(const FileChooserParams& params) { | 1623 void RenderFrameHostImpl::OnRunFileChooser(const FileChooserParams& params) { |
| 1620 // Do not allow messages with absolute paths in them as this can permit a | 1624 // Do not allow messages with absolute paths in them as this can permit a |
| 1621 // renderer to coerce the browser to perform I/O on a renderer controlled | 1625 // renderer to coerce the browser to perform I/O on a renderer controlled |
| 1622 // path. | 1626 // path. |
| 1623 if (params.default_file_name != params.default_file_name.BaseName()) { | 1627 if (params.default_file_name != params.default_file_name.BaseName()) { |
| 1624 bad_message::ReceivedBadMessage(GetProcess(), | 1628 bad_message::ReceivedBadMessage(GetProcess(), |
| 1625 bad_message::RFH_FILE_CHOOSER_PATH); | 1629 bad_message::RFH_FILE_CHOOSER_PATH); |
| (...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2407 size_t after) { | 2411 size_t after) { |
| 2408 Send(new InputMsg_ExtendSelectionAndDelete(routing_id_, before, after)); | 2412 Send(new InputMsg_ExtendSelectionAndDelete(routing_id_, before, after)); |
| 2409 } | 2413 } |
| 2410 | 2414 |
| 2411 void RenderFrameHostImpl::JavaScriptDialogClosed( | 2415 void RenderFrameHostImpl::JavaScriptDialogClosed( |
| 2412 IPC::Message* reply_msg, | 2416 IPC::Message* reply_msg, |
| 2413 bool success, | 2417 bool success, |
| 2414 const base::string16& user_input, | 2418 const base::string16& user_input, |
| 2415 bool dialog_was_suppressed) { | 2419 bool dialog_was_suppressed) { |
| 2416 GetProcess()->SetIgnoreInputEvents(false); | 2420 GetProcess()->SetIgnoreInputEvents(false); |
| 2421 if (is_within_javascript_dialog_) { |
| 2422 render_view_host_->GetWidget()->SetHangMonitorKnownUnresponsive(false); |
| 2423 is_within_javascript_dialog_ = false; |
| 2424 } |
| 2417 bool is_waiting = is_waiting_for_beforeunload_ack_ || IsWaitingForUnloadACK(); | 2425 bool is_waiting = is_waiting_for_beforeunload_ack_ || IsWaitingForUnloadACK(); |
| 2418 | 2426 |
| 2419 // If we are executing as part of (before)unload event handling, we don't | 2427 // If we are executing as part of (before)unload event handling, we don't |
| 2420 // want to use the regular hung_renderer_delay_ms_ if the user has agreed to | 2428 // want to use the regular hung_renderer_delay_ms_ if the user has agreed to |
| 2421 // leave the current page. In this case, use the regular timeout value used | 2429 // leave the current page. In this case, use the regular timeout value used |
| 2422 // during the (before)unload handling. | 2430 // during the (before)unload handling. |
| 2423 if (is_waiting) { | 2431 if (is_waiting) { |
| 2424 RenderWidgetHostDelegate::RendererUnresponsiveType type = | 2432 RenderWidgetHostDelegate::RendererUnresponsiveType type = |
| 2425 RenderWidgetHostDelegate::RENDERER_UNRESPONSIVE_DIALOG_CLOSED; | 2433 RenderWidgetHostDelegate::RENDERER_UNRESPONSIVE_DIALOG_CLOSED; |
| 2426 if (success) { | 2434 if (success) { |
| (...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3085 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( | 3093 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( |
| 3086 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); | 3094 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); |
| 3087 return web_bluetooth_service_.get(); | 3095 return web_bluetooth_service_.get(); |
| 3088 } | 3096 } |
| 3089 | 3097 |
| 3090 void RenderFrameHostImpl::DeleteWebBluetoothService() { | 3098 void RenderFrameHostImpl::DeleteWebBluetoothService() { |
| 3091 web_bluetooth_service_.reset(); | 3099 web_bluetooth_service_.reset(); |
| 3092 } | 3100 } |
| 3093 | 3101 |
| 3094 } // namespace content | 3102 } // namespace content |
| OLD | NEW |