OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 3018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3029 | 3029 |
3030 if (IsReload(params)) | 3030 if (IsReload(params)) |
3031 document_state->set_load_type(DocumentState::RELOAD); | 3031 document_state->set_load_type(DocumentState::RELOAD); |
3032 else if (!params.state.empty()) | 3032 else if (!params.state.empty()) |
3033 document_state->set_load_type(DocumentState::HISTORY_LOAD); | 3033 document_state->set_load_type(DocumentState::HISTORY_LOAD); |
3034 else | 3034 else |
3035 document_state->set_load_type(DocumentState::NORMAL_LOAD); | 3035 document_state->set_load_type(DocumentState::NORMAL_LOAD); |
3036 | 3036 |
3037 document_state->set_referrer_policy(params.referrer.policy); | 3037 document_state->set_referrer_policy(params.referrer.policy); |
3038 document_state->set_is_overriding_user_agent(params.is_overriding_user_agent); | 3038 document_state->set_is_overriding_user_agent(params.is_overriding_user_agent); |
| 3039 document_state->set_must_reset_scroll_and_scale_state( |
| 3040 params.navigation_type == |
| 3041 ViewMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL); |
3039 } | 3042 } |
3040 | 3043 |
3041 NavigationState* RenderViewImpl::CreateNavigationStateFromPending() { | 3044 NavigationState* RenderViewImpl::CreateNavigationStateFromPending() { |
3042 const ViewMsg_Navigate_Params& params = *pending_navigation_params_.get(); | 3045 const ViewMsg_Navigate_Params& params = *pending_navigation_params_.get(); |
3043 NavigationState* navigation_state = NULL; | 3046 NavigationState* navigation_state = NULL; |
3044 | 3047 |
3045 // A navigation resulting from loading a javascript URL should not be treated | 3048 // A navigation resulting from loading a javascript URL should not be treated |
3046 // as a browser initiated event. Instead, we want it to look as if the page | 3049 // as a browser initiated event. Instead, we want it to look as if the page |
3047 // initiated any load resulting from JS execution. | 3050 // initiated any load resulting from JS execution. |
3048 if (!params.url.SchemeIs(chrome::kJavaScriptScheme)) { | 3051 if (!params.url.SchemeIs(chrome::kJavaScriptScheme)) { |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3241 | 3244 |
3242 void RenderViewImpl::didCommitProvisionalLoad(WebFrame* frame, | 3245 void RenderViewImpl::didCommitProvisionalLoad(WebFrame* frame, |
3243 bool is_new_navigation) { | 3246 bool is_new_navigation) { |
3244 DocumentState* document_state = | 3247 DocumentState* document_state = |
3245 DocumentState::FromDataSource(frame->dataSource()); | 3248 DocumentState::FromDataSource(frame->dataSource()); |
3246 NavigationState* navigation_state = document_state->navigation_state(); | 3249 NavigationState* navigation_state = document_state->navigation_state(); |
3247 | 3250 |
3248 if (document_state->commit_load_time().is_null()) | 3251 if (document_state->commit_load_time().is_null()) |
3249 document_state->set_commit_load_time(Time::Now()); | 3252 document_state->set_commit_load_time(Time::Now()); |
3250 | 3253 |
| 3254 if (document_state->must_reset_scroll_and_scale_state()) { |
| 3255 webview()->resetScrollAndScaleState(); |
| 3256 document_state->set_must_reset_scroll_and_scale_state(false); |
| 3257 } |
| 3258 |
3251 if (is_new_navigation) { | 3259 if (is_new_navigation) { |
3252 // When we perform a new navigation, we need to update the last committed | 3260 // When we perform a new navigation, we need to update the last committed |
3253 // session history entry with state for the page we are leaving. | 3261 // session history entry with state for the page we are leaving. |
3254 UpdateSessionHistory(frame); | 3262 UpdateSessionHistory(frame); |
3255 | 3263 |
3256 // We bump our Page ID to correspond with the new session history entry. | 3264 // We bump our Page ID to correspond with the new session history entry. |
3257 page_id_ = next_page_id_++; | 3265 page_id_ = next_page_id_++; |
3258 | 3266 |
3259 // Don't update history_page_ids_ (etc) for content::kSwappedOutURL, since | 3267 // Don't update history_page_ids_ (etc) for content::kSwappedOutURL, since |
3260 // we don't want to forget the entry that was there, and since we will | 3268 // we don't want to forget the entry that was there, and since we will |
(...skipping 2897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6158 | 6166 |
6159 updating_frame_tree_ = true; | 6167 updating_frame_tree_ = true; |
6160 active_frame_id_map_.clear(); | 6168 active_frame_id_map_.clear(); |
6161 | 6169 |
6162 target_process_id_ = process_id; | 6170 target_process_id_ = process_id; |
6163 target_routing_id_ = route_id; | 6171 target_routing_id_ = route_id; |
6164 CreateFrameTree(webview()->mainFrame(), frames); | 6172 CreateFrameTree(webview()->mainFrame(), frames); |
6165 | 6173 |
6166 updating_frame_tree_ = false; | 6174 updating_frame_tree_ = false; |
6167 } | 6175 } |
OLD | NEW |