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 4003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4014 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>(render_view_host); | 4014 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>(render_view_host); |
4015 RenderFrameHostImpl* rfhi = | 4015 RenderFrameHostImpl* rfhi = |
4016 static_cast<RenderFrameHostImpl*>(rvhi->GetMainFrame()); | 4016 static_cast<RenderFrameHostImpl*>(rvhi->GetMainFrame()); |
4017 | 4017 |
4018 // Ignore renderer unresponsive event if debugger is attached to the tab | 4018 // Ignore renderer unresponsive event if debugger is attached to the tab |
4019 // since the event may be a result of the renderer sitting on a breakpoint. | 4019 // since the event may be a result of the renderer sitting on a breakpoint. |
4020 // See http://crbug.com/65458 | 4020 // See http://crbug.com/65458 |
4021 if (DevToolsAgentHost::IsDebuggerAttached(this)) | 4021 if (DevToolsAgentHost::IsDebuggerAttached(this)) |
4022 return; | 4022 return; |
4023 | 4023 |
4024 if (rfhi->is_waiting_for_beforeunload_ack() || | 4024 if (rfhi->IsWaitingForBeforeUnloadACK() || |
4025 rfhi->IsWaitingForUnloadACK()) { | 4025 rfhi->IsWaitingForUnloadACK()) { |
4026 // Hang occurred while firing the beforeunload/unload handler. | 4026 // Hang occurred while firing the beforeunload/unload handler. |
4027 // Pretend the handler fired so tab closing continues as if it had. | 4027 // Pretend the handler fired so tab closing continues as if it had. |
4028 rvhi->set_sudden_termination_allowed(true); | 4028 rvhi->set_sudden_termination_allowed(true); |
4029 | 4029 |
4030 if (!GetRenderManager()->ShouldCloseTabOnUnresponsiveRenderer()) | 4030 if (!GetRenderManager()->ShouldCloseTabOnUnresponsiveRenderer()) |
4031 return; | 4031 return; |
4032 | 4032 |
4033 // If the tab hangs in the beforeunload/unload handler there's really | 4033 // If the tab hangs in the beforeunload/unload handler there's really |
4034 // nothing we can do to recover. If the hang is in the beforeunload handler, | 4034 // nothing we can do to recover. If the hang is in the beforeunload handler, |
4035 // pretend the beforeunload listeners have all fired and allow the delegate | 4035 // pretend the beforeunload listeners have all fired and allow the delegate |
4036 // to continue closing; the user will not have the option of cancelling the | 4036 // to continue closing; the user will not have the option of cancelling the |
4037 // close. Otherwise, pretend the unload listeners have all fired and close | 4037 // close. Otherwise, pretend the unload listeners have all fired and close |
4038 // the tab. | 4038 // the tab. |
4039 bool close = true; | 4039 bool close = true; |
4040 if (rfhi->is_waiting_for_beforeunload_ack() && delegate_) { | 4040 if (rfhi->IsWaitingForBeforeUnloadACK() && delegate_) { |
4041 delegate_->BeforeUnloadFired(this, true, &close); | 4041 delegate_->BeforeUnloadFired(this, true, &close); |
4042 } | 4042 } |
4043 if (close) | 4043 if (close) |
4044 Close(rvhi); | 4044 Close(rvhi); |
4045 return; | 4045 return; |
4046 } | 4046 } |
4047 | 4047 |
4048 if (!GetRenderViewHostImpl() || !GetRenderViewHostImpl()->IsRenderViewLive()) | 4048 if (!GetRenderViewHostImpl() || !GetRenderViewHostImpl()->IsRenderViewLive()) |
4049 return; | 4049 return; |
4050 | 4050 |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4440 node->render_manager()->ResumeResponseDeferredAtStart(); | 4440 node->render_manager()->ResumeResponseDeferredAtStart(); |
4441 } | 4441 } |
4442 | 4442 |
4443 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4443 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
4444 force_disable_overscroll_content_ = force_disable; | 4444 force_disable_overscroll_content_ = force_disable; |
4445 if (view_) | 4445 if (view_) |
4446 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4446 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
4447 } | 4447 } |
4448 | 4448 |
4449 } // namespace content | 4449 } // namespace content |
OLD | NEW |