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/browser/frame_host/navigation_entry_impl.h" | 5 #include "content/browser/frame_host/navigation_entry_impl.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "content/common/navigation_params.h" | 10 #include "content/common/navigation_params.h" |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 } | 405 } |
406 | 406 |
407 return StartNavigationParams( | 407 return StartNavigationParams( |
408 GetHasPostData(), extra_headers(), browser_initiated_post_data, | 408 GetHasPostData(), extra_headers(), browser_initiated_post_data, |
409 should_replace_entry(), transferred_global_request_id().child_id, | 409 should_replace_entry(), transferred_global_request_id().child_id, |
410 transferred_global_request_id().request_id); | 410 transferred_global_request_id().request_id); |
411 } | 411 } |
412 | 412 |
413 RequestNavigationParams NavigationEntryImpl::ConstructRequestNavigationParams( | 413 RequestNavigationParams NavigationEntryImpl::ConstructRequestNavigationParams( |
414 base::TimeTicks navigation_start, | 414 base::TimeTicks navigation_start, |
| 415 bool intended_as_new_entry, |
415 int pending_history_list_offset, | 416 int pending_history_list_offset, |
416 int current_history_list_offset, | 417 int current_history_list_offset, |
417 int current_history_list_length) const { | 418 int current_history_list_length) const { |
418 // Set the redirect chain to the navigation's redirects, unless returning to a | 419 // Set the redirect chain to the navigation's redirects, unless returning to a |
419 // completed navigation (whose previous redirects don't apply). | 420 // completed navigation (whose previous redirects don't apply). |
420 std::vector<GURL> redirects; | 421 std::vector<GURL> redirects; |
421 if (ui::PageTransitionIsNewNavigation(GetTransitionType())) { | 422 if (ui::PageTransitionIsNewNavigation(GetTransitionType())) { |
422 redirects = GetRedirectChain(); | 423 redirects = GetRedirectChain(); |
423 } | 424 } |
424 | 425 |
425 int pending_offset_to_send = pending_history_list_offset; | 426 int pending_offset_to_send = pending_history_list_offset; |
426 int current_offset_to_send = current_history_list_offset; | 427 int current_offset_to_send = current_history_list_offset; |
427 int current_length_to_send = current_history_list_length; | 428 int current_length_to_send = current_history_list_length; |
428 if (should_clear_history_list()) { | 429 if (should_clear_history_list()) { |
429 // Set the history list related parameters to the same values a | 430 // Set the history list related parameters to the same values a |
430 // NavigationController would return before its first navigation. This will | 431 // NavigationController would return before its first navigation. This will |
431 // fully clear the RenderView's view of the session history. | 432 // fully clear the RenderView's view of the session history. |
432 pending_offset_to_send = -1; | 433 pending_offset_to_send = -1; |
433 current_offset_to_send = -1; | 434 current_offset_to_send = -1; |
434 current_length_to_send = 0; | 435 current_length_to_send = 0; |
435 } | 436 } |
436 return RequestNavigationParams( | 437 return RequestNavigationParams( |
437 GetIsOverridingUserAgent(), navigation_start, redirects, | 438 GetIsOverridingUserAgent(), navigation_start, redirects, |
438 GetCanLoadLocalResources(), base::Time::Now(), GetPageState(), | 439 GetCanLoadLocalResources(), base::Time::Now(), GetPageState(), |
439 GetPageID(), pending_offset_to_send, current_offset_to_send, | 440 GetPageID(), GetUniqueID(), intended_as_new_entry, pending_offset_to_send, |
440 current_length_to_send, should_clear_history_list()); | 441 current_offset_to_send, current_length_to_send, |
| 442 should_clear_history_list()); |
441 } | 443 } |
442 | 444 |
443 void NavigationEntryImpl::ResetForCommit() { | 445 void NavigationEntryImpl::ResetForCommit() { |
444 // Any state that only matters when a navigation entry is pending should be | 446 // Any state that only matters when a navigation entry is pending should be |
445 // cleared here. | 447 // cleared here. |
446 // TODO(creis): This state should be moved to NavigationRequest once | 448 // TODO(creis): This state should be moved to NavigationRequest once |
447 // PlzNavigate is enabled. | 449 // PlzNavigate is enabled. |
448 SetBrowserInitiatedPostData(nullptr); | 450 SetBrowserInitiatedPostData(nullptr); |
449 set_source_site_instance(nullptr); | 451 set_source_site_instance(nullptr); |
450 set_is_renderer_initiated(false); | 452 set_is_renderer_initiated(false); |
(...skipping 27 matching lines...) Expand all Loading... |
478 screenshot_ = png_data; | 480 screenshot_ = png_data; |
479 if (screenshot_.get()) | 481 if (screenshot_.get()) |
480 UMA_HISTOGRAM_MEMORY_KB("Overscroll.ScreenshotSize", screenshot_->size()); | 482 UMA_HISTOGRAM_MEMORY_KB("Overscroll.ScreenshotSize", screenshot_->size()); |
481 } | 483 } |
482 | 484 |
483 GURL NavigationEntryImpl::GetHistoryURLForDataURL() const { | 485 GURL NavigationEntryImpl::GetHistoryURLForDataURL() const { |
484 return GetBaseURLForDataURL().is_empty() ? GURL() : GetVirtualURL(); | 486 return GetBaseURLForDataURL().is_empty() ? GURL() : GetVirtualURL(); |
485 } | 487 } |
486 | 488 |
487 } // namespace content | 489 } // namespace content |
OLD | NEW |