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 2580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2591 !navigation_state->start_params().should_replace_current_entry) { | 2591 !navigation_state->start_params().should_replace_current_entry) { |
2592 // Advance our offset in session history, applying the length limit. | 2592 // Advance our offset in session history, applying the length limit. |
2593 // There is now no forward history. | 2593 // There is now no forward history. |
2594 render_view_->history_list_offset_++; | 2594 render_view_->history_list_offset_++; |
2595 if (render_view_->history_list_offset_ >= kMaxSessionHistoryEntries) | 2595 if (render_view_->history_list_offset_ >= kMaxSessionHistoryEntries) |
2596 render_view_->history_list_offset_ = kMaxSessionHistoryEntries - 1; | 2596 render_view_->history_list_offset_ = kMaxSessionHistoryEntries - 1; |
2597 render_view_->history_list_length_ = | 2597 render_view_->history_list_length_ = |
2598 render_view_->history_list_offset_ + 1; | 2598 render_view_->history_list_offset_ + 1; |
2599 } | 2599 } |
2600 } else { | 2600 } else { |
2601 if (navigation_state->request_params().page_id != -1) { | 2601 // Inspect the navigation_state on this frame to see if the navigation |
| 2602 // corresponds to a session history navigation... Note: |frame| may or |
| 2603 // may not be the toplevel frame, but for the case of capturing session |
| 2604 // history, the first committed frame suffices. We keep track of whether |
| 2605 // we've seen this commit before so that only capture session history once |
| 2606 // per navigation. |
| 2607 // |
| 2608 // Note that we need to check if the page ID changed. In the case of a |
| 2609 // reload, the page ID doesn't change, and UpdateSessionHistory gets the |
| 2610 // previous URL and the current page ID, which would be wrong. |
| 2611 if (navigation_state->request_params().page_id != -1 && |
| 2612 navigation_state->request_params().page_id != render_view_->page_id_) { |
2602 // This is a successful session history navigation! | 2613 // This is a successful session history navigation! |
2603 render_view_->page_id_ = navigation_state->request_params().page_id; | 2614 render_view_->page_id_ = navigation_state->request_params().page_id; |
2604 | 2615 |
2605 render_view_->history_list_offset_ = | 2616 render_view_->history_list_offset_ = |
2606 navigation_state->request_params().pending_history_list_offset; | 2617 navigation_state->request_params().pending_history_list_offset; |
2607 } | 2618 } |
2608 } | 2619 } |
2609 | 2620 |
2610 bool sent = Send( | 2621 bool sent = Send( |
2611 new FrameHostMsg_DidAssignPageId(routing_id_, render_view_->page_id_)); | 2622 new FrameHostMsg_DidAssignPageId(routing_id_, render_view_->page_id_)); |
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3749 DocumentState* document_state = DocumentState::FromDataSource(ds); | 3760 DocumentState* document_state = DocumentState::FromDataSource(ds); |
3750 NavigationStateImpl* navigation_state = | 3761 NavigationStateImpl* navigation_state = |
3751 static_cast<NavigationStateImpl*>(document_state->navigation_state()); | 3762 static_cast<NavigationStateImpl*>(document_state->navigation_state()); |
3752 InternalDocumentStateData* internal_data = | 3763 InternalDocumentStateData* internal_data = |
3753 InternalDocumentStateData::FromDocumentState(document_state); | 3764 InternalDocumentStateData::FromDocumentState(document_state); |
3754 | 3765 |
3755 FrameHostMsg_DidCommitProvisionalLoad_Params params; | 3766 FrameHostMsg_DidCommitProvisionalLoad_Params params; |
3756 params.http_status_code = response.httpStatusCode(); | 3767 params.http_status_code = response.httpStatusCode(); |
3757 params.url_is_unreachable = ds->hasUnreachableURL(); | 3768 params.url_is_unreachable = ds->hasUnreachableURL(); |
3758 params.is_post = false; | 3769 params.is_post = false; |
3759 params.intended_as_new_entry = | |
3760 navigation_state->request_params().intended_as_new_entry; | |
3761 params.did_create_new_entry = commit_type == blink::WebStandardCommit; | |
3762 params.post_id = -1; | 3770 params.post_id = -1; |
3763 params.page_id = render_view_->page_id_; | 3771 params.page_id = render_view_->page_id_; |
3764 params.nav_entry_id = navigation_state->request_params().nav_entry_id; | |
3765 // We need to track the RenderViewHost routing_id because of downstream | 3772 // We need to track the RenderViewHost routing_id because of downstream |
3766 // dependencies (crbug.com/392171 DownloadRequestHandle, SaveFileManager, | 3773 // dependencies (crbug.com/392171 DownloadRequestHandle, SaveFileManager, |
3767 // ResourceDispatcherHostImpl, MediaStreamUIProxy, | 3774 // ResourceDispatcherHostImpl, MediaStreamUIProxy, |
3768 // SpeechRecognitionDispatcherHost and possibly others). They look up the view | 3775 // SpeechRecognitionDispatcherHost and possibly others). They look up the view |
3769 // based on the ID stored in the resource requests. Once those dependencies | 3776 // based on the ID stored in the resource requests. Once those dependencies |
3770 // are unwound or moved to RenderFrameHost (crbug.com/304341) we can move the | 3777 // are unwound or moved to RenderFrameHost (crbug.com/304341) we can move the |
3771 // client to be based on the routing_id of the RenderFrameHost. | 3778 // client to be based on the routing_id of the RenderFrameHost. |
3772 params.render_view_routing_id = render_view_->routing_id(); | 3779 params.render_view_routing_id = render_view_->routing_id(); |
3773 params.socket_address.set_host(response.remoteIPAddress().utf8()); | 3780 params.socket_address.set_host(response.remoteIPAddress().utf8()); |
3774 params.socket_address.set_port(response.remotePort()); | 3781 params.socket_address.set_port(response.remotePort()); |
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4360 if (reload_original_url) | 4367 if (reload_original_url) |
4361 frame_->reloadWithOverrideURL(common_params.url, true); | 4368 frame_->reloadWithOverrideURL(common_params.url, true); |
4362 else | 4369 else |
4363 frame_->reload(ignore_cache); | 4370 frame_->reload(ignore_cache); |
4364 } else if (is_history_navigation && !browser_side_navigation) { | 4371 } else if (is_history_navigation && !browser_side_navigation) { |
4365 // TODO(clamy): adapt this code for PlzNavigate. In particular the stream | 4372 // TODO(clamy): adapt this code for PlzNavigate. In particular the stream |
4366 // override should be given to the generated request. | 4373 // override should be given to the generated request. |
4367 | 4374 |
4368 // We must know the page ID of the page we are navigating back to. | 4375 // We must know the page ID of the page we are navigating back to. |
4369 DCHECK_NE(request_params.page_id, -1); | 4376 DCHECK_NE(request_params.page_id, -1); |
4370 // We must know the nav entry ID of the page we are navigating back to, | |
4371 // which should be the case because history navigations are routed via the | |
4372 // browser. | |
4373 DCHECK_NE(0, request_params.nav_entry_id); | |
4374 scoped_ptr<HistoryEntry> entry = | 4377 scoped_ptr<HistoryEntry> entry = |
4375 PageStateToHistoryEntry(request_params.page_state); | 4378 PageStateToHistoryEntry(request_params.page_state); |
4376 if (entry) { | 4379 if (entry) { |
4377 // Ensure we didn't save the swapped out URL in UpdateState, since the | 4380 // Ensure we didn't save the swapped out URL in UpdateState, since the |
4378 // browser should never be telling us to navigate to swappedout://. | 4381 // browser should never be telling us to navigate to swappedout://. |
4379 CHECK(entry->root().urlString() != WebString::fromUTF8(kSwappedOutURL)); | 4382 CHECK(entry->root().urlString() != WebString::fromUTF8(kSwappedOutURL)); |
4380 scoped_ptr<NavigationParams> navigation_params( | 4383 scoped_ptr<NavigationParams> navigation_params( |
4381 new NavigationParams(*pending_navigation_params_.get())); | 4384 new NavigationParams(*pending_navigation_params_.get())); |
4382 render_view_->history_controller()->GoToEntry( | 4385 render_view_->history_controller()->GoToEntry( |
4383 entry.Pass(), navigation_params.Pass(), cache_policy); | 4386 entry.Pass(), navigation_params.Pass(), cache_policy); |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4835 #elif defined(ENABLE_BROWSER_CDMS) | 4838 #elif defined(ENABLE_BROWSER_CDMS) |
4836 cdm_manager_, | 4839 cdm_manager_, |
4837 #endif | 4840 #endif |
4838 this); | 4841 this); |
4839 } | 4842 } |
4840 | 4843 |
4841 return cdm_factory_; | 4844 return cdm_factory_; |
4842 } | 4845 } |
4843 | 4846 |
4844 } // namespace content | 4847 } // namespace content |
OLD | NEW |