OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 3965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3976 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>(render_view_host); | 3976 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>(render_view_host); |
3977 RenderFrameHostImpl* rfhi = | 3977 RenderFrameHostImpl* rfhi = |
3978 static_cast<RenderFrameHostImpl*>(rvhi->GetMainFrame()); | 3978 static_cast<RenderFrameHostImpl*>(rvhi->GetMainFrame()); |
3979 | 3979 |
3980 // Ignore renderer unresponsive event if debugger is attached to the tab | 3980 // Ignore renderer unresponsive event if debugger is attached to the tab |
3981 // since the event may be a result of the renderer sitting on a breakpoint. | 3981 // since the event may be a result of the renderer sitting on a breakpoint. |
3982 // See http://crbug.com/65458 | 3982 // See http://crbug.com/65458 |
3983 if (DevToolsAgentHost::IsDebuggerAttached(this)) | 3983 if (DevToolsAgentHost::IsDebuggerAttached(this)) |
3984 return; | 3984 return; |
3985 | 3985 |
3986 if (rfhi->is_waiting_for_beforeunload_ack() || | 3986 if (rfhi->IsWaitingForBeforeUnloadACK() || |
3987 rfhi->IsWaitingForUnloadACK()) { | 3987 rfhi->IsWaitingForUnloadACK()) { |
3988 // Hang occurred while firing the beforeunload/unload handler. | 3988 // Hang occurred while firing the beforeunload/unload handler. |
3989 // Pretend the handler fired so tab closing continues as if it had. | 3989 // Pretend the handler fired so tab closing continues as if it had. |
3990 rvhi->set_sudden_termination_allowed(true); | 3990 rvhi->set_sudden_termination_allowed(true); |
3991 | 3991 |
3992 if (!GetRenderManager()->ShouldCloseTabOnUnresponsiveRenderer()) | 3992 if (!GetRenderManager()->ShouldCloseTabOnUnresponsiveRenderer()) |
3993 return; | 3993 return; |
3994 | 3994 |
3995 // If the tab hangs in the beforeunload/unload handler there's really | 3995 // If the tab hangs in the beforeunload/unload handler there's really |
3996 // nothing we can do to recover. If the hang is in the beforeunload handler, | 3996 // nothing we can do to recover. If the hang is in the beforeunload handler, |
3997 // pretend the beforeunload listeners have all fired and allow the delegate | 3997 // pretend the beforeunload listeners have all fired and allow the delegate |
3998 // to continue closing; the user will not have the option of cancelling the | 3998 // to continue closing; the user will not have the option of cancelling the |
3999 // close. Otherwise, pretend the unload listeners have all fired and close | 3999 // close. Otherwise, pretend the unload listeners have all fired and close |
4000 // the tab. | 4000 // the tab. |
4001 bool close = true; | 4001 bool close = true; |
4002 if (rfhi->is_waiting_for_beforeunload_ack() && delegate_) { | 4002 if (rfhi->IsWaitingForBeforeUnloadACK() && delegate_) { |
4003 delegate_->BeforeUnloadFired(this, true, &close); | 4003 delegate_->BeforeUnloadFired(this, true, &close); |
4004 } | 4004 } |
4005 if (close) | 4005 if (close) |
4006 Close(rvhi); | 4006 Close(rvhi); |
4007 return; | 4007 return; |
4008 } | 4008 } |
4009 | 4009 |
4010 if (!GetRenderViewHostImpl() || !GetRenderViewHostImpl()->IsRenderViewLive()) | 4010 if (!GetRenderViewHostImpl() || !GetRenderViewHostImpl()->IsRenderViewLive()) |
4011 return; | 4011 return; |
4012 | 4012 |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4402 node->render_manager()->ResumeResponseDeferredAtStart(); | 4402 node->render_manager()->ResumeResponseDeferredAtStart(); |
4403 } | 4403 } |
4404 | 4404 |
4405 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4405 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
4406 force_disable_overscroll_content_ = force_disable; | 4406 force_disable_overscroll_content_ = force_disable; |
4407 if (view_) | 4407 if (view_) |
4408 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4408 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
4409 } | 4409 } |
4410 | 4410 |
4411 } // namespace content | 4411 } // namespace content |
OLD | NEW |