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 3239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3250 InternalDocumentStateData::FromDocumentState(document_state); | 3250 InternalDocumentStateData::FromDocumentState(document_state); |
3251 | 3251 |
3252 if (document_state->commit_load_time().is_null()) | 3252 if (document_state->commit_load_time().is_null()) |
3253 document_state->set_commit_load_time(Time::Now()); | 3253 document_state->set_commit_load_time(Time::Now()); |
3254 | 3254 |
3255 if (internal_data->must_reset_scroll_and_scale_state()) { | 3255 if (internal_data->must_reset_scroll_and_scale_state()) { |
3256 render_view_->webview()->resetScrollAndScaleState(); | 3256 render_view_->webview()->resetScrollAndScaleState(); |
3257 internal_data->set_must_reset_scroll_and_scale_state(false); | 3257 internal_data->set_must_reset_scroll_and_scale_state(false); |
3258 } | 3258 } |
3259 | 3259 |
| 3260 const RequestNavigationParams& request_params = |
| 3261 navigation_state->request_params(); |
3260 bool is_new_navigation = commit_type == blink::WebStandardCommit; | 3262 bool is_new_navigation = commit_type == blink::WebStandardCommit; |
3261 if (is_new_navigation) { | 3263 |
| 3264 // Ensure that we allocate a page ID if this is the first navigation for the |
| 3265 // page in this process. This can happen even when is_new_navigation |
| 3266 // is false, such as after a cross-process location.replace navigation. |
| 3267 bool should_init_page_id = render_view_->page_id_ == -1 && |
| 3268 request_params.page_id == -1 && |
| 3269 request_params.nav_entry_id != 0 && |
| 3270 !navigation_state->IsContentInitiated(); |
| 3271 if (is_new_navigation || should_init_page_id) { |
3262 // We bump our Page ID to correspond with the new session history entry. | 3272 // We bump our Page ID to correspond with the new session history entry. |
3263 render_view_->page_id_ = render_view_->next_page_id_++; | 3273 render_view_->page_id_ = render_view_->next_page_id_++; |
3264 | 3274 |
3265 DCHECK(!navigation_state->common_params().should_replace_current_entry || | 3275 DCHECK(!navigation_state->common_params().should_replace_current_entry || |
3266 render_view_->history_list_length_ > 0); | 3276 render_view_->history_list_length_ > 0); |
3267 if (!navigation_state->common_params().should_replace_current_entry) { | 3277 if (!navigation_state->common_params().should_replace_current_entry) { |
3268 // Advance our offset in session history, applying the length limit. | 3278 // Advance our offset in session history, applying the length limit. |
3269 // There is now no forward history. | 3279 // There is now no forward history. |
3270 render_view_->history_list_offset_++; | 3280 render_view_->history_list_offset_++; |
3271 if (render_view_->history_list_offset_ >= kMaxSessionHistoryEntries) | 3281 if (render_view_->history_list_offset_ >= kMaxSessionHistoryEntries) |
3272 render_view_->history_list_offset_ = kMaxSessionHistoryEntries - 1; | 3282 render_view_->history_list_offset_ = kMaxSessionHistoryEntries - 1; |
3273 render_view_->history_list_length_ = | 3283 render_view_->history_list_length_ = |
3274 render_view_->history_list_offset_ + 1; | 3284 render_view_->history_list_offset_ + 1; |
3275 } | 3285 } |
3276 } else { | 3286 } else { |
3277 const RequestNavigationParams& request_params = | |
3278 navigation_state->request_params(); | |
3279 if (request_params.nav_entry_id != 0 && | 3287 if (request_params.nav_entry_id != 0 && |
3280 !request_params.intended_as_new_entry) { | 3288 !request_params.intended_as_new_entry) { |
3281 // This is a successful session history navigation! | 3289 // This is a successful session history navigation! |
3282 render_view_->page_id_ = request_params.page_id; | 3290 render_view_->page_id_ = request_params.page_id; |
3283 | 3291 |
3284 render_view_->history_list_offset_ = | 3292 render_view_->history_list_offset_ = |
3285 request_params.pending_history_list_offset; | 3293 request_params.pending_history_list_offset; |
3286 } | 3294 } |
3287 } | 3295 } |
3288 | 3296 |
(...skipping 2855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6144 // event target. Potentially a Pepper plugin will receive the event. | 6152 // event target. Potentially a Pepper plugin will receive the event. |
6145 // In order to tell whether a plugin gets the last mouse event and which it | 6153 // In order to tell whether a plugin gets the last mouse event and which it |
6146 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6154 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
6147 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6155 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
6148 // |pepper_last_mouse_event_target_|. | 6156 // |pepper_last_mouse_event_target_|. |
6149 pepper_last_mouse_event_target_ = nullptr; | 6157 pepper_last_mouse_event_target_ = nullptr; |
6150 #endif | 6158 #endif |
6151 } | 6159 } |
6152 | 6160 |
6153 } // namespace content | 6161 } // namespace content |
OLD | NEW |