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 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 (!BrowserPluginGuest::IsGuest(contents) && | |
|
Maria
2015/04/25 01:40:28
This check should probably be within web contents
Fady Samuel
2015/04/28 19:50:23
Stick it in GuestViewBase::ShouldResumeRequestsFor
| |
| 1706 (!delegate || delegate->ShouldResumeRequestsForCreatedWindow())) | |
| 1707 contents->ResumeLoadingCreatedWebContents(); | |
| 1708 | |
| 1705 if (delegate) { | 1709 if (delegate) { |
| 1706 delegate->AddNewContents( | 1710 delegate->AddNewContents( |
| 1707 this, contents, disposition, initial_rect, user_gesture, NULL); | 1711 this, contents, disposition, initial_rect, user_gesture, NULL); |
| 1708 } | 1712 } |
| 1709 } | 1713 } |
| 1710 } | 1714 } |
| 1711 | 1715 |
| 1712 void WebContentsImpl::ShowCreatedWidget(int route_id, | 1716 void WebContentsImpl::ShowCreatedWidget(int route_id, |
| 1713 const gfx::Rect& initial_rect) { | 1717 const gfx::Rect& initial_rect) { |
| 1714 ShowCreatedWidget(route_id, false, initial_rect); | 1718 ShowCreatedWidget(route_id, false, initial_rect); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1782 RemoveDestructionObserver(new_contents); | 1786 RemoveDestructionObserver(new_contents); |
| 1783 | 1787 |
| 1784 // Don't initialize the guest WebContents immediately. | 1788 // Don't initialize the guest WebContents immediately. |
| 1785 if (BrowserPluginGuest::IsGuest(new_contents)) | 1789 if (BrowserPluginGuest::IsGuest(new_contents)) |
| 1786 return new_contents; | 1790 return new_contents; |
| 1787 | 1791 |
| 1788 if (!new_contents->GetRenderProcessHost()->HasConnection() || | 1792 if (!new_contents->GetRenderProcessHost()->HasConnection() || |
| 1789 !new_contents->GetRenderViewHost()->GetView()) | 1793 !new_contents->GetRenderViewHost()->GetView()) |
| 1790 return NULL; | 1794 return NULL; |
| 1791 | 1795 |
| 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; | 1796 return new_contents; |
| 1798 } | 1797 } |
| 1799 | 1798 |
| 1800 RenderWidgetHostView* WebContentsImpl::GetCreatedWidget(int route_id) { | 1799 RenderWidgetHostView* WebContentsImpl::GetCreatedWidget(int route_id) { |
| 1801 PendingWidgetViews::iterator iter = pending_widget_views_.find(route_id); | 1800 PendingWidgetViews::iterator iter = pending_widget_views_.find(route_id); |
| 1802 if (iter == pending_widget_views_.end()) { | 1801 if (iter == pending_widget_views_.end()) { |
| 1803 DCHECK(false); | 1802 DCHECK(false); |
| 1804 return NULL; | 1803 return NULL; |
| 1805 } | 1804 } |
| 1806 | 1805 |
| (...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2533 void WebContentsImpl::GetManifest(const GetManifestCallback& callback) { | 2532 void WebContentsImpl::GetManifest(const GetManifestCallback& callback) { |
| 2534 manifest_manager_host_->GetManifest(GetMainFrame(), callback); | 2533 manifest_manager_host_->GetManifest(GetMainFrame(), callback); |
| 2535 } | 2534 } |
| 2536 | 2535 |
| 2537 void WebContentsImpl::ExitFullscreen() { | 2536 void WebContentsImpl::ExitFullscreen() { |
| 2538 // Clean up related state and initiate the fullscreen exit. | 2537 // Clean up related state and initiate the fullscreen exit. |
| 2539 GetRenderViewHost()->RejectMouseLockOrUnlockIfNecessary(); | 2538 GetRenderViewHost()->RejectMouseLockOrUnlockIfNecessary(); |
| 2540 ExitFullscreenMode(); | 2539 ExitFullscreenMode(); |
| 2541 } | 2540 } |
| 2542 | 2541 |
| 2542 void WebContentsImpl::ResumeLoadingCreatedWebContents() { | |
| 2543 // Resume blocked requests for both the RenderViewHost and RenderFrameHost. | |
| 2544 // TODO(brettw): It seems bogus to reach into here and initialize the host. | |
| 2545 GetRenderViewHost()->Init(); | |
| 2546 GetMainFrame()->Init(); | |
| 2547 } | |
| 2548 | |
| 2543 bool WebContentsImpl::FocusLocationBarByDefault() { | 2549 bool WebContentsImpl::FocusLocationBarByDefault() { |
| 2544 NavigationEntry* entry = controller_.GetVisibleEntry(); | 2550 NavigationEntry* entry = controller_.GetVisibleEntry(); |
| 2545 if (entry && entry->GetURL() == GURL(url::kAboutBlankURL)) | 2551 if (entry && entry->GetURL() == GURL(url::kAboutBlankURL)) |
| 2546 return true; | 2552 return true; |
| 2547 return delegate_ && delegate_->ShouldFocusLocationBarByDefault(this); | 2553 return delegate_ && delegate_->ShouldFocusLocationBarByDefault(this); |
| 2548 } | 2554 } |
| 2549 | 2555 |
| 2550 void WebContentsImpl::SetFocusToLocationBar(bool select_all) { | 2556 void WebContentsImpl::SetFocusToLocationBar(bool select_all) { |
| 2551 if (delegate_) | 2557 if (delegate_) |
| 2552 delegate_->SetFocusToLocationBar(select_all); | 2558 delegate_->SetFocusToLocationBar(select_all); |
| (...skipping 1869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4422 node->render_manager()->ResumeResponseDeferredAtStart(); | 4428 node->render_manager()->ResumeResponseDeferredAtStart(); |
| 4423 } | 4429 } |
| 4424 | 4430 |
| 4425 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4431 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
| 4426 force_disable_overscroll_content_ = force_disable; | 4432 force_disable_overscroll_content_ = force_disable; |
| 4427 if (view_) | 4433 if (view_) |
| 4428 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4434 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
| 4429 } | 4435 } |
| 4430 | 4436 |
| 4431 } // namespace content | 4437 } // namespace content |
| OLD | NEW |