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