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/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" | 27 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" |
28 #include "content/browser/dom_storage/session_storage_namespace_impl.h" | 28 #include "content/browser/dom_storage/session_storage_namespace_impl.h" |
29 #include "content/browser/download/download_stats.h" | 29 #include "content/browser/download/download_stats.h" |
30 #include "content/browser/download/mhtml_generation_manager.h" | 30 #include "content/browser/download/mhtml_generation_manager.h" |
31 #include "content/browser/download/save_package.h" | 31 #include "content/browser/download/save_package.h" |
32 #include "content/browser/gpu/compositor_util.h" | 32 #include "content/browser/gpu/compositor_util.h" |
33 #include "content/browser/gpu/gpu_data_manager_impl.h" | 33 #include "content/browser/gpu/gpu_data_manager_impl.h" |
34 #include "content/browser/gpu/gpu_process_host.h" | 34 #include "content/browser/gpu/gpu_process_host.h" |
35 #include "content/browser/host_zoom_map_impl.h" | 35 #include "content/browser/host_zoom_map_impl.h" |
36 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 36 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
| 37 #include "content/browser/message_port_message_filter.h" |
| 38 #include "content/browser/message_port_service.h" |
37 #include "content/browser/power_save_blocker_impl.h" | 39 #include "content/browser/power_save_blocker_impl.h" |
38 #include "content/browser/renderer_host/render_process_host_impl.h" | 40 #include "content/browser/renderer_host/render_process_host_impl.h" |
39 #include "content/browser/renderer_host/render_view_host_impl.h" | 41 #include "content/browser/renderer_host/render_view_host_impl.h" |
40 #include "content/browser/renderer_host/render_widget_host_impl.h" | 42 #include "content/browser/renderer_host/render_widget_host_impl.h" |
41 #include "content/browser/site_instance_impl.h" | 43 #include "content/browser/site_instance_impl.h" |
42 #include "content/browser/web_contents/interstitial_page_impl.h" | 44 #include "content/browser/web_contents/interstitial_page_impl.h" |
43 #include "content/browser/web_contents/navigation_entry_impl.h" | 45 #include "content/browser/web_contents/navigation_entry_impl.h" |
44 #include "content/browser/web_contents/web_contents_view_guest.h" | 46 #include "content/browser/web_contents/web_contents_view_guest.h" |
45 #include "content/browser/webui/generic_handler.h" | 47 #include "content/browser/webui/generic_handler.h" |
46 #include "content/browser/webui/web_ui_controller_factory_registry.h" | 48 #include "content/browser/webui/web_ui_controller_factory_registry.h" |
(...skipping 3304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3351 // Note: This check means that an embedder could theoretically receive a | 3353 // Note: This check means that an embedder could theoretically receive a |
3352 // postMessage from anyone (not just its own guests). However, this is | 3354 // postMessage from anyone (not just its own guests). However, this is |
3353 // probably not a risk for apps since other pages won't have references | 3355 // probably not a risk for apps since other pages won't have references |
3354 // to App windows. | 3356 // to App windows. |
3355 if (!rvh->GetSiteInstance()->IsRelatedSiteInstance(GetSiteInstance()) && | 3357 if (!rvh->GetSiteInstance()->IsRelatedSiteInstance(GetSiteInstance()) && |
3356 !GetBrowserPluginGuest() && !GetBrowserPluginEmbedder()) | 3358 !GetBrowserPluginGuest() && !GetBrowserPluginEmbedder()) |
3357 return; | 3359 return; |
3358 | 3360 |
3359 ViewMsg_PostMessage_Params new_params(params); | 3361 ViewMsg_PostMessage_Params new_params(params); |
3360 | 3362 |
| 3363 if (!params.message_port_ids.empty()) { |
| 3364 MessagePortMessageFilter* message_port_message_filter = |
| 3365 static_cast<RenderProcessHostImpl*>(GetRenderProcessHost()) |
| 3366 ->message_port_message_filter(); |
| 3367 std::vector<int> new_routing_ids(params.message_port_ids.size()); |
| 3368 for (size_t i = 0; i < params.message_port_ids.size(); ++i) { |
| 3369 new_routing_ids[i] = message_port_message_filter->GetNextRoutingID(); |
| 3370 MessagePortService::GetInstance()->UpdateMessagePort( |
| 3371 params.message_port_ids[i], |
| 3372 message_port_message_filter, |
| 3373 new_routing_ids[i]); |
| 3374 } |
| 3375 new_params.new_routing_ids = new_routing_ids; |
| 3376 } |
| 3377 |
3361 // If there is a source_routing_id, translate it to the routing ID for | 3378 // If there is a source_routing_id, translate it to the routing ID for |
3362 // the equivalent swapped out RVH in the target process. If we need | 3379 // the equivalent swapped out RVH in the target process. If we need |
3363 // to create a swapped out RVH for the source tab, we create its opener | 3380 // to create a swapped out RVH for the source tab, we create its opener |
3364 // chain as well, since those will also be accessible to the target page. | 3381 // chain as well, since those will also be accessible to the target page. |
3365 if (new_params.source_routing_id != MSG_ROUTING_NONE) { | 3382 if (new_params.source_routing_id != MSG_ROUTING_NONE) { |
3366 // Try to look up the WebContents for the source page. | 3383 // Try to look up the WebContents for the source page. |
3367 WebContentsImpl* source_contents = NULL; | 3384 WebContentsImpl* source_contents = NULL; |
3368 RenderViewHostImpl* source_rvh = RenderViewHostImpl::FromID( | 3385 RenderViewHostImpl* source_rvh = RenderViewHostImpl::FromID( |
3369 rvh->GetProcess()->GetID(), params.source_routing_id); | 3386 rvh->GetProcess()->GetID(), params.source_routing_id); |
3370 if (source_rvh) { | 3387 if (source_rvh) { |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3800 } | 3817 } |
3801 | 3818 |
3802 void WebContentsImpl::OnFrameRemoved( | 3819 void WebContentsImpl::OnFrameRemoved( |
3803 RenderViewHostImpl* render_view_host, | 3820 RenderViewHostImpl* render_view_host, |
3804 int64 frame_id) { | 3821 int64 frame_id) { |
3805 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 3822 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
3806 FrameDetached(render_view_host, frame_id)); | 3823 FrameDetached(render_view_host, frame_id)); |
3807 } | 3824 } |
3808 | 3825 |
3809 } // namespace content | 3826 } // namespace content |
OLD | NEW |