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/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 4202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4213 void WebContentsImpl::OnUserInteraction(const blink::WebInputEvent::Type type) { | 4213 void WebContentsImpl::OnUserInteraction(const blink::WebInputEvent::Type type) { |
4214 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 4214 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
4215 DidGetUserInteraction(type)); | 4215 DidGetUserInteraction(type)); |
4216 } | 4216 } |
4217 | 4217 |
4218 void WebContentsImpl::OnIgnoredUIEvent() { | 4218 void WebContentsImpl::OnIgnoredUIEvent() { |
4219 // Notify observers. | 4219 // Notify observers. |
4220 FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidGetIgnoredUIEvent()); | 4220 FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidGetIgnoredUIEvent()); |
4221 } | 4221 } |
4222 | 4222 |
4223 void WebContentsImpl::RendererUnresponsive(RenderViewHost* render_view_host) { | 4223 void WebContentsImpl::RendererUnresponsive( |
| 4224 RenderWidgetHostImpl* render_widget_host) { |
4224 // Don't show hung renderer dialog for a swapped out RVH. | 4225 // Don't show hung renderer dialog for a swapped out RVH. |
4225 if (render_view_host != GetRenderViewHost()) | 4226 if (render_widget_host != GetRenderViewHost()->GetWidget()) |
4226 return; | 4227 return; |
4227 | 4228 |
4228 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>(render_view_host); | |
4229 RenderFrameHostImpl* rfhi = | 4229 RenderFrameHostImpl* rfhi = |
4230 static_cast<RenderFrameHostImpl*>(rvhi->GetMainFrame()); | 4230 static_cast<RenderFrameHostImpl*>(GetRenderViewHost()->GetMainFrame()); |
4231 | 4231 |
4232 // Ignore renderer unresponsive event if debugger is attached to the tab | 4232 // Ignore renderer unresponsive event if debugger is attached to the tab |
4233 // since the event may be a result of the renderer sitting on a breakpoint. | 4233 // since the event may be a result of the renderer sitting on a breakpoint. |
4234 // See http://crbug.com/65458 | 4234 // See http://crbug.com/65458 |
4235 if (DevToolsAgentHost::IsDebuggerAttached(this)) | 4235 if (DevToolsAgentHost::IsDebuggerAttached(this)) |
4236 return; | 4236 return; |
4237 | 4237 |
4238 if (rfhi->is_waiting_for_beforeunload_ack() || | 4238 if (rfhi->is_waiting_for_beforeunload_ack() || |
4239 rfhi->IsWaitingForUnloadACK()) { | 4239 rfhi->IsWaitingForUnloadACK()) { |
4240 // Hang occurred while firing the beforeunload/unload handler. | 4240 // Hang occurred while firing the beforeunload/unload handler. |
4241 // Pretend the handler fired so tab closing continues as if it had. | 4241 // Pretend the handler fired so tab closing continues as if it had. |
4242 rvhi->set_sudden_termination_allowed(true); | 4242 GetRenderViewHost()->set_sudden_termination_allowed(true); |
4243 | 4243 |
4244 if (!GetRenderManager()->ShouldCloseTabOnUnresponsiveRenderer()) | 4244 if (!GetRenderManager()->ShouldCloseTabOnUnresponsiveRenderer()) |
4245 return; | 4245 return; |
4246 | 4246 |
4247 // If the tab hangs in the beforeunload/unload handler there's really | 4247 // If the tab hangs in the beforeunload/unload handler there's really |
4248 // nothing we can do to recover. If the hang is in the beforeunload handler, | 4248 // nothing we can do to recover. If the hang is in the beforeunload handler, |
4249 // pretend the beforeunload listeners have all fired and allow the delegate | 4249 // pretend the beforeunload listeners have all fired and allow the delegate |
4250 // to continue closing; the user will not have the option of cancelling the | 4250 // to continue closing; the user will not have the option of cancelling the |
4251 // close. Otherwise, pretend the unload listeners have all fired and close | 4251 // close. Otherwise, pretend the unload listeners have all fired and close |
4252 // the tab. | 4252 // the tab. |
4253 bool close = true; | 4253 bool close = true; |
4254 if (rfhi->is_waiting_for_beforeunload_ack() && delegate_) { | 4254 if (rfhi->is_waiting_for_beforeunload_ack() && delegate_) { |
4255 delegate_->BeforeUnloadFired(this, true, &close); | 4255 delegate_->BeforeUnloadFired(this, true, &close); |
4256 } | 4256 } |
4257 if (close) | 4257 if (close) |
4258 Close(rvhi); | 4258 Close(); |
4259 return; | 4259 return; |
4260 } | 4260 } |
4261 | 4261 |
4262 if (!GetRenderViewHost() || !GetRenderViewHost()->IsRenderViewLive()) | 4262 if (!GetRenderViewHost() || !GetRenderViewHost()->IsRenderViewLive()) |
4263 return; | 4263 return; |
4264 | 4264 |
4265 if (delegate_) | 4265 if (delegate_) |
4266 delegate_->RendererUnresponsive(this); | 4266 delegate_->RendererUnresponsive(this); |
4267 } | 4267 } |
4268 | 4268 |
4269 void WebContentsImpl::RendererResponsive(RenderViewHost* render_view_host) { | 4269 void WebContentsImpl::RendererResponsive( |
| 4270 RenderWidgetHostImpl* render_widget_host) { |
4270 if (delegate_) | 4271 if (delegate_) |
4271 delegate_->RendererResponsive(this); | 4272 delegate_->RendererResponsive(this); |
4272 } | 4273 } |
4273 | 4274 |
4274 void WebContentsImpl::LoadStateChanged( | 4275 void WebContentsImpl::LoadStateChanged( |
4275 const GURL& url, | 4276 const GURL& url, |
4276 const net::LoadStateWithParam& load_state, | 4277 const net::LoadStateWithParam& load_state, |
4277 uint64 upload_position, | 4278 uint64 upload_position, |
4278 uint64 upload_size) { | 4279 uint64 upload_size) { |
4279 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466285 | 4280 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466285 |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4672 return NULL; | 4673 return NULL; |
4673 } | 4674 } |
4674 | 4675 |
4675 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4676 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
4676 force_disable_overscroll_content_ = force_disable; | 4677 force_disable_overscroll_content_ = force_disable; |
4677 if (view_) | 4678 if (view_) |
4678 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4679 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
4679 } | 4680 } |
4680 | 4681 |
4681 } // namespace content | 4682 } // namespace content |
OLD | NEW |