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 4014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4025 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>(render_view_host); | 4025 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>(render_view_host); |
4026 RenderFrameHostImpl* rfhi = | 4026 RenderFrameHostImpl* rfhi = |
4027 static_cast<RenderFrameHostImpl*>(rvhi->GetMainFrame()); | 4027 static_cast<RenderFrameHostImpl*>(rvhi->GetMainFrame()); |
4028 | 4028 |
4029 // Ignore renderer unresponsive event if debugger is attached to the tab | 4029 // Ignore renderer unresponsive event if debugger is attached to the tab |
4030 // since the event may be a result of the renderer sitting on a breakpoint. | 4030 // since the event may be a result of the renderer sitting on a breakpoint. |
4031 // See http://crbug.com/65458 | 4031 // See http://crbug.com/65458 |
4032 if (DevToolsAgentHost::IsDebuggerAttached(this)) | 4032 if (DevToolsAgentHost::IsDebuggerAttached(this)) |
4033 return; | 4033 return; |
4034 | 4034 |
4035 if (rfhi->is_waiting_for_beforeunload_ack() || | 4035 if (rfhi->IsWaitingForBeforeUnloadACK() || |
4036 rfhi->IsWaitingForUnloadACK()) { | 4036 rfhi->IsWaitingForUnloadACK()) { |
4037 // Hang occurred while firing the beforeunload/unload handler. | 4037 // Hang occurred while firing the beforeunload/unload handler. |
4038 // Pretend the handler fired so tab closing continues as if it had. | 4038 // Pretend the handler fired so tab closing continues as if it had. |
4039 rvhi->set_sudden_termination_allowed(true); | 4039 rvhi->set_sudden_termination_allowed(true); |
4040 | 4040 |
4041 if (!GetRenderManager()->ShouldCloseTabOnUnresponsiveRenderer()) | 4041 if (!GetRenderManager()->ShouldCloseTabOnUnresponsiveRenderer()) |
4042 return; | 4042 return; |
4043 | 4043 |
4044 // If the tab hangs in the beforeunload/unload handler there's really | 4044 // If the tab hangs in the beforeunload/unload handler there's really |
4045 // nothing we can do to recover. If the hang is in the beforeunload handler, | 4045 // nothing we can do to recover. If the hang is in the beforeunload handler, |
4046 // pretend the beforeunload listeners have all fired and allow the delegate | 4046 // pretend the beforeunload listeners have all fired and allow the delegate |
4047 // to continue closing; the user will not have the option of cancelling the | 4047 // to continue closing; the user will not have the option of cancelling the |
4048 // close. Otherwise, pretend the unload listeners have all fired and close | 4048 // close. Otherwise, pretend the unload listeners have all fired and close |
4049 // the tab. | 4049 // the tab. |
4050 bool close = true; | 4050 bool close = true; |
4051 if (rfhi->is_waiting_for_beforeunload_ack() && delegate_) { | 4051 if (rfhi->IsWaitingForBeforeUnloadACK() && delegate_) { |
4052 delegate_->BeforeUnloadFired(this, true, &close); | 4052 delegate_->BeforeUnloadFired(this, true, &close); |
4053 } | 4053 } |
4054 if (close) | 4054 if (close) |
4055 Close(rvhi); | 4055 Close(rvhi); |
4056 return; | 4056 return; |
4057 } | 4057 } |
4058 | 4058 |
4059 if (!GetRenderViewHostImpl() || !GetRenderViewHostImpl()->IsRenderViewLive()) | 4059 if (!GetRenderViewHostImpl() || !GetRenderViewHostImpl()->IsRenderViewLive()) |
4060 return; | 4060 return; |
4061 | 4061 |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4451 node->render_manager()->ResumeResponseDeferredAtStart(); | 4451 node->render_manager()->ResumeResponseDeferredAtStart(); |
4452 } | 4452 } |
4453 | 4453 |
4454 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4454 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
4455 force_disable_overscroll_content_ = force_disable; | 4455 force_disable_overscroll_content_ = force_disable; |
4456 if (view_) | 4456 if (view_) |
4457 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4457 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
4458 } | 4458 } |
4459 | 4459 |
4460 } // namespace content | 4460 } // namespace content |
OLD | NEW |