Chromium Code Reviews| 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 2963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2974 | 2974 |
| 2975 if (IsReload(params)) | 2975 if (IsReload(params)) |
| 2976 document_state->set_load_type(DocumentState::RELOAD); | 2976 document_state->set_load_type(DocumentState::RELOAD); |
| 2977 else if (!params.state.empty()) | 2977 else if (!params.state.empty()) |
| 2978 document_state->set_load_type(DocumentState::HISTORY_LOAD); | 2978 document_state->set_load_type(DocumentState::HISTORY_LOAD); |
| 2979 else | 2979 else |
| 2980 document_state->set_load_type(DocumentState::NORMAL_LOAD); | 2980 document_state->set_load_type(DocumentState::NORMAL_LOAD); |
| 2981 | 2981 |
| 2982 document_state->set_referrer_policy(params.referrer.policy); | 2982 document_state->set_referrer_policy(params.referrer.policy); |
| 2983 document_state->set_is_overriding_user_agent(params.is_overriding_user_agent); | 2983 document_state->set_is_overriding_user_agent(params.is_overriding_user_agent); |
| 2984 document_state->set_must_reset_scroll_and_scale_state( | |
| 2985 ViewMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL == | |
|
darin (slow to review)
2012/08/30 16:56:11
nit: we generally favor the "variable == constant"
| |
| 2986 params.navigation_type); | |
| 2984 } | 2987 } |
| 2985 | 2988 |
| 2986 NavigationState* RenderViewImpl::CreateNavigationStateFromPending() { | 2989 NavigationState* RenderViewImpl::CreateNavigationStateFromPending() { |
| 2987 const ViewMsg_Navigate_Params& params = *pending_navigation_params_.get(); | 2990 const ViewMsg_Navigate_Params& params = *pending_navigation_params_.get(); |
| 2988 NavigationState* navigation_state = NULL; | 2991 NavigationState* navigation_state = NULL; |
| 2989 | 2992 |
| 2990 // A navigation resulting from loading a javascript URL should not be treated | 2993 // A navigation resulting from loading a javascript URL should not be treated |
| 2991 // as a browser initiated event. Instead, we want it to look as if the page | 2994 // as a browser initiated event. Instead, we want it to look as if the page |
| 2992 // initiated any load resulting from JS execution. | 2995 // initiated any load resulting from JS execution. |
| 2993 if (!params.url.SchemeIs(chrome::kJavaScriptScheme)) { | 2996 if (!params.url.SchemeIs(chrome::kJavaScriptScheme)) { |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3190 | 3193 |
| 3191 void RenderViewImpl::didCommitProvisionalLoad(WebFrame* frame, | 3194 void RenderViewImpl::didCommitProvisionalLoad(WebFrame* frame, |
| 3192 bool is_new_navigation) { | 3195 bool is_new_navigation) { |
| 3193 DocumentState* document_state = | 3196 DocumentState* document_state = |
| 3194 DocumentState::FromDataSource(frame->dataSource()); | 3197 DocumentState::FromDataSource(frame->dataSource()); |
| 3195 NavigationState* navigation_state = document_state->navigation_state(); | 3198 NavigationState* navigation_state = document_state->navigation_state(); |
| 3196 | 3199 |
| 3197 if (document_state->commit_load_time().is_null()) | 3200 if (document_state->commit_load_time().is_null()) |
| 3198 document_state->set_commit_load_time(Time::Now()); | 3201 document_state->set_commit_load_time(Time::Now()); |
| 3199 | 3202 |
| 3203 if (document_state->must_reset_scroll_and_scale_state()) { | |
| 3204 webview()->resetScrollAndScaleState(); | |
| 3205 document_state->set_must_reset_scroll_and_scale_state(false); | |
| 3206 } | |
| 3207 | |
| 3200 if (is_new_navigation) { | 3208 if (is_new_navigation) { |
| 3201 // When we perform a new navigation, we need to update the last committed | 3209 // When we perform a new navigation, we need to update the last committed |
| 3202 // session history entry with state for the page we are leaving. | 3210 // session history entry with state for the page we are leaving. |
| 3203 UpdateSessionHistory(frame); | 3211 UpdateSessionHistory(frame); |
| 3204 | 3212 |
| 3205 // We bump our Page ID to correspond with the new session history entry. | 3213 // We bump our Page ID to correspond with the new session history entry. |
| 3206 page_id_ = next_page_id_++; | 3214 page_id_ = next_page_id_++; |
| 3207 | 3215 |
| 3208 // Don't update history_page_ids_ (etc) for content::kSwappedOutURL, since | 3216 // Don't update history_page_ids_ (etc) for content::kSwappedOutURL, since |
| 3209 // we don't want to forget the entry that was there, and since we will | 3217 // we don't want to forget the entry that was there, and since we will |
| (...skipping 2835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6045 | 6053 |
| 6046 updating_frame_tree_ = true; | 6054 updating_frame_tree_ = true; |
| 6047 active_frame_id_map_.clear(); | 6055 active_frame_id_map_.clear(); |
| 6048 | 6056 |
| 6049 target_process_id_ = process_id; | 6057 target_process_id_ = process_id; |
| 6050 target_routing_id_ = route_id; | 6058 target_routing_id_ = route_id; |
| 6051 CreateFrameTree(webview()->mainFrame(), frames); | 6059 CreateFrameTree(webview()->mainFrame(), frames); |
| 6052 | 6060 |
| 6053 updating_frame_tree_ = false; | 6061 updating_frame_tree_ = false; |
| 6054 } | 6062 } |
| OLD | NEW |