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