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 1688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1699 #endif | 1699 #endif |
1700 } | 1700 } |
1701 | 1701 |
1702 void WebContentsImpl::ShowCreatedWindow(int route_id, | 1702 void WebContentsImpl::ShowCreatedWindow(int route_id, |
1703 WindowOpenDisposition disposition, | 1703 WindowOpenDisposition disposition, |
1704 const gfx::Rect& initial_rect, | 1704 const gfx::Rect& initial_rect, |
1705 bool user_gesture) { | 1705 bool user_gesture) { |
1706 WebContentsImpl* contents = GetCreatedWindow(route_id); | 1706 WebContentsImpl* contents = GetCreatedWindow(route_id); |
1707 if (contents) { | 1707 if (contents) { |
1708 WebContentsDelegate* delegate = GetDelegate(); | 1708 WebContentsDelegate* delegate = GetDelegate(); |
| 1709 if (!delegate || delegate->ShouldResumeRequestsForCreatedWindow()) |
| 1710 contents->ResumeLoadingCreatedWebContents(); |
| 1711 |
1709 if (delegate) { | 1712 if (delegate) { |
1710 delegate->AddNewContents( | 1713 delegate->AddNewContents( |
1711 this, contents, disposition, initial_rect, user_gesture, NULL); | 1714 this, contents, disposition, initial_rect, user_gesture, NULL); |
1712 } | 1715 } |
1713 } | 1716 } |
1714 } | 1717 } |
1715 | 1718 |
1716 void WebContentsImpl::ShowCreatedWidget(int route_id, | 1719 void WebContentsImpl::ShowCreatedWidget(int route_id, |
1717 const gfx::Rect& initial_rect) { | 1720 const gfx::Rect& initial_rect) { |
1718 ShowCreatedWidget(route_id, false, initial_rect); | 1721 ShowCreatedWidget(route_id, false, initial_rect); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1786 RemoveDestructionObserver(new_contents); | 1789 RemoveDestructionObserver(new_contents); |
1787 | 1790 |
1788 // Don't initialize the guest WebContents immediately. | 1791 // Don't initialize the guest WebContents immediately. |
1789 if (BrowserPluginGuest::IsGuest(new_contents)) | 1792 if (BrowserPluginGuest::IsGuest(new_contents)) |
1790 return new_contents; | 1793 return new_contents; |
1791 | 1794 |
1792 if (!new_contents->GetRenderProcessHost()->HasConnection() || | 1795 if (!new_contents->GetRenderProcessHost()->HasConnection() || |
1793 !new_contents->GetRenderViewHost()->GetView()) | 1796 !new_contents->GetRenderViewHost()->GetView()) |
1794 return NULL; | 1797 return NULL; |
1795 | 1798 |
1796 // Resume blocked requests for both the RenderViewHost and RenderFrameHost. | |
1797 // TODO(brettw): It seems bogus to reach into here and initialize the host. | |
1798 static_cast<RenderViewHostImpl*>(new_contents->GetRenderViewHost())->Init(); | |
1799 static_cast<RenderFrameHostImpl*>(new_contents->GetMainFrame())->Init(); | |
1800 | |
1801 return new_contents; | 1799 return new_contents; |
1802 } | 1800 } |
1803 | 1801 |
1804 RenderWidgetHostView* WebContentsImpl::GetCreatedWidget(int route_id) { | 1802 RenderWidgetHostView* WebContentsImpl::GetCreatedWidget(int route_id) { |
1805 PendingWidgetViews::iterator iter = pending_widget_views_.find(route_id); | 1803 PendingWidgetViews::iterator iter = pending_widget_views_.find(route_id); |
1806 if (iter == pending_widget_views_.end()) { | 1804 if (iter == pending_widget_views_.end()) { |
1807 DCHECK(false); | 1805 DCHECK(false); |
1808 return NULL; | 1806 return NULL; |
1809 } | 1807 } |
1810 | 1808 |
(...skipping 2445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4256 void WebContentsImpl::SetAllowOtherViews(bool allow) { | 4254 void WebContentsImpl::SetAllowOtherViews(bool allow) { |
4257 view_->SetAllowOtherViews(allow); | 4255 view_->SetAllowOtherViews(allow); |
4258 } | 4256 } |
4259 | 4257 |
4260 bool WebContentsImpl::GetAllowOtherViews() { | 4258 bool WebContentsImpl::GetAllowOtherViews() { |
4261 return view_->GetAllowOtherViews(); | 4259 return view_->GetAllowOtherViews(); |
4262 } | 4260 } |
4263 | 4261 |
4264 #endif | 4262 #endif |
4265 | 4263 |
| 4264 void WebContentsImpl::ResumeLoadingCreatedWebContents() { |
| 4265 // TODO(brettw): It seems bogus to reach into here and initialize the host. |
| 4266 static_cast<RenderViewHostImpl*>(this->GetRenderViewHost())->Init(); |
| 4267 static_cast<RenderFrameHostImpl*>(this->GetMainFrame())->Init(); |
| 4268 } |
| 4269 |
4266 void WebContentsImpl::OnDialogClosed(int render_process_id, | 4270 void WebContentsImpl::OnDialogClosed(int render_process_id, |
4267 int render_frame_id, | 4271 int render_frame_id, |
4268 IPC::Message* reply_msg, | 4272 IPC::Message* reply_msg, |
4269 bool dialog_was_suppressed, | 4273 bool dialog_was_suppressed, |
4270 bool success, | 4274 bool success, |
4271 const base::string16& user_input) { | 4275 const base::string16& user_input) { |
4272 RenderFrameHostImpl* rfh = RenderFrameHostImpl::FromID(render_process_id, | 4276 RenderFrameHostImpl* rfh = RenderFrameHostImpl::FromID(render_process_id, |
4273 render_frame_id); | 4277 render_frame_id); |
4274 last_dialog_suppressed_ = dialog_was_suppressed; | 4278 last_dialog_suppressed_ = dialog_was_suppressed; |
4275 | 4279 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4420 node->render_manager()->ResumeResponseDeferredAtStart(); | 4424 node->render_manager()->ResumeResponseDeferredAtStart(); |
4421 } | 4425 } |
4422 | 4426 |
4423 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4427 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
4424 force_disable_overscroll_content_ = force_disable; | 4428 force_disable_overscroll_content_ = force_disable; |
4425 if (view_) | 4429 if (view_) |
4426 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4430 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
4427 } | 4431 } |
4428 | 4432 |
4429 } // namespace content | 4433 } // namespace content |
OLD | NEW |