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 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 2873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2884 InternalDocumentStateData::FromDocumentState(document_state); | 2884 InternalDocumentStateData::FromDocumentState(document_state); |
2885 InternalDocumentStateData* old_internal_data = | 2885 InternalDocumentStateData* old_internal_data = |
2886 InternalDocumentStateData::FromDocumentState(old_document_state); | 2886 InternalDocumentStateData::FromDocumentState(old_document_state); |
2887 internal_data->set_is_overriding_user_agent( | 2887 internal_data->set_is_overriding_user_agent( |
2888 old_internal_data->is_overriding_user_agent()); | 2888 old_internal_data->is_overriding_user_agent()); |
2889 } | 2889 } |
2890 } | 2890 } |
2891 | 2891 |
2892 // The rest of RenderView assumes that a WebDataSource will always have a | 2892 // The rest of RenderView assumes that a WebDataSource will always have a |
2893 // non-null NavigationState. | 2893 // non-null NavigationState. |
2894 UpdateNavigationState(document_state); | 2894 UpdateNavigationState(document_state, |
2895 false /* was_navigate_within_same_page */); | |
2895 | 2896 |
2896 // DocumentState::referred_by_prefetcher_ is true if we are | 2897 // DocumentState::referred_by_prefetcher_ is true if we are |
2897 // navigating from a page that used prefetching using a link on that | 2898 // navigating from a page that used prefetching using a link on that |
2898 // page. We are early enough in the request process here that we | 2899 // page. We are early enough in the request process here that we |
2899 // can still see the DocumentState of the previous page and set | 2900 // can still see the DocumentState of the previous page and set |
2900 // this value appropriately. | 2901 // this value appropriately. |
2901 // TODO(gavinp): catch the important case of navigation in a new | 2902 // TODO(gavinp): catch the important case of navigation in a new |
2902 // renderer process. | 2903 // renderer process. |
2903 if (webview) { | 2904 if (webview) { |
2904 if (WebFrame* old_frame = webview->mainFrame()) { | 2905 if (WebFrame* old_frame = webview->mainFrame()) { |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3469 DCHECK_EQ(frame_, frame); | 3470 DCHECK_EQ(frame_, frame); |
3470 // If this was a reference fragment navigation that we initiated, then we | 3471 // If this was a reference fragment navigation that we initiated, then we |
3471 // could end up having a non-null pending navigation params. We just need to | 3472 // could end up having a non-null pending navigation params. We just need to |
3472 // update the ExtraData on the datasource so that others who read the | 3473 // update the ExtraData on the datasource so that others who read the |
3473 // ExtraData will get the new NavigationState. Similarly, if we did not | 3474 // ExtraData will get the new NavigationState. Similarly, if we did not |
3474 // initiate this navigation, then we need to take care to reset any pre- | 3475 // initiate this navigation, then we need to take care to reset any pre- |
3475 // existing navigation state to a content-initiated navigation state. | 3476 // existing navigation state to a content-initiated navigation state. |
3476 // UpdateNavigationState conveniently takes care of this for us. | 3477 // UpdateNavigationState conveniently takes care of this for us. |
3477 DocumentState* document_state = | 3478 DocumentState* document_state = |
3478 DocumentState::FromDataSource(frame->dataSource()); | 3479 DocumentState::FromDataSource(frame->dataSource()); |
3479 UpdateNavigationState(document_state); | 3480 UpdateNavigationState(document_state, |
3481 true /* was_navigate_within_same_page */); | |
3480 static_cast<NavigationStateImpl*>(document_state->navigation_state()) | 3482 static_cast<NavigationStateImpl*>(document_state->navigation_state()) |
3481 ->set_was_within_same_page(true); | 3483 ->set_was_within_same_page(true); |
3482 | 3484 |
3483 didCommitProvisionalLoad(frame, item, commit_type); | 3485 didCommitProvisionalLoad(frame, item, commit_type); |
3484 } | 3486 } |
3485 | 3487 |
3486 void RenderFrameImpl::didUpdateCurrentHistoryItem() { | 3488 void RenderFrameImpl::didUpdateCurrentHistoryItem() { |
3487 render_view_->StartNavStateSyncTimerIfNecessary(this); | 3489 render_view_->StartNavStateSyncTimerIfNecessary(this); |
3488 } | 3490 } |
3489 | 3491 |
(...skipping 2399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5889 NavigationState* RenderFrameImpl::CreateNavigationStateFromPending() { | 5891 NavigationState* RenderFrameImpl::CreateNavigationStateFromPending() { |
5890 if (IsBrowserInitiated(pending_navigation_params_.get())) { | 5892 if (IsBrowserInitiated(pending_navigation_params_.get())) { |
5891 return NavigationStateImpl::CreateBrowserInitiated( | 5893 return NavigationStateImpl::CreateBrowserInitiated( |
5892 pending_navigation_params_->common_params, | 5894 pending_navigation_params_->common_params, |
5893 pending_navigation_params_->start_params, | 5895 pending_navigation_params_->start_params, |
5894 pending_navigation_params_->request_params); | 5896 pending_navigation_params_->request_params); |
5895 } | 5897 } |
5896 return NavigationStateImpl::CreateContentInitiated(); | 5898 return NavigationStateImpl::CreateContentInitiated(); |
5897 } | 5899 } |
5898 | 5900 |
5899 void RenderFrameImpl::UpdateNavigationState(DocumentState* document_state) { | 5901 void RenderFrameImpl::UpdateNavigationState( |
5902 DocumentState* document_state, | |
5903 bool was_navigate_within_same_page) { | |
Charlie Reis
2016/03/16 19:30:34
nit: was_within_same_page (to match NavigationStat
| |
5900 if (pending_navigation_params_) { | 5904 if (pending_navigation_params_) { |
5901 // If this is a browser-initiated load that doesn't override | 5905 // If this is a browser-initiated load that doesn't override |
5902 // navigation_start, set it here. | 5906 // navigation_start, set it here. |
5903 if (pending_navigation_params_->common_params.navigation_start.is_null()) { | 5907 if (pending_navigation_params_->common_params.navigation_start.is_null()) { |
5904 pending_navigation_params_->common_params.navigation_start = | 5908 pending_navigation_params_->common_params.navigation_start = |
5905 base::TimeTicks::Now(); | 5909 base::TimeTicks::Now(); |
5906 } | 5910 } |
5907 document_state->set_navigation_state(CreateNavigationStateFromPending()); | 5911 document_state->set_navigation_state(CreateNavigationStateFromPending()); |
5908 | 5912 |
5909 const CommonNavigationParams& common_params = | 5913 const CommonNavigationParams& common_params = |
5910 pending_navigation_params_->common_params; | 5914 pending_navigation_params_->common_params; |
5911 bool load_data = !common_params.base_url_for_data_url.is_empty() && | 5915 if (!was_navigate_within_same_page) { |
Charlie Reis
2016/03/16 19:30:34
This needs a comment about why in-page navigations
| |
5912 !common_params.history_url_for_data_url.is_empty() && | 5916 bool load_data = !common_params.base_url_for_data_url.is_empty() && |
5913 common_params.url.SchemeIs(url::kDataScheme); | 5917 !common_params.history_url_for_data_url.is_empty() && |
5914 document_state->set_was_load_data_with_base_url_request(load_data); | 5918 common_params.url.SchemeIs(url::kDataScheme); |
5915 if (load_data) | 5919 document_state->set_was_load_data_with_base_url_request(load_data); |
5916 document_state->set_data_url(common_params.url); | 5920 if (load_data) |
5921 document_state->set_data_url(common_params.url); | |
5922 } | |
5917 | 5923 |
5918 pending_navigation_params_.reset(); | 5924 pending_navigation_params_.reset(); |
5919 } else { | 5925 } else { |
5920 document_state->set_navigation_state( | 5926 document_state->set_navigation_state( |
5921 NavigationStateImpl::CreateContentInitiated()); | 5927 NavigationStateImpl::CreateContentInitiated()); |
5922 } | 5928 } |
5923 } | 5929 } |
5924 | 5930 |
5925 #if defined(OS_ANDROID) | 5931 #if defined(OS_ANDROID) |
5926 WebMediaPlayer* RenderFrameImpl::CreateAndroidWebMediaPlayer( | 5932 WebMediaPlayer* RenderFrameImpl::CreateAndroidWebMediaPlayer( |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6085 int match_count, | 6091 int match_count, |
6086 int ordinal, | 6092 int ordinal, |
6087 const WebRect& selection_rect, | 6093 const WebRect& selection_rect, |
6088 bool final_status_update) { | 6094 bool final_status_update) { |
6089 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, | 6095 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, |
6090 selection_rect, ordinal, | 6096 selection_rect, ordinal, |
6091 final_status_update)); | 6097 final_status_update)); |
6092 } | 6098 } |
6093 | 6099 |
6094 } // namespace content | 6100 } // namespace content |
OLD | NEW |