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/renderer/render_frame_impl.h" | 5 #include "content/renderer/render_frame_impl.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 2672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2683 !navigation_state->start_params().should_replace_current_entry) { | 2683 !navigation_state->start_params().should_replace_current_entry) { |
2684 // Advance our offset in session history, applying the length limit. | 2684 // Advance our offset in session history, applying the length limit. |
2685 // There is now no forward history. | 2685 // There is now no forward history. |
2686 render_view_->history_list_offset_++; | 2686 render_view_->history_list_offset_++; |
2687 if (render_view_->history_list_offset_ >= kMaxSessionHistoryEntries) | 2687 if (render_view_->history_list_offset_ >= kMaxSessionHistoryEntries) |
2688 render_view_->history_list_offset_ = kMaxSessionHistoryEntries - 1; | 2688 render_view_->history_list_offset_ = kMaxSessionHistoryEntries - 1; |
2689 render_view_->history_list_length_ = | 2689 render_view_->history_list_length_ = |
2690 render_view_->history_list_offset_ + 1; | 2690 render_view_->history_list_offset_ + 1; |
2691 } | 2691 } |
2692 } else { | 2692 } else { |
2693 // Inspect the navigation_state on this frame to see if the navigation | 2693 if (navigation_state->request_params().page_id != -1) { |
2694 // corresponds to a session history navigation... Note: |frame| may or | |
2695 // may not be the toplevel frame, but for the case of capturing session | |
2696 // history, the first committed frame suffices. We keep track of whether | |
2697 // we've seen this commit before so that only capture session history once | |
2698 // per navigation. | |
2699 // | |
2700 // Note that we need to check if the page ID changed. In the case of a | |
2701 // reload, the page ID doesn't change, and UpdateSessionHistory gets the | |
2702 // previous URL and the current page ID, which would be wrong. | |
2703 if (navigation_state->request_params().page_id != -1 && | |
2704 navigation_state->request_params().page_id != render_view_->page_id_) { | |
2705 // This is a successful session history navigation! | 2694 // This is a successful session history navigation! |
2706 render_view_->page_id_ = navigation_state->request_params().page_id; | 2695 render_view_->page_id_ = navigation_state->request_params().page_id; |
2707 | 2696 |
2708 render_view_->history_list_offset_ = | 2697 render_view_->history_list_offset_ = |
2709 navigation_state->request_params().pending_history_list_offset; | 2698 navigation_state->request_params().pending_history_list_offset; |
2710 } | 2699 } |
2711 } | 2700 } |
2712 | 2701 |
2713 bool sent = Send( | 2702 bool sent = Send( |
2714 new FrameHostMsg_DidAssignPageId(routing_id_, render_view_->page_id_)); | 2703 new FrameHostMsg_DidAssignPageId(routing_id_, render_view_->page_id_)); |
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3861 DocumentState* document_state = DocumentState::FromDataSource(ds); | 3850 DocumentState* document_state = DocumentState::FromDataSource(ds); |
3862 NavigationStateImpl* navigation_state = | 3851 NavigationStateImpl* navigation_state = |
3863 static_cast<NavigationStateImpl*>(document_state->navigation_state()); | 3852 static_cast<NavigationStateImpl*>(document_state->navigation_state()); |
3864 InternalDocumentStateData* internal_data = | 3853 InternalDocumentStateData* internal_data = |
3865 InternalDocumentStateData::FromDocumentState(document_state); | 3854 InternalDocumentStateData::FromDocumentState(document_state); |
3866 | 3855 |
3867 FrameHostMsg_DidCommitProvisionalLoad_Params params; | 3856 FrameHostMsg_DidCommitProvisionalLoad_Params params; |
3868 params.http_status_code = response.httpStatusCode(); | 3857 params.http_status_code = response.httpStatusCode(); |
3869 params.url_is_unreachable = ds->hasUnreachableURL(); | 3858 params.url_is_unreachable = ds->hasUnreachableURL(); |
3870 params.is_post = false; | 3859 params.is_post = false; |
| 3860 params.intended_as_new_entry = |
| 3861 navigation_state->request_params().intended_as_new_entry; |
| 3862 params.did_create_new_entry = commit_type == blink::WebStandardCommit; |
3871 params.post_id = -1; | 3863 params.post_id = -1; |
3872 params.page_id = render_view_->page_id_; | 3864 params.page_id = render_view_->page_id_; |
| 3865 params.nav_entry_id = navigation_state->request_params().nav_entry_id; |
3873 // We need to track the RenderViewHost routing_id because of downstream | 3866 // We need to track the RenderViewHost routing_id because of downstream |
3874 // dependencies (crbug.com/392171 DownloadRequestHandle, SaveFileManager, | 3867 // dependencies (crbug.com/392171 DownloadRequestHandle, SaveFileManager, |
3875 // ResourceDispatcherHostImpl, MediaStreamUIProxy, | 3868 // ResourceDispatcherHostImpl, MediaStreamUIProxy, |
3876 // SpeechRecognitionDispatcherHost and possibly others). They look up the view | 3869 // SpeechRecognitionDispatcherHost and possibly others). They look up the view |
3877 // based on the ID stored in the resource requests. Once those dependencies | 3870 // based on the ID stored in the resource requests. Once those dependencies |
3878 // are unwound or moved to RenderFrameHost (crbug.com/304341) we can move the | 3871 // are unwound or moved to RenderFrameHost (crbug.com/304341) we can move the |
3879 // client to be based on the routing_id of the RenderFrameHost. | 3872 // client to be based on the routing_id of the RenderFrameHost. |
3880 params.render_view_routing_id = render_view_->routing_id(); | 3873 params.render_view_routing_id = render_view_->routing_id(); |
3881 params.socket_address.set_host(response.remoteIPAddress().utf8()); | 3874 params.socket_address.set_host(response.remoteIPAddress().utf8()); |
3882 params.socket_address.set_port(response.remotePort()); | 3875 params.socket_address.set_port(response.remotePort()); |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4466 if (reload_original_url) | 4459 if (reload_original_url) |
4467 frame_->reloadWithOverrideURL(common_params.url, true); | 4460 frame_->reloadWithOverrideURL(common_params.url, true); |
4468 else | 4461 else |
4469 frame_->reload(ignore_cache); | 4462 frame_->reload(ignore_cache); |
4470 } else if (is_history_navigation && !browser_side_navigation) { | 4463 } else if (is_history_navigation && !browser_side_navigation) { |
4471 // TODO(clamy): adapt this code for PlzNavigate. In particular the stream | 4464 // TODO(clamy): adapt this code for PlzNavigate. In particular the stream |
4472 // override should be given to the generated request. | 4465 // override should be given to the generated request. |
4473 | 4466 |
4474 // We must know the page ID of the page we are navigating back to. | 4467 // We must know the page ID of the page we are navigating back to. |
4475 DCHECK_NE(request_params.page_id, -1); | 4468 DCHECK_NE(request_params.page_id, -1); |
| 4469 // We must know the nav entry ID of the page we are navigating back to, |
| 4470 // which should be the case because history navigations are routed via the |
| 4471 // browser. |
| 4472 DCHECK_NE(0, request_params.nav_entry_id); |
4476 scoped_ptr<HistoryEntry> entry = | 4473 scoped_ptr<HistoryEntry> entry = |
4477 PageStateToHistoryEntry(request_params.page_state); | 4474 PageStateToHistoryEntry(request_params.page_state); |
4478 if (entry) { | 4475 if (entry) { |
4479 // Ensure we didn't save the swapped out URL in UpdateState, since the | 4476 // Ensure we didn't save the swapped out URL in UpdateState, since the |
4480 // browser should never be telling us to navigate to swappedout://. | 4477 // browser should never be telling us to navigate to swappedout://. |
4481 CHECK(entry->root().urlString() != WebString::fromUTF8(kSwappedOutURL)); | 4478 CHECK(entry->root().urlString() != WebString::fromUTF8(kSwappedOutURL)); |
4482 scoped_ptr<NavigationParams> navigation_params( | 4479 scoped_ptr<NavigationParams> navigation_params( |
4483 new NavigationParams(*pending_navigation_params_.get())); | 4480 new NavigationParams(*pending_navigation_params_.get())); |
4484 render_view_->history_controller()->GoToEntry( | 4481 render_view_->history_controller()->GoToEntry( |
4485 entry.Pass(), navigation_params.Pass(), cache_policy); | 4482 entry.Pass(), navigation_params.Pass(), cache_policy); |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4937 #elif defined(ENABLE_BROWSER_CDMS) | 4934 #elif defined(ENABLE_BROWSER_CDMS) |
4938 cdm_manager_, | 4935 cdm_manager_, |
4939 #endif | 4936 #endif |
4940 this); | 4937 this); |
4941 } | 4938 } |
4942 | 4939 |
4943 return cdm_factory_; | 4940 return cdm_factory_; |
4944 } | 4941 } |
4945 | 4942 |
4946 } // namespace content | 4943 } // namespace content |
OLD | NEW |