Chromium Code Reviews| 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 1696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1707 } | 1707 } |
| 1708 | 1708 |
| 1709 void WebContentsImpl::ShowCreatedWindow(int route_id, | 1709 void WebContentsImpl::ShowCreatedWindow(int route_id, |
| 1710 WindowOpenDisposition disposition, | 1710 WindowOpenDisposition disposition, |
| 1711 const gfx::Rect& initial_rect, | 1711 const gfx::Rect& initial_rect, |
| 1712 bool user_gesture) { | 1712 bool user_gesture) { |
| 1713 WebContentsImpl* contents = GetCreatedWindow(route_id); | 1713 WebContentsImpl* contents = GetCreatedWindow(route_id); |
| 1714 if (contents) { | 1714 if (contents) { |
| 1715 WebContentsDelegate* delegate = GetDelegate(); | 1715 WebContentsDelegate* delegate = GetDelegate(); |
| 1716 if (delegate) { | 1716 if (delegate) { |
| 1717 if (delegate->ShouldResumeRequestsForCreatedWindow()) | |
|
jam
2015/04/20 16:05:41
nit: instead of calling the line below twice, perh
Maria
2015/04/20 23:40:07
Done.
| |
| 1718 ResumeRequestsForCreatedWindow(*contents); | |
| 1717 delegate->AddNewContents( | 1719 delegate->AddNewContents( |
| 1718 this, contents, disposition, initial_rect, user_gesture, NULL); | 1720 this, contents, disposition, initial_rect, user_gesture, NULL); |
| 1721 } else { | |
| 1722 ResumeRequestsForCreatedWindow(*contents); | |
| 1719 } | 1723 } |
| 1720 } | 1724 } |
| 1721 } | 1725 } |
| 1722 | 1726 |
| 1723 void WebContentsImpl::ShowCreatedWidget(int route_id, | 1727 void WebContentsImpl::ShowCreatedWidget(int route_id, |
| 1724 const gfx::Rect& initial_rect) { | 1728 const gfx::Rect& initial_rect) { |
| 1725 ShowCreatedWidget(route_id, false, initial_rect); | 1729 ShowCreatedWidget(route_id, false, initial_rect); |
| 1726 } | 1730 } |
| 1727 | 1731 |
| 1728 void WebContentsImpl::ShowCreatedFullscreenWidget(int route_id) { | 1732 void WebContentsImpl::ShowCreatedFullscreenWidget(int route_id) { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1793 RemoveDestructionObserver(new_contents); | 1797 RemoveDestructionObserver(new_contents); |
| 1794 | 1798 |
| 1795 // Don't initialize the guest WebContents immediately. | 1799 // Don't initialize the guest WebContents immediately. |
| 1796 if (BrowserPluginGuest::IsGuest(new_contents)) | 1800 if (BrowserPluginGuest::IsGuest(new_contents)) |
| 1797 return new_contents; | 1801 return new_contents; |
| 1798 | 1802 |
| 1799 if (!new_contents->GetRenderProcessHost()->HasConnection() || | 1803 if (!new_contents->GetRenderProcessHost()->HasConnection() || |
| 1800 !new_contents->GetRenderViewHost()->GetView()) | 1804 !new_contents->GetRenderViewHost()->GetView()) |
| 1801 return NULL; | 1805 return NULL; |
| 1802 | 1806 |
| 1803 // Resume blocked requests for both the RenderViewHost and RenderFrameHost. | 1807 return new_contents; |
| 1808 } | |
| 1809 | |
| 1810 void WebContentsImpl::ResumeRequestsForCreatedWindow( | |
| 1811 WebContentsImpl& new_contents) { | |
|
jam
2015/04/20 16:05:41
nit: not sure why this method is needed? i.e. why
Maria
2015/04/20 23:40:07
The reason it's needed is that it gets called on a
| |
| 1804 // TODO(brettw): It seems bogus to reach into here and initialize the host. | 1812 // TODO(brettw): It seems bogus to reach into here and initialize the host. |
| 1805 static_cast<RenderViewHostImpl*>(new_contents->GetRenderViewHost())->Init(); | 1813 static_cast<RenderViewHostImpl*>(new_contents.GetRenderViewHost())->Init(); |
| 1806 static_cast<RenderFrameHostImpl*>(new_contents->GetMainFrame())->Init(); | 1814 static_cast<RenderFrameHostImpl*>(new_contents.GetMainFrame())->Init(); |
| 1807 | |
| 1808 return new_contents; | |
| 1809 } | 1815 } |
| 1810 | 1816 |
| 1811 RenderWidgetHostView* WebContentsImpl::GetCreatedWidget(int route_id) { | 1817 RenderWidgetHostView* WebContentsImpl::GetCreatedWidget(int route_id) { |
| 1812 PendingWidgetViews::iterator iter = pending_widget_views_.find(route_id); | 1818 PendingWidgetViews::iterator iter = pending_widget_views_.find(route_id); |
| 1813 if (iter == pending_widget_views_.end()) { | 1819 if (iter == pending_widget_views_.end()) { |
| 1814 DCHECK(false); | 1820 DCHECK(false); |
| 1815 return NULL; | 1821 return NULL; |
| 1816 } | 1822 } |
| 1817 | 1823 |
| 1818 RenderWidgetHostView* widget_host_view = iter->second; | 1824 RenderWidgetHostView* widget_host_view = iter->second; |
| (...skipping 2717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4536 FrameTreeNode* node = frame_tree_.root(); | 4542 FrameTreeNode* node = frame_tree_.root(); |
| 4537 node->render_manager()->ResumeResponseDeferredAtStart(); | 4543 node->render_manager()->ResumeResponseDeferredAtStart(); |
| 4538 } | 4544 } |
| 4539 | 4545 |
| 4540 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4546 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
| 4541 force_disable_overscroll_content_ = force_disable; | 4547 force_disable_overscroll_content_ = force_disable; |
| 4542 if (view_) | 4548 if (view_) |
| 4543 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4549 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
| 4544 } | 4550 } |
| 4545 | 4551 |
| 4552 #if defined(OS_ANDROID) | |
| 4553 void WebContentsImpl::ResumeLoadingCreatedWebContents() { | |
| 4554 ResumeRequestsForCreatedWindow(*this); | |
| 4555 } | |
| 4556 #endif | |
| 4557 | |
| 4558 | |
| 4546 } // namespace content | 4559 } // namespace content |
| OLD | NEW |