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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 38 #include "content/browser/dom_storage/session_storage_namespace_impl.h" | 38 #include "content/browser/dom_storage/session_storage_namespace_impl.h" |
| 39 #include "content/browser/download/download_stats.h" | 39 #include "content/browser/download/download_stats.h" |
| 40 #include "content/browser/download/mhtml_generation_manager.h" | 40 #include "content/browser/download/mhtml_generation_manager.h" |
| 41 #include "content/browser/download/save_package.h" | 41 #include "content/browser/download/save_package.h" |
| 42 #include "content/browser/frame_host/cross_process_frame_connector.h" | 42 #include "content/browser/frame_host/cross_process_frame_connector.h" |
| 43 #include "content/browser/frame_host/interstitial_page_impl.h" | 43 #include "content/browser/frame_host/interstitial_page_impl.h" |
| 44 #include "content/browser/frame_host/navigation_entry_impl.h" | 44 #include "content/browser/frame_host/navigation_entry_impl.h" |
| 45 #include "content/browser/frame_host/navigation_handle_impl.h" | 45 #include "content/browser/frame_host/navigation_handle_impl.h" |
| 46 #include "content/browser/frame_host/navigator_impl.h" | 46 #include "content/browser/frame_host/navigator_impl.h" |
| 47 #include "content/browser/frame_host/render_frame_host_impl.h" | 47 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 48 #include "content/browser/frame_host/render_frame_proxy_host.h" | |
| 48 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" | 49 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" |
| 49 #include "content/browser/geolocation/geolocation_service_context.h" | 50 #include "content/browser/geolocation/geolocation_service_context.h" |
| 50 #include "content/browser/host_zoom_map_impl.h" | 51 #include "content/browser/host_zoom_map_impl.h" |
| 51 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 52 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
| 52 #include "content/browser/manifest/manifest_manager_host.h" | 53 #include "content/browser/manifest/manifest_manager_host.h" |
| 53 #include "content/browser/media/audio_stream_monitor.h" | 54 #include "content/browser/media/audio_stream_monitor.h" |
| 54 #include "content/browser/media/capture/web_contents_audio_muter.h" | 55 #include "content/browser/media/capture/web_contents_audio_muter.h" |
| 55 #include "content/browser/media/media_web_contents_observer.h" | 56 #include "content/browser/media/media_web_contents_observer.h" |
| 56 #include "content/browser/message_port_message_filter.h" | 57 #include "content/browser/message_port_message_filter.h" |
| 57 #include "content/browser/plugin_content_origin_whitelist.h" | 58 #include "content/browser/plugin_content_origin_whitelist.h" |
| 58 #include "content/browser/renderer_host/render_process_host_impl.h" | 59 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 59 #include "content/browser/renderer_host/render_view_host_delegate_view.h" | 60 #include "content/browser/renderer_host/render_view_host_delegate_view.h" |
| 60 #include "content/browser/renderer_host/render_view_host_impl.h" | 61 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 61 #include "content/browser/renderer_host/render_widget_host_impl.h" | 62 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 62 #include "content/browser/renderer_host/render_widget_host_input_event_router.h" | 63 #include "content/browser/renderer_host/render_widget_host_input_event_router.h" |
| 63 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 64 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
| 64 #include "content/browser/screen_orientation/screen_orientation_dispatcher_host_ impl.h" | 65 #include "content/browser/screen_orientation/screen_orientation_dispatcher_host_ impl.h" |
| 65 #include "content/browser/site_instance_impl.h" | 66 #include "content/browser/site_instance_impl.h" |
| 66 #include "content/browser/wake_lock/wake_lock_service_context.h" | 67 #include "content/browser/wake_lock/wake_lock_service_context.h" |
| 67 #include "content/browser/web_contents/web_contents_view_guest.h" | 68 #include "content/browser/web_contents/web_contents_view_guest.h" |
| 68 #include "content/browser/webui/generic_handler.h" | 69 #include "content/browser/webui/generic_handler.h" |
| 69 #include "content/browser/webui/web_ui_controller_factory_registry.h" | 70 #include "content/browser/webui/web_ui_controller_factory_registry.h" |
| 70 #include "content/browser/webui/web_ui_impl.h" | 71 #include "content/browser/webui/web_ui_impl.h" |
| 71 #include "content/common/browser_plugin/browser_plugin_constants.h" | 72 #include "content/common/browser_plugin/browser_plugin_constants.h" |
| 72 #include "content/common/browser_plugin/browser_plugin_messages.h" | 73 #include "content/common/browser_plugin/browser_plugin_messages.h" |
| 73 #include "content/common/frame_messages.h" | 74 #include "content/common/frame_messages.h" |
| 74 #include "content/common/input_messages.h" | 75 #include "content/common/input_messages.h" |
| 76 #include "content/common/page_messages.h" | |
| 75 #include "content/common/site_isolation_policy.h" | 77 #include "content/common/site_isolation_policy.h" |
| 76 #include "content/common/ssl_status_serialization.h" | 78 #include "content/common/ssl_status_serialization.h" |
| 77 #include "content/common/view_messages.h" | 79 #include "content/common/view_messages.h" |
| 78 #include "content/public/browser/ax_event_notification_details.h" | 80 #include "content/public/browser/ax_event_notification_details.h" |
| 79 #include "content/public/browser/browser_context.h" | 81 #include "content/public/browser/browser_context.h" |
| 80 #include "content/public/browser/browser_plugin_guest_manager.h" | 82 #include "content/public/browser/browser_plugin_guest_manager.h" |
| 81 #include "content/public/browser/content_browser_client.h" | 83 #include "content/public/browser/content_browser_client.h" |
| 82 #include "content/public/browser/devtools_agent_host.h" | 84 #include "content/public/browser/devtools_agent_host.h" |
| 83 #include "content/public/browser/download_manager.h" | 85 #include "content/public/browser/download_manager.h" |
| 84 #include "content/public/browser/download_url_parameters.h" | 86 #include "content/public/browser/download_url_parameters.h" |
| (...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 783 for (RenderFrameHost* rfh : GetAllFrames()) { | 785 for (RenderFrameHost* rfh : GetAllFrames()) { |
| 784 ++number_of_messages; | 786 ++number_of_messages; |
| 785 IPC::Message* message_copy = new IPC::Message(*message); | 787 IPC::Message* message_copy = new IPC::Message(*message); |
| 786 message_copy->set_routing_id(rfh->GetRoutingID()); | 788 message_copy->set_routing_id(rfh->GetRoutingID()); |
| 787 rfh->Send(message_copy); | 789 rfh->Send(message_copy); |
| 788 } | 790 } |
| 789 delete message; | 791 delete message; |
| 790 return number_of_messages; | 792 return number_of_messages; |
| 791 } | 793 } |
| 792 | 794 |
| 795 int WebContentsImpl::SendToAllViews(IPC::Message* msg) { | |
|
nasko
2016/02/11 18:21:28
Sending to all "Views" sounds like the wrong abstr
lfg
2016/02/11 20:26:09
Done.
| |
| 796 DCHECK(IPC_MESSAGE_CLASS(*msg) == PageMsgStart); | |
| 797 const auto& proxies = | |
| 798 frame_tree_.root()->render_manager()->GetAllProxyHosts(); | |
|
nasko
2016/02/11 18:21:28
I'd avoid exposing the proxies from RFHM. This met
lfg
2016/02/11 20:26:09
Done.
| |
| 799 | |
| 800 for (const auto& pair : proxies) { | |
| 801 RenderFrameProxyHost* proxy = pair.second.get(); | |
| 802 | |
| 803 IPC::Message* copy = new IPC::Message(*msg); | |
| 804 copy->set_routing_id(proxy->GetRoutingID()); | |
| 805 proxy->Send(copy); | |
| 806 } | |
| 807 | |
| 808 RenderFrameHost* frame_host = | |
| 809 frame_tree_.root()->render_manager()->current_frame_host(); | |
|
nasko
2016/02/11 18:21:28
If we have a pending/speculative RFH, shouldn't we
lfg
2016/02/11 20:26:08
Yes, we should, because if/when we commit, we need
| |
| 810 msg->set_routing_id(frame_host->GetRoutingID()); | |
| 811 frame_host->Send(msg); | |
| 812 | |
| 813 return 1 + proxies.size(); | |
| 814 } | |
| 815 | |
| 793 RenderViewHostImpl* WebContentsImpl::GetRenderViewHost() const { | 816 RenderViewHostImpl* WebContentsImpl::GetRenderViewHost() const { |
| 794 return GetRenderManager()->current_host(); | 817 return GetRenderManager()->current_host(); |
| 795 } | 818 } |
| 796 | 819 |
| 797 int WebContentsImpl::GetRoutingID() const { | 820 int WebContentsImpl::GetRoutingID() const { |
| 798 if (!GetRenderViewHost()) | 821 if (!GetRenderViewHost()) |
| 799 return MSG_ROUTING_NONE; | 822 return MSG_ROUTING_NONE; |
| 800 | 823 |
| 801 return GetRenderViewHost()->GetRoutingID(); | 824 return GetRenderViewHost()->GetRoutingID(); |
| 802 } | 825 } |
| (...skipping 1407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2210 void WebContentsImpl::OnMoveValidationMessage( | 2233 void WebContentsImpl::OnMoveValidationMessage( |
| 2211 const gfx::Rect& anchor_in_root_view) { | 2234 const gfx::Rect& anchor_in_root_view) { |
| 2212 if (delegate_) | 2235 if (delegate_) |
| 2213 delegate_->MoveValidationMessage(this, anchor_in_root_view); | 2236 delegate_->MoveValidationMessage(this, anchor_in_root_view); |
| 2214 } | 2237 } |
| 2215 | 2238 |
| 2216 void WebContentsImpl::SendScreenRects() { | 2239 void WebContentsImpl::SendScreenRects() { |
| 2217 RenderWidgetHostImpl::From(GetRenderViewHost()->GetWidget()) | 2240 RenderWidgetHostImpl::From(GetRenderViewHost()->GetWidget()) |
| 2218 ->SendScreenRects(); | 2241 ->SendScreenRects(); |
| 2219 | 2242 |
| 2243 RenderWidgetHostViewBase* rwhv = | |
| 2244 static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView()); | |
| 2245 if (rwhv) { | |
| 2246 SendToAllViews(new PageMsg_UpdateWindowScreenRect( | |
| 2247 MSG_ROUTING_NONE, rwhv->GetBoundsInRootWindow())); | |
| 2248 } | |
| 2249 | |
| 2220 if (browser_plugin_embedder_) | 2250 if (browser_plugin_embedder_) |
| 2221 browser_plugin_embedder_->DidSendScreenRects(); | 2251 browser_plugin_embedder_->DidSendScreenRects(); |
| 2222 } | 2252 } |
| 2223 | 2253 |
| 2224 BrowserAccessibilityManager* | 2254 BrowserAccessibilityManager* |
| 2225 WebContentsImpl::GetRootBrowserAccessibilityManager() { | 2255 WebContentsImpl::GetRootBrowserAccessibilityManager() { |
| 2226 RenderFrameHostImpl* rfh = GetMainFrame(); | 2256 RenderFrameHostImpl* rfh = GetMainFrame(); |
| 2227 return rfh ? rfh->browser_accessibility_manager() : nullptr; | 2257 return rfh ? rfh->browser_accessibility_manager() : nullptr; |
| 2228 } | 2258 } |
| 2229 | 2259 |
| (...skipping 2525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4755 const WebContentsObserver::MediaPlayerId& id) { | 4785 const WebContentsObserver::MediaPlayerId& id) { |
| 4756 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStartedPlaying(id)); | 4786 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStartedPlaying(id)); |
| 4757 } | 4787 } |
| 4758 | 4788 |
| 4759 void WebContentsImpl::MediaStoppedPlaying( | 4789 void WebContentsImpl::MediaStoppedPlaying( |
| 4760 const WebContentsObserver::MediaPlayerId& id) { | 4790 const WebContentsObserver::MediaPlayerId& id) { |
| 4761 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStoppedPlaying(id)); | 4791 FOR_EACH_OBSERVER(WebContentsObserver, observers_, MediaStoppedPlaying(id)); |
| 4762 } | 4792 } |
| 4763 | 4793 |
| 4764 } // namespace content | 4794 } // namespace content |
| OLD | NEW |