| 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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 } | 414 } |
| 415 | 415 |
| 416 return StartNavigationParams( | 416 return StartNavigationParams( |
| 417 GetHasPostData(), extra_headers(), browser_initiated_post_data, | 417 GetHasPostData(), extra_headers(), browser_initiated_post_data, |
| 418 should_replace_entry(), transferred_global_request_id().child_id, | 418 should_replace_entry(), transferred_global_request_id().child_id, |
| 419 transferred_global_request_id().request_id); | 419 transferred_global_request_id().request_id); |
| 420 } | 420 } |
| 421 | 421 |
| 422 RequestNavigationParams NavigationEntryImpl::ConstructRequestNavigationParams( | 422 RequestNavigationParams NavigationEntryImpl::ConstructRequestNavigationParams( |
| 423 base::TimeTicks navigation_start, | 423 base::TimeTicks navigation_start, |
| 424 bool intended_as_new_entry, |
| 424 int pending_history_list_offset, | 425 int pending_history_list_offset, |
| 425 int current_history_list_offset, | 426 int current_history_list_offset, |
| 426 int current_history_list_length) const { | 427 int current_history_list_length) const { |
| 427 // Set the redirect chain to the navigation's redirects, unless returning to a | 428 // Set the redirect chain to the navigation's redirects, unless returning to a |
| 428 // completed navigation (whose previous redirects don't apply). | 429 // completed navigation (whose previous redirects don't apply). |
| 429 std::vector<GURL> redirects; | 430 std::vector<GURL> redirects; |
| 430 if (ui::PageTransitionIsNewNavigation(GetTransitionType())) { | 431 if (ui::PageTransitionIsNewNavigation(GetTransitionType())) { |
| 431 redirects = GetRedirectChain(); | 432 redirects = GetRedirectChain(); |
| 432 } | 433 } |
| 433 | 434 |
| 434 int pending_offset_to_send = pending_history_list_offset; | 435 int pending_offset_to_send = pending_history_list_offset; |
| 435 int current_offset_to_send = current_history_list_offset; | 436 int current_offset_to_send = current_history_list_offset; |
| 436 int current_length_to_send = current_history_list_length; | 437 int current_length_to_send = current_history_list_length; |
| 437 if (should_clear_history_list()) { | 438 if (should_clear_history_list()) { |
| 438 // Set the history list related parameters to the same values a | 439 // Set the history list related parameters to the same values a |
| 439 // NavigationController would return before its first navigation. This will | 440 // NavigationController would return before its first navigation. This will |
| 440 // fully clear the RenderView's view of the session history. | 441 // fully clear the RenderView's view of the session history. |
| 441 pending_offset_to_send = -1; | 442 pending_offset_to_send = -1; |
| 442 current_offset_to_send = -1; | 443 current_offset_to_send = -1; |
| 443 current_length_to_send = 0; | 444 current_length_to_send = 0; |
| 444 } | 445 } |
| 445 return RequestNavigationParams( | 446 return RequestNavigationParams( |
| 446 GetIsOverridingUserAgent(), navigation_start, redirects, | 447 GetIsOverridingUserAgent(), navigation_start, redirects, |
| 447 GetCanLoadLocalResources(), GetFrameToNavigate(), base::Time::Now(), | 448 GetCanLoadLocalResources(), GetFrameToNavigate(), base::Time::Now(), |
| 448 GetPageState(), GetPageID(), pending_offset_to_send, | 449 GetPageState(), GetPageID(), GetUniqueID(), intended_as_new_entry, |
| 449 current_offset_to_send, current_length_to_send, | 450 pending_offset_to_send, current_offset_to_send, current_length_to_send, |
| 450 should_clear_history_list()); | 451 should_clear_history_list()); |
| 451 } | 452 } |
| 452 | 453 |
| 453 void NavigationEntryImpl::ResetForCommit() { | 454 void NavigationEntryImpl::ResetForCommit() { |
| 454 // Any state that only matters when a navigation entry is pending should be | 455 // Any state that only matters when a navigation entry is pending should be |
| 455 // cleared here. | 456 // cleared here. |
| 456 // TODO(creis): This state should be moved to NavigationRequest once | 457 // TODO(creis): This state should be moved to NavigationRequest once |
| 457 // PlzNavigate is enabled. | 458 // PlzNavigate is enabled. |
| 458 SetBrowserInitiatedPostData(nullptr); | 459 SetBrowserInitiatedPostData(nullptr); |
| 459 set_source_site_instance(nullptr); | 460 set_source_site_instance(nullptr); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 488 screenshot_ = png_data; | 489 screenshot_ = png_data; |
| 489 if (screenshot_.get()) | 490 if (screenshot_.get()) |
| 490 UMA_HISTOGRAM_MEMORY_KB("Overscroll.ScreenshotSize", screenshot_->size()); | 491 UMA_HISTOGRAM_MEMORY_KB("Overscroll.ScreenshotSize", screenshot_->size()); |
| 491 } | 492 } |
| 492 | 493 |
| 493 GURL NavigationEntryImpl::GetHistoryURLForDataURL() const { | 494 GURL NavigationEntryImpl::GetHistoryURLForDataURL() const { |
| 494 return GetBaseURLForDataURL().is_empty() ? GURL() : GetVirtualURL(); | 495 return GetBaseURLForDataURL().is_empty() ? GURL() : GetVirtualURL(); |
| 495 } | 496 } |
| 496 | 497 |
| 497 } // namespace content | 498 } // namespace content |
| OLD | NEW |