| 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 1334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1345 // it should be hidden. | 1345 // it should be hidden. |
| 1346 should_normally_be_visible_ = !params.initially_hidden; | 1346 should_normally_be_visible_ = !params.initially_hidden; |
| 1347 | 1347 |
| 1348 // Either both routing ids can be given, or neither can be. | 1348 // Either both routing ids can be given, or neither can be. |
| 1349 DCHECK((params.routing_id == MSG_ROUTING_NONE && | 1349 DCHECK((params.routing_id == MSG_ROUTING_NONE && |
| 1350 params.main_frame_routing_id == MSG_ROUTING_NONE) || | 1350 params.main_frame_routing_id == MSG_ROUTING_NONE) || |
| 1351 (params.routing_id != MSG_ROUTING_NONE && | 1351 (params.routing_id != MSG_ROUTING_NONE && |
| 1352 params.main_frame_routing_id != MSG_ROUTING_NONE)); | 1352 params.main_frame_routing_id != MSG_ROUTING_NONE)); |
| 1353 GetRenderManager()->Init(params.browser_context, params.site_instance, | 1353 GetRenderManager()->Init(params.browser_context, params.site_instance, |
| 1354 params.routing_id, params.main_frame_routing_id, | 1354 params.routing_id, params.main_frame_routing_id, |
| 1355 MSG_ROUTING_NONE, 0 /* surface_id */); | 1355 MSG_ROUTING_NONE); |
| 1356 frame_tree_.root()->SetFrameName(params.main_frame_name); | 1356 frame_tree_.root()->SetFrameName(params.main_frame_name); |
| 1357 | 1357 |
| 1358 WebContentsViewDelegate* delegate = | 1358 WebContentsViewDelegate* delegate = |
| 1359 GetContentClient()->browser()->GetWebContentsViewDelegate(this); | 1359 GetContentClient()->browser()->GetWebContentsViewDelegate(this); |
| 1360 | 1360 |
| 1361 if (browser_plugin_guest_ && | 1361 if (browser_plugin_guest_ && |
| 1362 !BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) { | 1362 !BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) { |
| 1363 scoped_ptr<WebContentsView> platform_view(CreateWebContentsView( | 1363 scoped_ptr<WebContentsView> platform_view(CreateWebContentsView( |
| 1364 this, delegate, &render_view_host_delegate_view_)); | 1364 this, delegate, &render_view_host_delegate_view_)); |
| 1365 | 1365 |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1820 new OpenURLParams(open_params)); | 1820 new OpenURLParams(open_params)); |
| 1821 } else { | 1821 } else { |
| 1822 new_contents->OpenURL(open_params); | 1822 new_contents->OpenURL(open_params); |
| 1823 } | 1823 } |
| 1824 } | 1824 } |
| 1825 } | 1825 } |
| 1826 } | 1826 } |
| 1827 | 1827 |
| 1828 void WebContentsImpl::CreateNewWidget(int32 render_process_id, | 1828 void WebContentsImpl::CreateNewWidget(int32 render_process_id, |
| 1829 int32 route_id, | 1829 int32 route_id, |
| 1830 int32 surface_id, | |
| 1831 blink::WebPopupType popup_type) { | 1830 blink::WebPopupType popup_type) { |
| 1832 CreateNewWidget(render_process_id, route_id, surface_id, false, popup_type); | 1831 CreateNewWidget(render_process_id, route_id, false, popup_type); |
| 1833 } | 1832 } |
| 1834 | 1833 |
| 1835 void WebContentsImpl::CreateNewFullscreenWidget(int32 render_process_id, | 1834 void WebContentsImpl::CreateNewFullscreenWidget(int32 render_process_id, |
| 1836 int32 route_id, | 1835 int32 route_id) { |
| 1837 int32 surface_id) { | 1836 CreateNewWidget(render_process_id, route_id, true, blink::WebPopupTypeNone); |
| 1838 CreateNewWidget(render_process_id, route_id, surface_id, true, | |
| 1839 blink::WebPopupTypeNone); | |
| 1840 } | 1837 } |
| 1841 | 1838 |
| 1842 void WebContentsImpl::CreateNewWidget(int32 render_process_id, | 1839 void WebContentsImpl::CreateNewWidget(int32 render_process_id, |
| 1843 int32 route_id, | 1840 int32 route_id, |
| 1844 int32 surface_id, | |
| 1845 bool is_fullscreen, | 1841 bool is_fullscreen, |
| 1846 blink::WebPopupType popup_type) { | 1842 blink::WebPopupType popup_type) { |
| 1847 RenderProcessHost* process = GetRenderProcessHost(); | 1843 RenderProcessHost* process = GetRenderProcessHost(); |
| 1848 // A message to create a new widget can only come from the active process for | 1844 // A message to create a new widget can only come from the active process for |
| 1849 // this WebContentsImpl instance. If any other process sends the request, | 1845 // this WebContentsImpl instance. If any other process sends the request, |
| 1850 // it is invalid and the process must be terminated. | 1846 // it is invalid and the process must be terminated. |
| 1851 if (process->GetID() != render_process_id) { | 1847 if (process->GetID() != render_process_id) { |
| 1852 RenderProcessHost* rph = RenderProcessHost::FromID(render_process_id); | 1848 RenderProcessHost* rph = RenderProcessHost::FromID(render_process_id); |
| 1853 base::ProcessHandle process_handle = rph->GetHandle(); | 1849 base::ProcessHandle process_handle = rph->GetHandle(); |
| 1854 if (process_handle != base::kNullProcessHandle) { | 1850 if (process_handle != base::kNullProcessHandle) { |
| 1855 RecordAction( | 1851 RecordAction( |
| 1856 base::UserMetricsAction("Terminate_ProcessMismatch_CreateNewWidget")); | 1852 base::UserMetricsAction("Terminate_ProcessMismatch_CreateNewWidget")); |
| 1857 rph->Shutdown(RESULT_CODE_KILLED, false); | 1853 rph->Shutdown(RESULT_CODE_KILLED, false); |
| 1858 } | 1854 } |
| 1859 return; | 1855 return; |
| 1860 } | 1856 } |
| 1861 | 1857 |
| 1862 RenderWidgetHostImpl* widget_host = | 1858 RenderWidgetHostImpl* widget_host = |
| 1863 new RenderWidgetHostImpl(this, process, route_id, surface_id, IsHidden()); | 1859 new RenderWidgetHostImpl(this, process, route_id, IsHidden()); |
| 1864 created_widgets_.insert(widget_host); | 1860 created_widgets_.insert(widget_host); |
| 1865 | 1861 |
| 1866 RenderWidgetHostViewBase* widget_view = | 1862 RenderWidgetHostViewBase* widget_view = |
| 1867 static_cast<RenderWidgetHostViewBase*>( | 1863 static_cast<RenderWidgetHostViewBase*>( |
| 1868 view_->CreateViewForPopupWidget(widget_host)); | 1864 view_->CreateViewForPopupWidget(widget_host)); |
| 1869 if (!widget_view) | 1865 if (!widget_view) |
| 1870 return; | 1866 return; |
| 1871 if (!is_fullscreen) { | 1867 if (!is_fullscreen) { |
| 1872 // Popups should not get activated. | 1868 // Popups should not get activated. |
| 1873 widget_view->SetPopupType(popup_type); | 1869 widget_view->SetPopupType(popup_type); |
| (...skipping 2776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4650 return NULL; | 4646 return NULL; |
| 4651 } | 4647 } |
| 4652 | 4648 |
| 4653 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4649 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
| 4654 force_disable_overscroll_content_ = force_disable; | 4650 force_disable_overscroll_content_ = force_disable; |
| 4655 if (view_) | 4651 if (view_) |
| 4656 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4652 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
| 4657 } | 4653 } |
| 4658 | 4654 |
| 4659 } // namespace content | 4655 } // namespace content |
| OLD | NEW |