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, false /* was_within_same_page */); |
2895 | 2895 |
2896 // DocumentState::referred_by_prefetcher_ is true if we are | 2896 // DocumentState::referred_by_prefetcher_ is true if we are |
2897 // navigating from a page that used prefetching using a link on that | 2897 // 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 | 2898 // page. We are early enough in the request process here that we |
2899 // can still see the DocumentState of the previous page and set | 2899 // can still see the DocumentState of the previous page and set |
2900 // this value appropriately. | 2900 // this value appropriately. |
2901 // TODO(gavinp): catch the important case of navigation in a new | 2901 // TODO(gavinp): catch the important case of navigation in a new |
2902 // renderer process. | 2902 // renderer process. |
2903 if (webview) { | 2903 if (webview) { |
2904 if (WebFrame* old_frame = webview->mainFrame()) { | 2904 if (WebFrame* old_frame = webview->mainFrame()) { |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3469 DCHECK_EQ(frame_, frame); | 3469 DCHECK_EQ(frame_, frame); |
3470 // If this was a reference fragment navigation that we initiated, then we | 3470 // 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 | 3471 // 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 | 3472 // update the ExtraData on the datasource so that others who read the |
3473 // ExtraData will get the new NavigationState. Similarly, if we did not | 3473 // 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- | 3474 // initiate this navigation, then we need to take care to reset any pre- |
3475 // existing navigation state to a content-initiated navigation state. | 3475 // existing navigation state to a content-initiated navigation state. |
3476 // UpdateNavigationState conveniently takes care of this for us. | 3476 // UpdateNavigationState conveniently takes care of this for us. |
3477 DocumentState* document_state = | 3477 DocumentState* document_state = |
3478 DocumentState::FromDataSource(frame->dataSource()); | 3478 DocumentState::FromDataSource(frame->dataSource()); |
3479 UpdateNavigationState(document_state); | 3479 UpdateNavigationState(document_state, true /* was_within_same_page */); |
3480 static_cast<NavigationStateImpl*>(document_state->navigation_state()) | 3480 static_cast<NavigationStateImpl*>(document_state->navigation_state()) |
3481 ->set_was_within_same_page(true); | 3481 ->set_was_within_same_page(true); |
3482 | 3482 |
3483 didCommitProvisionalLoad(frame, item, commit_type); | 3483 didCommitProvisionalLoad(frame, item, commit_type); |
3484 } | 3484 } |
3485 | 3485 |
3486 void RenderFrameImpl::didUpdateCurrentHistoryItem() { | 3486 void RenderFrameImpl::didUpdateCurrentHistoryItem() { |
3487 render_view_->StartNavStateSyncTimerIfNecessary(this); | 3487 render_view_->StartNavStateSyncTimerIfNecessary(this); |
3488 } | 3488 } |
3489 | 3489 |
(...skipping 2382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5872 NavigationState* RenderFrameImpl::CreateNavigationStateFromPending() { | 5872 NavigationState* RenderFrameImpl::CreateNavigationStateFromPending() { |
5873 if (IsBrowserInitiated(pending_navigation_params_.get())) { | 5873 if (IsBrowserInitiated(pending_navigation_params_.get())) { |
5874 return NavigationStateImpl::CreateBrowserInitiated( | 5874 return NavigationStateImpl::CreateBrowserInitiated( |
5875 pending_navigation_params_->common_params, | 5875 pending_navigation_params_->common_params, |
5876 pending_navigation_params_->start_params, | 5876 pending_navigation_params_->start_params, |
5877 pending_navigation_params_->request_params); | 5877 pending_navigation_params_->request_params); |
5878 } | 5878 } |
5879 return NavigationStateImpl::CreateContentInitiated(); | 5879 return NavigationStateImpl::CreateContentInitiated(); |
5880 } | 5880 } |
5881 | 5881 |
5882 void RenderFrameImpl::UpdateNavigationState(DocumentState* document_state) { | 5882 void RenderFrameImpl::UpdateNavigationState(DocumentState* document_state, |
| 5883 bool was_within_same_page) { |
5883 if (pending_navigation_params_) { | 5884 if (pending_navigation_params_) { |
5884 // If this is a browser-initiated load that doesn't override | 5885 // If this is a browser-initiated load that doesn't override |
5885 // navigation_start, set it here. | 5886 // navigation_start, set it here. |
5886 if (pending_navigation_params_->common_params.navigation_start.is_null()) { | 5887 if (pending_navigation_params_->common_params.navigation_start.is_null()) { |
5887 pending_navigation_params_->common_params.navigation_start = | 5888 pending_navigation_params_->common_params.navigation_start = |
5888 base::TimeTicks::Now(); | 5889 base::TimeTicks::Now(); |
5889 } | 5890 } |
5890 document_state->set_navigation_state(CreateNavigationStateFromPending()); | 5891 document_state->set_navigation_state(CreateNavigationStateFromPending()); |
5891 | 5892 |
5892 const CommonNavigationParams& common_params = | 5893 const CommonNavigationParams& common_params = |
5893 pending_navigation_params_->common_params; | 5894 pending_navigation_params_->common_params; |
5894 bool load_data = !common_params.base_url_for_data_url.is_empty() && | 5895 // The |set_was_load_data_with_base_url_request| state should not change for |
5895 !common_params.history_url_for_data_url.is_empty() && | 5896 // an in-page navigation, so skip updating it from the in-page navigation |
5896 common_params.url.SchemeIs(url::kDataScheme); | 5897 // params in this case. |
5897 document_state->set_was_load_data_with_base_url_request(load_data); | 5898 if (!was_within_same_page) { |
5898 if (load_data) | 5899 bool load_data = !common_params.base_url_for_data_url.is_empty() && |
5899 document_state->set_data_url(common_params.url); | 5900 !common_params.history_url_for_data_url.is_empty() && |
| 5901 common_params.url.SchemeIs(url::kDataScheme); |
| 5902 document_state->set_was_load_data_with_base_url_request(load_data); |
| 5903 if (load_data) |
| 5904 document_state->set_data_url(common_params.url); |
| 5905 } |
5900 | 5906 |
5901 pending_navigation_params_.reset(); | 5907 pending_navigation_params_.reset(); |
5902 } else { | 5908 } else { |
5903 document_state->set_navigation_state( | 5909 document_state->set_navigation_state( |
5904 NavigationStateImpl::CreateContentInitiated()); | 5910 NavigationStateImpl::CreateContentInitiated()); |
5905 } | 5911 } |
5906 } | 5912 } |
5907 | 5913 |
5908 #if defined(OS_ANDROID) | 5914 #if defined(OS_ANDROID) |
5909 WebMediaPlayer* RenderFrameImpl::CreateAndroidWebMediaPlayer( | 5915 WebMediaPlayer* RenderFrameImpl::CreateAndroidWebMediaPlayer( |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6068 int match_count, | 6074 int match_count, |
6069 int ordinal, | 6075 int ordinal, |
6070 const WebRect& selection_rect, | 6076 const WebRect& selection_rect, |
6071 bool final_status_update) { | 6077 bool final_status_update) { |
6072 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, | 6078 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, |
6073 selection_rect, ordinal, | 6079 selection_rect, ordinal, |
6074 final_status_update)); | 6080 final_status_update)); |
6075 } | 6081 } |
6076 | 6082 |
6077 } // namespace content | 6083 } // namespace content |
OLD | NEW |