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 1689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1700 #endif | 1700 #endif |
1701 } | 1701 } |
1702 | 1702 |
1703 void WebContentsImpl::ShowCreatedWindow(int route_id, | 1703 void WebContentsImpl::ShowCreatedWindow(int route_id, |
1704 WindowOpenDisposition disposition, | 1704 WindowOpenDisposition disposition, |
1705 const gfx::Rect& initial_rect, | 1705 const gfx::Rect& initial_rect, |
1706 bool user_gesture) { | 1706 bool user_gesture) { |
1707 WebContentsImpl* contents = GetCreatedWindow(route_id); | 1707 WebContentsImpl* contents = GetCreatedWindow(route_id); |
1708 if (contents) { | 1708 if (contents) { |
1709 WebContentsDelegate* delegate = GetDelegate(); | 1709 WebContentsDelegate* delegate = GetDelegate(); |
| 1710 if (!delegate || delegate->ShouldResumeRequestsForCreatedWindow()) |
| 1711 ResumeRequestsForCreatedWindow(*contents); |
| 1712 |
1710 if (delegate) { | 1713 if (delegate) { |
1711 delegate->AddNewContents( | 1714 delegate->AddNewContents( |
1712 this, contents, disposition, initial_rect, user_gesture, NULL); | 1715 this, contents, disposition, initial_rect, user_gesture, NULL); |
1713 } | 1716 } |
1714 } | 1717 } |
1715 } | 1718 } |
1716 | 1719 |
1717 void WebContentsImpl::ShowCreatedWidget(int route_id, | 1720 void WebContentsImpl::ShowCreatedWidget(int route_id, |
1718 const gfx::Rect& initial_rect) { | 1721 const gfx::Rect& initial_rect) { |
1719 ShowCreatedWidget(route_id, false, initial_rect); | 1722 ShowCreatedWidget(route_id, false, initial_rect); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1787 RemoveDestructionObserver(new_contents); | 1790 RemoveDestructionObserver(new_contents); |
1788 | 1791 |
1789 // Don't initialize the guest WebContents immediately. | 1792 // Don't initialize the guest WebContents immediately. |
1790 if (BrowserPluginGuest::IsGuest(new_contents)) | 1793 if (BrowserPluginGuest::IsGuest(new_contents)) |
1791 return new_contents; | 1794 return new_contents; |
1792 | 1795 |
1793 if (!new_contents->GetRenderProcessHost()->HasConnection() || | 1796 if (!new_contents->GetRenderProcessHost()->HasConnection() || |
1794 !new_contents->GetRenderViewHost()->GetView()) | 1797 !new_contents->GetRenderViewHost()->GetView()) |
1795 return NULL; | 1798 return NULL; |
1796 | 1799 |
1797 // Resume blocked requests for both the RenderViewHost and RenderFrameHost. | 1800 return new_contents; |
| 1801 } |
| 1802 |
| 1803 void WebContentsImpl::ResumeRequestsForCreatedWindow( |
| 1804 WebContentsImpl& new_contents) { |
1798 // TODO(brettw): It seems bogus to reach into here and initialize the host. | 1805 // TODO(brettw): It seems bogus to reach into here and initialize the host. |
1799 static_cast<RenderViewHostImpl*>(new_contents->GetRenderViewHost())->Init(); | 1806 static_cast<RenderViewHostImpl*>(new_contents.GetRenderViewHost())->Init(); |
1800 static_cast<RenderFrameHostImpl*>(new_contents->GetMainFrame())->Init(); | 1807 static_cast<RenderFrameHostImpl*>(new_contents.GetMainFrame())->Init(); |
1801 | |
1802 return new_contents; | |
1803 } | 1808 } |
1804 | 1809 |
1805 RenderWidgetHostView* WebContentsImpl::GetCreatedWidget(int route_id) { | 1810 RenderWidgetHostView* WebContentsImpl::GetCreatedWidget(int route_id) { |
1806 PendingWidgetViews::iterator iter = pending_widget_views_.find(route_id); | 1811 PendingWidgetViews::iterator iter = pending_widget_views_.find(route_id); |
1807 if (iter == pending_widget_views_.end()) { | 1812 if (iter == pending_widget_views_.end()) { |
1808 DCHECK(false); | 1813 DCHECK(false); |
1809 return NULL; | 1814 return NULL; |
1810 } | 1815 } |
1811 | 1816 |
1812 RenderWidgetHostView* widget_host_view = iter->second; | 1817 RenderWidgetHostView* widget_host_view = iter->second; |
(...skipping 2434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4247 return web_contents_android; | 4252 return web_contents_android; |
4248 } | 4253 } |
4249 | 4254 |
4250 bool WebContentsImpl::CreateRenderViewForInitialEmptyDocument() { | 4255 bool WebContentsImpl::CreateRenderViewForInitialEmptyDocument() { |
4251 return CreateRenderViewForRenderManager(GetRenderViewHost(), | 4256 return CreateRenderViewForRenderManager(GetRenderViewHost(), |
4252 MSG_ROUTING_NONE, | 4257 MSG_ROUTING_NONE, |
4253 MSG_ROUTING_NONE, | 4258 MSG_ROUTING_NONE, |
4254 true); | 4259 true); |
4255 } | 4260 } |
4256 | 4261 |
| 4262 void WebContentsImpl::ResumeLoadingCreatedWebContents() { |
| 4263 ResumeRequestsForCreatedWindow(*this); |
| 4264 } |
| 4265 |
4257 #elif defined(OS_MACOSX) | 4266 #elif defined(OS_MACOSX) |
4258 | 4267 |
4259 void WebContentsImpl::SetAllowOtherViews(bool allow) { | 4268 void WebContentsImpl::SetAllowOtherViews(bool allow) { |
4260 view_->SetAllowOtherViews(allow); | 4269 view_->SetAllowOtherViews(allow); |
4261 } | 4270 } |
4262 | 4271 |
4263 bool WebContentsImpl::GetAllowOtherViews() { | 4272 bool WebContentsImpl::GetAllowOtherViews() { |
4264 return view_->GetAllowOtherViews(); | 4273 return view_->GetAllowOtherViews(); |
4265 } | 4274 } |
4266 | 4275 |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4423 node->render_manager()->ResumeResponseDeferredAtStart(); | 4432 node->render_manager()->ResumeResponseDeferredAtStart(); |
4424 } | 4433 } |
4425 | 4434 |
4426 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4435 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
4427 force_disable_overscroll_content_ = force_disable; | 4436 force_disable_overscroll_content_ = force_disable; |
4428 if (view_) | 4437 if (view_) |
4429 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4438 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
4430 } | 4439 } |
4431 | 4440 |
4432 } // namespace content | 4441 } // namespace content |
OLD | NEW |