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 <queue> | 7 #include <queue> |
8 | 8 |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "components/url_formatter/url_formatter.h" | 12 #include "components/url_formatter/url_formatter.h" |
13 #include "content/common/navigation_params.h" | |
14 #include "content/public/common/content_constants.h" | 13 #include "content/public/common/content_constants.h" |
15 #include "content/public/common/url_constants.h" | 14 #include "content/public/common/url_constants.h" |
16 #include "ui/gfx/text_elider.h" | 15 #include "ui/gfx/text_elider.h" |
17 | 16 |
18 // Use this to get a new unique ID for a NavigationEntry during construction. | 17 // Use this to get a new unique ID for a NavigationEntry during construction. |
19 // The returned ID is guaranteed to be nonzero (which is the "no ID" indicator). | 18 // The returned ID is guaranteed to be nonzero (which is the "no ID" indicator). |
20 static int GetUniqueIDInConstructor() { | 19 static int GetUniqueIDInConstructor() { |
21 static int unique_id_counter = 0; | 20 static int unique_id_counter = 0; |
22 return ++unique_id_counter; | 21 return ++unique_id_counter; |
23 } | 22 } |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 } | 476 } |
478 | 477 |
479 RequestNavigationParams NavigationEntryImpl::ConstructRequestNavigationParams( | 478 RequestNavigationParams NavigationEntryImpl::ConstructRequestNavigationParams( |
480 const FrameNavigationEntry& frame_entry, | 479 const FrameNavigationEntry& frame_entry, |
481 base::TimeTicks navigation_start, | 480 base::TimeTicks navigation_start, |
482 bool is_same_document_history_load, | 481 bool is_same_document_history_load, |
483 bool has_committed_real_load, | 482 bool has_committed_real_load, |
484 bool intended_as_new_entry, | 483 bool intended_as_new_entry, |
485 int pending_history_list_offset, | 484 int pending_history_list_offset, |
486 int current_history_list_offset, | 485 int current_history_list_offset, |
487 int current_history_list_length) const { | 486 int current_history_list_length, |
| 487 LoFiState lofi_state) const { |
488 // Set the redirect chain to the navigation's redirects, unless returning to a | 488 // Set the redirect chain to the navigation's redirects, unless returning to a |
489 // completed navigation (whose previous redirects don't apply). | 489 // completed navigation (whose previous redirects don't apply). |
490 std::vector<GURL> redirects; | 490 std::vector<GURL> redirects; |
491 if (ui::PageTransitionIsNewNavigation(GetTransitionType())) { | 491 if (ui::PageTransitionIsNewNavigation(GetTransitionType())) { |
492 redirects = GetRedirectChain(); | 492 redirects = GetRedirectChain(); |
493 } | 493 } |
494 | 494 |
495 int pending_offset_to_send = pending_history_list_offset; | 495 int pending_offset_to_send = pending_history_list_offset; |
496 int current_offset_to_send = current_history_list_offset; | 496 int current_offset_to_send = current_history_list_offset; |
497 int current_length_to_send = current_history_list_length; | 497 int current_length_to_send = current_history_list_length; |
498 if (should_clear_history_list()) { | 498 if (should_clear_history_list()) { |
499 // Set the history list related parameters to the same values a | 499 // Set the history list related parameters to the same values a |
500 // NavigationController would return before its first navigation. This will | 500 // NavigationController would return before its first navigation. This will |
501 // fully clear the RenderView's view of the session history. | 501 // fully clear the RenderView's view of the session history. |
502 pending_offset_to_send = -1; | 502 pending_offset_to_send = -1; |
503 current_offset_to_send = -1; | 503 current_offset_to_send = -1; |
504 current_length_to_send = 0; | 504 current_length_to_send = 0; |
505 } | 505 } |
| 506 |
506 return RequestNavigationParams( | 507 return RequestNavigationParams( |
507 GetIsOverridingUserAgent(), navigation_start, redirects, | 508 GetIsOverridingUserAgent(), navigation_start, redirects, |
508 GetCanLoadLocalResources(), base::Time::Now(), frame_entry.page_state(), | 509 GetCanLoadLocalResources(), base::Time::Now(), frame_entry.page_state(), |
509 GetPageID(), GetUniqueID(), is_same_document_history_load, | 510 GetPageID(), GetUniqueID(), is_same_document_history_load, |
510 has_committed_real_load, intended_as_new_entry, pending_offset_to_send, | 511 has_committed_real_load, intended_as_new_entry, pending_offset_to_send, |
511 current_offset_to_send, current_length_to_send, | 512 current_offset_to_send, current_length_to_send, |
512 should_clear_history_list()); | 513 should_clear_history_list(), lofi_state); |
513 } | 514 } |
514 | 515 |
515 void NavigationEntryImpl::ResetForCommit() { | 516 void NavigationEntryImpl::ResetForCommit() { |
516 // Any state that only matters when a navigation entry is pending should be | 517 // Any state that only matters when a navigation entry is pending should be |
517 // cleared here. | 518 // cleared here. |
518 // TODO(creis): This state should be moved to NavigationRequest once | 519 // TODO(creis): This state should be moved to NavigationRequest once |
519 // PlzNavigate is enabled. | 520 // PlzNavigate is enabled. |
520 SetBrowserInitiatedPostData(nullptr); | 521 SetBrowserInitiatedPostData(nullptr); |
521 set_source_site_instance(nullptr); | 522 set_source_site_instance(nullptr); |
522 set_is_renderer_initiated(false); | 523 set_is_renderer_initiated(false); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 return node; | 607 return node; |
607 } | 608 } |
608 // Enqueue any children and keep looking. | 609 // Enqueue any children and keep looking. |
609 for (auto& child : node->children) | 610 for (auto& child : node->children) |
610 work_queue.push(child); | 611 work_queue.push(child); |
611 } | 612 } |
612 return nullptr; | 613 return nullptr; |
613 } | 614 } |
614 | 615 |
615 } // namespace content | 616 } // namespace content |
OLD | NEW |