Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/frame_host/render_frame_host_impl.h" | 5 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 6 | 6 |
| 7 #include "base/containers/hash_tables.h" | 7 #include "base/containers/hash_tables.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/metrics/user_metrics_action.h" | 9 #include "base/metrics/user_metrics_action.h" |
| 10 #include "content/browser/frame_host/cross_process_frame_connector.h" | 10 #include "content/browser/frame_host/cross_process_frame_connector.h" |
| 11 #include "content/browser/frame_host/frame_tree.h" | 11 #include "content/browser/frame_host/frame_tree.h" |
| 12 #include "content/browser/frame_host/frame_tree_node.h" | 12 #include "content/browser/frame_host/frame_tree_node.h" |
| 13 #include "content/browser/frame_host/navigator.h" | 13 #include "content/browser/frame_host/navigator.h" |
| 14 #include "content/browser/frame_host/render_frame_host_delegate.h" | 14 #include "content/browser/frame_host/render_frame_host_delegate.h" |
| 15 #include "content/browser/renderer_host/render_view_host_impl.h" | 15 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 16 #include "content/common/frame_messages.h" | 16 #include "content/common/frame_messages.h" |
| 17 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
| 18 #include "content/public/browser/content_browser_client.h" | 18 #include "content/public/browser/content_browser_client.h" |
| 19 #include "content/public/browser/dom_operation_notification_details.h" | |
| 19 #include "content/public/browser/render_process_host.h" | 20 #include "content/public/browser/render_process_host.h" |
| 20 #include "content/public/browser/render_widget_host_view.h" | 21 #include "content/public/browser/render_widget_host_view.h" |
| 21 #include "content/public/browser/user_metrics.h" | 22 #include "content/public/browser/user_metrics.h" |
| 22 #include "content/public/common/url_constants.h" | 23 #include "content/public/common/url_constants.h" |
| 23 #include "url/gurl.h" | 24 #include "url/gurl.h" |
| 24 | 25 |
| 25 namespace content { | 26 namespace content { |
| 26 | 27 |
| 27 // The (process id, routing id) pair that identifies one RenderFrame. | 28 // The (process id, routing id) pair that identifies one RenderFrame. |
| 28 typedef std::pair<int32, int32> RenderFrameHostID; | 29 typedef std::pair<int32, int32> RenderFrameHostID; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 137 IPC_MESSAGE_HANDLER(FrameHostMsg_DidRedirectProvisionalLoad, | 138 IPC_MESSAGE_HANDLER(FrameHostMsg_DidRedirectProvisionalLoad, |
| 138 OnDidRedirectProvisionalLoad) | 139 OnDidRedirectProvisionalLoad) |
| 139 IPC_MESSAGE_HANDLER(FrameHostMsg_DidFailLoadWithError, | 140 IPC_MESSAGE_HANDLER(FrameHostMsg_DidFailLoadWithError, |
| 140 OnDidFailLoadWithError) | 141 OnDidFailLoadWithError) |
| 141 IPC_MESSAGE_HANDLER_GENERIC(FrameHostMsg_DidCommitProvisionalLoad, | 142 IPC_MESSAGE_HANDLER_GENERIC(FrameHostMsg_DidCommitProvisionalLoad, |
| 142 OnNavigate(msg)) | 143 OnNavigate(msg)) |
| 143 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStartLoading, OnDidStartLoading) | 144 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStartLoading, OnDidStartLoading) |
| 144 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStopLoading, OnDidStopLoading) | 145 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStopLoading, OnDidStopLoading) |
| 145 IPC_MESSAGE_HANDLER(FrameHostMsg_SwapOut_ACK, OnSwapOutACK) | 146 IPC_MESSAGE_HANDLER(FrameHostMsg_SwapOut_ACK, OnSwapOutACK) |
| 146 IPC_MESSAGE_HANDLER(FrameHostMsg_ContextMenu, OnContextMenu) | 147 IPC_MESSAGE_HANDLER(FrameHostMsg_ContextMenu, OnContextMenu) |
| 148 IPC_MESSAGE_HANDLER(FrameHostMsg_DomOperationResponse, | |
| 149 OnDomOperationResponse) | |
| 147 IPC_END_MESSAGE_MAP_EX() | 150 IPC_END_MESSAGE_MAP_EX() |
| 148 | 151 |
| 149 if (!msg_is_ok) { | 152 if (!msg_is_ok) { |
| 150 // The message had a handler, but its de-serialization failed. | 153 // The message had a handler, but its de-serialization failed. |
| 151 // Kill the renderer. | 154 // Kill the renderer. |
| 152 RecordAction(base::UserMetricsAction("BadMessageTerminate_RFH")); | 155 RecordAction(base::UserMetricsAction("BadMessageTerminate_RFH")); |
| 153 GetProcess()->ReceivedBadMessage(); | 156 GetProcess()->ReceivedBadMessage(); |
| 154 } | 157 } |
| 155 | 158 |
| 156 return handled; | 159 return handled; |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 340 // We don't validate |unfiltered_link_url| so that this field can be used | 343 // We don't validate |unfiltered_link_url| so that this field can be used |
| 341 // when users want to copy the original link URL. | 344 // when users want to copy the original link URL. |
| 342 process->FilterURL(true, &validated_params.link_url); | 345 process->FilterURL(true, &validated_params.link_url); |
| 343 process->FilterURL(true, &validated_params.src_url); | 346 process->FilterURL(true, &validated_params.src_url); |
| 344 process->FilterURL(false, &validated_params.page_url); | 347 process->FilterURL(false, &validated_params.page_url); |
| 345 process->FilterURL(true, &validated_params.frame_url); | 348 process->FilterURL(true, &validated_params.frame_url); |
| 346 | 349 |
| 347 delegate_->ShowContextMenu(this, validated_params); | 350 delegate_->ShowContextMenu(this, validated_params); |
| 348 } | 351 } |
| 349 | 352 |
| 353 void RenderFrameHostImpl::OnDomOperationResponse(const std::string& json_string, | |
|
Charlie Reis
2014/02/15 01:47:33
Do we need to handle this message here? Maybe we
mkosiba (inactive)
2014/02/17 17:42:31
yes, that does indeed make more sense.
| |
| 354 int automation_id) { | |
| 355 delegate_->OnDomOperationResponse( | |
| 356 DomOperationNotificationDetails(json_string, automation_id)); | |
| 357 } | |
| 358 | |
| 350 void RenderFrameHostImpl::SetPendingShutdown(const base::Closure& on_swap_out) { | 359 void RenderFrameHostImpl::SetPendingShutdown(const base::Closure& on_swap_out) { |
| 351 render_view_host_->SetPendingShutdown(on_swap_out); | 360 render_view_host_->SetPendingShutdown(on_swap_out); |
| 352 } | 361 } |
| 353 | 362 |
| 354 bool RenderFrameHostImpl::CanCommitURL(const GURL& url) { | 363 bool RenderFrameHostImpl::CanCommitURL(const GURL& url) { |
| 355 // TODO(creis): We should also check for WebUI pages here. Also, when the | 364 // TODO(creis): We should also check for WebUI pages here. Also, when the |
| 356 // out-of-process iframes implementation is ready, we should check for | 365 // out-of-process iframes implementation is ready, we should check for |
| 357 // cross-site URLs that are not allowed to commit in this process. | 366 // cross-site URLs that are not allowed to commit in this process. |
| 358 | 367 |
| 359 // Give the client a chance to disallow URLs from committing. | 368 // Give the client a chance to disallow URLs from committing. |
| 360 return GetContentClient()->browser()->CanCommitURL(GetProcess(), url); | 369 return GetContentClient()->browser()->CanCommitURL(GetProcess(), url); |
| 361 } | 370 } |
| 362 | 371 |
| 363 } // namespace content | 372 } // namespace content |
| OLD | NEW |