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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/containers/hash_tables.h" | 8 #include "base/containers/hash_tables.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/metrics/user_metrics_action.h" | 10 #include "base/metrics/user_metrics_action.h" |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 IPC_MESSAGE_HANDLER(FrameHostMsg_DidFailProvisionalLoadWithError, | 271 IPC_MESSAGE_HANDLER(FrameHostMsg_DidFailProvisionalLoadWithError, |
272 OnDidFailProvisionalLoadWithError) | 272 OnDidFailProvisionalLoadWithError) |
273 IPC_MESSAGE_HANDLER(FrameHostMsg_DidRedirectProvisionalLoad, | 273 IPC_MESSAGE_HANDLER(FrameHostMsg_DidRedirectProvisionalLoad, |
274 OnDidRedirectProvisionalLoad) | 274 OnDidRedirectProvisionalLoad) |
275 IPC_MESSAGE_HANDLER(FrameHostMsg_DidFailLoadWithError, | 275 IPC_MESSAGE_HANDLER(FrameHostMsg_DidFailLoadWithError, |
276 OnDidFailLoadWithError) | 276 OnDidFailLoadWithError) |
277 IPC_MESSAGE_HANDLER_GENERIC(FrameHostMsg_DidCommitProvisionalLoad, | 277 IPC_MESSAGE_HANDLER_GENERIC(FrameHostMsg_DidCommitProvisionalLoad, |
278 OnNavigate(msg)) | 278 OnNavigate(msg)) |
279 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStartLoading, OnDidStartLoading) | 279 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStartLoading, OnDidStartLoading) |
280 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStopLoading, OnDidStopLoading) | 280 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStopLoading, OnDidStopLoading) |
| 281 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeLoadProgress, |
| 282 OnDidChangeLoadProgress) |
281 IPC_MESSAGE_HANDLER(FrameHostMsg_OpenURL, OnOpenURL) | 283 IPC_MESSAGE_HANDLER(FrameHostMsg_OpenURL, OnOpenURL) |
282 IPC_MESSAGE_HANDLER(FrameHostMsg_BeforeUnload_ACK, OnBeforeUnloadACK) | 284 IPC_MESSAGE_HANDLER(FrameHostMsg_BeforeUnload_ACK, OnBeforeUnloadACK) |
283 IPC_MESSAGE_HANDLER(FrameHostMsg_SwapOut_ACK, OnSwapOutACK) | 285 IPC_MESSAGE_HANDLER(FrameHostMsg_SwapOut_ACK, OnSwapOutACK) |
284 IPC_MESSAGE_HANDLER(FrameHostMsg_ContextMenu, OnContextMenu) | 286 IPC_MESSAGE_HANDLER(FrameHostMsg_ContextMenu, OnContextMenu) |
285 IPC_MESSAGE_HANDLER(FrameHostMsg_JavaScriptExecuteResponse, | 287 IPC_MESSAGE_HANDLER(FrameHostMsg_JavaScriptExecuteResponse, |
286 OnJavaScriptExecuteResponse) | 288 OnJavaScriptExecuteResponse) |
287 IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunJavaScriptMessage, | 289 IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunJavaScriptMessage, |
288 OnRunJavaScriptMessage) | 290 OnRunJavaScriptMessage) |
289 IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunBeforeUnloadConfirm, | 291 IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunBeforeUnloadConfirm, |
290 OnRunBeforeUnloadConfirm) | 292 OnRunBeforeUnloadConfirm) |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 Send(new FrameMsg_SwapOut(routing_id_)); | 505 Send(new FrameMsg_SwapOut(routing_id_)); |
504 | 506 |
505 if (!GetParent()) | 507 if (!GetParent()) |
506 delegate_->SwappedOut(this); | 508 delegate_->SwappedOut(this); |
507 | 509 |
508 // Allow the navigation to proceed. | 510 // Allow the navigation to proceed. |
509 frame_tree_node_->render_manager()->SwappedOut(this); | 511 frame_tree_node_->render_manager()->SwappedOut(this); |
510 } | 512 } |
511 | 513 |
512 void RenderFrameHostImpl::OnDidStartLoading(bool to_different_document) { | 514 void RenderFrameHostImpl::OnDidStartLoading(bool to_different_document) { |
513 delegate_->DidStartLoading(this, to_different_document); | 515 frame_tree_node_->navigator()->DidStartLoading(this, to_different_document); |
514 } | 516 } |
515 | 517 |
516 void RenderFrameHostImpl::OnDidStopLoading() { | 518 void RenderFrameHostImpl::OnDidStopLoading() { |
517 delegate_->DidStopLoading(this); | 519 frame_tree_node_->navigator()->DidStopLoading(this); |
| 520 } |
| 521 |
| 522 void RenderFrameHostImpl::OnDidChangeLoadProgress(double load_progress) { |
| 523 frame_tree_node_->navigator()->DidChangeLoadProgress(this, load_progress); |
518 } | 524 } |
519 | 525 |
520 void RenderFrameHostImpl::OnBeforeUnloadACK( | 526 void RenderFrameHostImpl::OnBeforeUnloadACK( |
521 bool proceed, | 527 bool proceed, |
522 const base::TimeTicks& renderer_before_unload_start_time, | 528 const base::TimeTicks& renderer_before_unload_start_time, |
523 const base::TimeTicks& renderer_before_unload_end_time) { | 529 const base::TimeTicks& renderer_before_unload_end_time) { |
524 // TODO(creis): Support properly beforeunload on subframes. For now just | 530 // TODO(creis): Support properly beforeunload on subframes. For now just |
525 // pretend that the handler ran and allowed the navigation to proceed. | 531 // pretend that the handler ran and allowed the navigation to proceed. |
526 if (GetParent()) { | 532 if (GetParent()) { |
527 render_view_host_->is_waiting_for_beforeunload_ack_ = false; | 533 render_view_host_->is_waiting_for_beforeunload_ack_ = false; |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 // browser. But we want to keep the throbber in sync with what's happening | 748 // browser. But we want to keep the throbber in sync with what's happening |
743 // in the UI. For example, we want to start throbbing immediately when the | 749 // in the UI. For example, we want to start throbbing immediately when the |
744 // user naivgates even if the renderer is delayed. There is also an issue | 750 // user naivgates even if the renderer is delayed. There is also an issue |
745 // with the throbber starting because the WebUI (which controls whether the | 751 // with the throbber starting because the WebUI (which controls whether the |
746 // favicon is displayed) happens synchronously. If the start loading | 752 // favicon is displayed) happens synchronously. If the start loading |
747 // messages was asynchronous, then the default favicon would flash in. | 753 // messages was asynchronous, then the default favicon would flash in. |
748 // | 754 // |
749 // Blink doesn't send throb notifications for JavaScript URLs, so we | 755 // Blink doesn't send throb notifications for JavaScript URLs, so we |
750 // don't want to either. | 756 // don't want to either. |
751 if (!params.url.SchemeIs(kJavaScriptScheme)) | 757 if (!params.url.SchemeIs(kJavaScriptScheme)) |
752 delegate_->DidStartLoading(this, true); | 758 OnDidStartLoading(true); |
753 } | 759 } |
754 | 760 |
755 void RenderFrameHostImpl::NavigateToURL(const GURL& url) { | 761 void RenderFrameHostImpl::NavigateToURL(const GURL& url) { |
756 FrameMsg_Navigate_Params params; | 762 FrameMsg_Navigate_Params params; |
757 params.page_id = -1; | 763 params.page_id = -1; |
758 params.pending_history_list_offset = -1; | 764 params.pending_history_list_offset = -1; |
759 params.current_history_list_offset = -1; | 765 params.current_history_list_offset = -1; |
760 params.current_history_list_length = 0; | 766 params.current_history_list_length = 0; |
761 params.url = url; | 767 params.url = url; |
762 params.transition = PAGE_TRANSITION_LINK; | 768 params.transition = PAGE_TRANSITION_LINK; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 cancel_notification_callbacks_.erase(notification_id); | 856 cancel_notification_callbacks_.erase(notification_id); |
851 } | 857 } |
852 | 858 |
853 void RenderFrameHostImpl::DesktopNotificationPermissionRequestDone( | 859 void RenderFrameHostImpl::DesktopNotificationPermissionRequestDone( |
854 int callback_context) { | 860 int callback_context) { |
855 Send(new DesktopNotificationMsg_PermissionRequestDone( | 861 Send(new DesktopNotificationMsg_PermissionRequestDone( |
856 routing_id_, callback_context)); | 862 routing_id_, callback_context)); |
857 } | 863 } |
858 | 864 |
859 } // namespace content | 865 } // namespace content |
OLD | NEW |