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 1628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1639 } | 1639 } |
1640 } | 1640 } |
1641 | 1641 |
1642 void WebContentsImpl::LostMouseLock() { | 1642 void WebContentsImpl::LostMouseLock() { |
1643 if (delegate_) | 1643 if (delegate_) |
1644 delegate_->LostMouseLock(); | 1644 delegate_->LostMouseLock(); |
1645 } | 1645 } |
1646 | 1646 |
1647 void WebContentsImpl::CreateNewWindow( | 1647 void WebContentsImpl::CreateNewWindow( |
1648 SiteInstance* source_site_instance, | 1648 SiteInstance* source_site_instance, |
1649 int route_id, | 1649 int32 route_id, |
1650 int main_frame_route_id, | 1650 int32 main_frame_route_id, |
| 1651 int32 main_frame_widget_route_id, |
1651 const ViewHostMsg_CreateWindow_Params& params, | 1652 const ViewHostMsg_CreateWindow_Params& params, |
1652 SessionStorageNamespace* session_storage_namespace) { | 1653 SessionStorageNamespace* session_storage_namespace) { |
1653 // We usually create the new window in the same BrowsingInstance (group of | 1654 // We usually create the new window in the same BrowsingInstance (group of |
1654 // script-related windows), by passing in the current SiteInstance. However, | 1655 // script-related windows), by passing in the current SiteInstance. However, |
1655 // if the opener is being suppressed (in a non-guest), we create a new | 1656 // if the opener is being suppressed (in a non-guest), we create a new |
1656 // SiteInstance in its own BrowsingInstance. | 1657 // SiteInstance in its own BrowsingInstance. |
1657 bool is_guest = BrowserPluginGuest::IsGuest(this); | 1658 bool is_guest = BrowserPluginGuest::IsGuest(this); |
1658 | 1659 |
1659 if (is_guest && BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) { | 1660 if (is_guest && BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) { |
1660 // TODO(lazyboy): CreateNewWindow doesn't work for OOPIF-based <webview> | 1661 // TODO(lazyboy): CreateNewWindow doesn't work for OOPIF-based <webview> |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1699 site_instance->GetSiteURL()); | 1700 site_instance->GetSiteURL()); |
1700 StoragePartition* partition = BrowserContext::GetStoragePartition( | 1701 StoragePartition* partition = BrowserContext::GetStoragePartition( |
1701 GetBrowserContext(), site_instance.get()); | 1702 GetBrowserContext(), site_instance.get()); |
1702 DOMStorageContextWrapper* dom_storage_context = | 1703 DOMStorageContextWrapper* dom_storage_context = |
1703 static_cast<DOMStorageContextWrapper*>(partition->GetDOMStorageContext()); | 1704 static_cast<DOMStorageContextWrapper*>(partition->GetDOMStorageContext()); |
1704 SessionStorageNamespaceImpl* session_storage_namespace_impl = | 1705 SessionStorageNamespaceImpl* session_storage_namespace_impl = |
1705 static_cast<SessionStorageNamespaceImpl*>(session_storage_namespace); | 1706 static_cast<SessionStorageNamespaceImpl*>(session_storage_namespace); |
1706 CHECK(session_storage_namespace_impl->IsFromContext(dom_storage_context)); | 1707 CHECK(session_storage_namespace_impl->IsFromContext(dom_storage_context)); |
1707 | 1708 |
1708 if (delegate_ && | 1709 if (delegate_ && |
1709 !delegate_->ShouldCreateWebContents(this, | 1710 !delegate_->ShouldCreateWebContents( |
1710 route_id, | 1711 this, route_id, main_frame_route_id, main_frame_widget_route_id, |
1711 main_frame_route_id, | 1712 params.window_container_type, params.frame_name, params.target_url, |
1712 params.window_container_type, | 1713 partition_id, session_storage_namespace)) { |
1713 params.frame_name, | |
1714 params.target_url, | |
1715 partition_id, | |
1716 session_storage_namespace)) { | |
1717 if (route_id != MSG_ROUTING_NONE && | 1714 if (route_id != MSG_ROUTING_NONE && |
1718 !RenderViewHost::FromID(render_process_id, route_id)) { | 1715 !RenderViewHost::FromID(render_process_id, route_id)) { |
1719 // If the embedder didn't create a WebContents for this route, we need to | 1716 // If the embedder didn't create a WebContents for this route, we need to |
1720 // delete the RenderView that had already been created. | 1717 // delete the RenderView that had already been created. |
1721 Send(new ViewMsg_Close(route_id)); | 1718 Send(new ViewMsg_Close(route_id)); |
1722 } | 1719 } |
1723 GetRenderViewHost()->GetProcess()->ResumeRequestsForView(route_id); | 1720 GetRenderViewHost()->GetProcess()->ResumeRequestsForView(route_id); |
1724 GetRenderViewHost()->GetProcess()->ResumeRequestsForView( | 1721 GetRenderViewHost()->GetProcess()->ResumeRequestsForView( |
1725 main_frame_route_id); | 1722 main_frame_route_id); |
| 1723 GetRenderViewHost()->GetProcess()->ResumeRequestsForView( |
| 1724 main_frame_widget_route_id); |
1726 return; | 1725 return; |
1727 } | 1726 } |
1728 | 1727 |
1729 // Create the new web contents. This will automatically create the new | 1728 // Create the new web contents. This will automatically create the new |
1730 // WebContentsView. In the future, we may want to create the view separately. | 1729 // WebContentsView. In the future, we may want to create the view separately. |
1731 CreateParams create_params(GetBrowserContext(), site_instance.get()); | 1730 CreateParams create_params(GetBrowserContext(), site_instance.get()); |
1732 create_params.routing_id = route_id; | 1731 create_params.routing_id = route_id; |
1733 create_params.main_frame_routing_id = main_frame_route_id; | 1732 create_params.main_frame_routing_id = main_frame_route_id; |
| 1733 create_params.main_frame_widget_routing_id = main_frame_widget_route_id; |
1734 create_params.main_frame_name = params.frame_name; | 1734 create_params.main_frame_name = params.frame_name; |
1735 create_params.opener_render_process_id = render_process_id; | 1735 create_params.opener_render_process_id = render_process_id; |
1736 create_params.opener_render_frame_id = params.opener_render_frame_id; | 1736 create_params.opener_render_frame_id = params.opener_render_frame_id; |
1737 create_params.opener_suppressed = params.opener_suppressed; | 1737 create_params.opener_suppressed = params.opener_suppressed; |
1738 if (params.disposition == NEW_BACKGROUND_TAB) | 1738 if (params.disposition == NEW_BACKGROUND_TAB) |
1739 create_params.initially_hidden = true; | 1739 create_params.initially_hidden = true; |
1740 create_params.renderer_initiated_creation = | 1740 create_params.renderer_initiated_creation = |
1741 main_frame_route_id != MSG_ROUTING_NONE; | 1741 main_frame_route_id != MSG_ROUTING_NONE; |
1742 | 1742 |
1743 WebContentsImpl* new_contents = NULL; | 1743 WebContentsImpl* new_contents = NULL; |
(...skipping 2871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4615 player_map->erase(it); | 4615 player_map->erase(it); |
4616 } | 4616 } |
4617 | 4617 |
4618 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4618 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
4619 force_disable_overscroll_content_ = force_disable; | 4619 force_disable_overscroll_content_ = force_disable; |
4620 if (view_) | 4620 if (view_) |
4621 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4621 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
4622 } | 4622 } |
4623 | 4623 |
4624 } // namespace content | 4624 } // namespace content |
OLD | NEW |