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 1684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1695 #endif | 1695 #endif |
1696 } | 1696 } |
1697 | 1697 |
1698 void WebContentsImpl::ShowCreatedWindow(int route_id, | 1698 void WebContentsImpl::ShowCreatedWindow(int route_id, |
1699 WindowOpenDisposition disposition, | 1699 WindowOpenDisposition disposition, |
1700 const gfx::Rect& initial_rect, | 1700 const gfx::Rect& initial_rect, |
1701 bool user_gesture) { | 1701 bool user_gesture) { |
1702 WebContentsImpl* contents = GetCreatedWindow(route_id); | 1702 WebContentsImpl* contents = GetCreatedWindow(route_id); |
1703 if (contents) { | 1703 if (contents) { |
1704 WebContentsDelegate* delegate = GetDelegate(); | 1704 WebContentsDelegate* delegate = GetDelegate(); |
1705 if (!delegate || delegate->ShouldResumeRequestsForCreatedWindow()) | |
1706 contents->ResumeLoadingCreatedWebContents(); | |
1707 | |
1705 if (delegate) { | 1708 if (delegate) { |
1706 delegate->AddNewContents( | 1709 delegate->AddNewContents( |
1707 this, contents, disposition, initial_rect, user_gesture, NULL); | 1710 this, contents, disposition, initial_rect, user_gesture, NULL); |
1708 } | 1711 } |
1709 } | 1712 } |
1710 } | 1713 } |
1711 | 1714 |
1712 void WebContentsImpl::ShowCreatedWidget(int route_id, | 1715 void WebContentsImpl::ShowCreatedWidget(int route_id, |
1713 const gfx::Rect& initial_rect) { | 1716 const gfx::Rect& initial_rect) { |
1714 ShowCreatedWidget(route_id, false, initial_rect); | 1717 ShowCreatedWidget(route_id, false, initial_rect); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1775 // in creating one, just return NULL. | 1778 // in creating one, just return NULL. |
1776 if (iter == pending_contents_.end()) { | 1779 if (iter == pending_contents_.end()) { |
1777 return NULL; | 1780 return NULL; |
1778 } | 1781 } |
1779 | 1782 |
1780 WebContentsImpl* new_contents = iter->second; | 1783 WebContentsImpl* new_contents = iter->second; |
1781 pending_contents_.erase(route_id); | 1784 pending_contents_.erase(route_id); |
1782 RemoveDestructionObserver(new_contents); | 1785 RemoveDestructionObserver(new_contents); |
1783 | 1786 |
1784 // Don't initialize the guest WebContents immediately. | 1787 // Don't initialize the guest WebContents immediately. |
1785 if (BrowserPluginGuest::IsGuest(new_contents)) | 1788 if (BrowserPluginGuest::IsGuest(new_contents)) |
Fady Samuel
2015/04/28 22:57:04
Is this code necessary then?
Fady Samuel
2015/04/28 23:10:57
Chatted about it online. If we don't return the ne
| |
1786 return new_contents; | 1789 return new_contents; |
1787 | 1790 |
1788 if (!new_contents->GetRenderProcessHost()->HasConnection() || | 1791 if (!new_contents->GetRenderProcessHost()->HasConnection() || |
1789 !new_contents->GetRenderViewHost()->GetView()) | 1792 !new_contents->GetRenderViewHost()->GetView()) |
1790 return NULL; | 1793 return NULL; |
1791 | 1794 |
1792 // Resume blocked requests for both the RenderViewHost and RenderFrameHost. | |
1793 // TODO(brettw): It seems bogus to reach into here and initialize the host. | |
1794 new_contents->GetRenderViewHost()->Init(); | |
1795 new_contents->GetMainFrame()->Init(); | |
1796 | |
1797 return new_contents; | 1795 return new_contents; |
1798 } | 1796 } |
1799 | 1797 |
1800 RenderWidgetHostView* WebContentsImpl::GetCreatedWidget(int route_id) { | 1798 RenderWidgetHostView* WebContentsImpl::GetCreatedWidget(int route_id) { |
1801 PendingWidgetViews::iterator iter = pending_widget_views_.find(route_id); | 1799 PendingWidgetViews::iterator iter = pending_widget_views_.find(route_id); |
1802 if (iter == pending_widget_views_.end()) { | 1800 if (iter == pending_widget_views_.end()) { |
1803 DCHECK(false); | 1801 DCHECK(false); |
1804 return NULL; | 1802 return NULL; |
1805 } | 1803 } |
1806 | 1804 |
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2533 void WebContentsImpl::GetManifest(const GetManifestCallback& callback) { | 2531 void WebContentsImpl::GetManifest(const GetManifestCallback& callback) { |
2534 manifest_manager_host_->GetManifest(GetMainFrame(), callback); | 2532 manifest_manager_host_->GetManifest(GetMainFrame(), callback); |
2535 } | 2533 } |
2536 | 2534 |
2537 void WebContentsImpl::ExitFullscreen() { | 2535 void WebContentsImpl::ExitFullscreen() { |
2538 // Clean up related state and initiate the fullscreen exit. | 2536 // Clean up related state and initiate the fullscreen exit. |
2539 GetRenderViewHost()->RejectMouseLockOrUnlockIfNecessary(); | 2537 GetRenderViewHost()->RejectMouseLockOrUnlockIfNecessary(); |
2540 ExitFullscreenMode(); | 2538 ExitFullscreenMode(); |
2541 } | 2539 } |
2542 | 2540 |
2541 void WebContentsImpl::ResumeLoadingCreatedWebContents() { | |
2542 // Resume blocked requests for both the RenderViewHost and RenderFrameHost. | |
2543 // TODO(brettw): It seems bogus to reach into here and initialize the host. | |
2544 GetRenderViewHost()->Init(); | |
2545 GetMainFrame()->Init(); | |
2546 } | |
2547 | |
2543 bool WebContentsImpl::FocusLocationBarByDefault() { | 2548 bool WebContentsImpl::FocusLocationBarByDefault() { |
2544 NavigationEntry* entry = controller_.GetVisibleEntry(); | 2549 NavigationEntry* entry = controller_.GetVisibleEntry(); |
2545 if (entry && entry->GetURL() == GURL(url::kAboutBlankURL)) | 2550 if (entry && entry->GetURL() == GURL(url::kAboutBlankURL)) |
2546 return true; | 2551 return true; |
2547 return delegate_ && delegate_->ShouldFocusLocationBarByDefault(this); | 2552 return delegate_ && delegate_->ShouldFocusLocationBarByDefault(this); |
2548 } | 2553 } |
2549 | 2554 |
2550 void WebContentsImpl::SetFocusToLocationBar(bool select_all) { | 2555 void WebContentsImpl::SetFocusToLocationBar(bool select_all) { |
2551 if (delegate_) | 2556 if (delegate_) |
2552 delegate_->SetFocusToLocationBar(select_all); | 2557 delegate_->SetFocusToLocationBar(select_all); |
(...skipping 1869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4422 node->render_manager()->ResumeResponseDeferredAtStart(); | 4427 node->render_manager()->ResumeResponseDeferredAtStart(); |
4423 } | 4428 } |
4424 | 4429 |
4425 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4430 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
4426 force_disable_overscroll_content_ = force_disable; | 4431 force_disable_overscroll_content_ = force_disable; |
4427 if (view_) | 4432 if (view_) |
4428 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4433 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
4429 } | 4434 } |
4430 | 4435 |
4431 } // namespace content | 4436 } // namespace content |
OLD | NEW |