Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(195)

Side by Side Diff: content/browser/frame_host/navigation_entry_impl.cc

Issue 2384833002: Revert of Notify the renderer if a history navigation has no subframe items. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <queue> 9 #include <queue>
10 #include <utility> 10 #include <utility>
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 has_user_gesture(), 684 has_user_gesture(),
685 #endif 685 #endif
686 transferred_global_request_id().child_id, 686 transferred_global_request_id().child_id,
687 transferred_global_request_id().request_id); 687 transferred_global_request_id().request_id);
688 } 688 }
689 689
690 RequestNavigationParams NavigationEntryImpl::ConstructRequestNavigationParams( 690 RequestNavigationParams NavigationEntryImpl::ConstructRequestNavigationParams(
691 const FrameNavigationEntry& frame_entry, 691 const FrameNavigationEntry& frame_entry,
692 bool is_same_document_history_load, 692 bool is_same_document_history_load,
693 bool is_history_navigation_in_new_child, 693 bool is_history_navigation_in_new_child,
694 bool has_subtree_history_items,
695 bool has_committed_real_load, 694 bool has_committed_real_load,
696 bool intended_as_new_entry, 695 bool intended_as_new_entry,
697 int pending_history_list_offset, 696 int pending_history_list_offset,
698 int current_history_list_offset, 697 int current_history_list_offset,
699 int current_history_list_length) const { 698 int current_history_list_length) const {
700 // Set the redirect chain to the navigation's redirects, unless returning to a 699 // Set the redirect chain to the navigation's redirects, unless returning to a
701 // completed navigation (whose previous redirects don't apply). 700 // completed navigation (whose previous redirects don't apply).
702 std::vector<GURL> redirects; 701 std::vector<GURL> redirects;
703 if (ui::PageTransitionIsNewNavigation(GetTransitionType())) { 702 if (ui::PageTransitionIsNewNavigation(GetTransitionType())) {
704 redirects = GetRedirectChain(); 703 redirects = GetRedirectChain();
705 } 704 }
706 705
707 int pending_offset_to_send = pending_history_list_offset; 706 int pending_offset_to_send = pending_history_list_offset;
708 int current_offset_to_send = current_history_list_offset; 707 int current_offset_to_send = current_history_list_offset;
709 int current_length_to_send = current_history_list_length; 708 int current_length_to_send = current_history_list_length;
710 if (should_clear_history_list()) { 709 if (should_clear_history_list()) {
711 // Set the history list related parameters to the same values a 710 // Set the history list related parameters to the same values a
712 // NavigationController would return before its first navigation. This will 711 // NavigationController would return before its first navigation. This will
713 // fully clear the RenderView's view of the session history. 712 // fully clear the RenderView's view of the session history.
714 pending_offset_to_send = -1; 713 pending_offset_to_send = -1;
715 current_offset_to_send = -1; 714 current_offset_to_send = -1;
716 current_length_to_send = 0; 715 current_length_to_send = 0;
717 } 716 }
718 717
719 RequestNavigationParams request_params( 718 RequestNavigationParams request_params(
720 GetIsOverridingUserAgent(), redirects, GetCanLoadLocalResources(), 719 GetIsOverridingUserAgent(), redirects, GetCanLoadLocalResources(),
721 base::Time::Now(), frame_entry.page_state(), GetPageID(), GetUniqueID(), 720 base::Time::Now(), frame_entry.page_state(), GetPageID(), GetUniqueID(),
722 is_same_document_history_load, is_history_navigation_in_new_child, 721 is_same_document_history_load, is_history_navigation_in_new_child,
723 has_subtree_history_items, has_committed_real_load, intended_as_new_entry, 722 has_committed_real_load, intended_as_new_entry, pending_offset_to_send,
724 pending_offset_to_send, current_offset_to_send, current_length_to_send, 723 current_offset_to_send, current_length_to_send, IsViewSourceMode(),
725 IsViewSourceMode(), should_clear_history_list()); 724 should_clear_history_list());
726 #if defined(OS_ANDROID) 725 #if defined(OS_ANDROID)
727 if (GetDataURLAsString() && 726 if (GetDataURLAsString() &&
728 GetDataURLAsString()->size() <= kMaxLengthOfDataURLString) { 727 GetDataURLAsString()->size() <= kMaxLengthOfDataURLString) {
729 // The number of characters that is enough for validating a data: URI. From 728 // The number of characters that is enough for validating a data: URI. From
730 // the GURL's POV, the only important part here is scheme, it doesn't check 729 // the GURL's POV, the only important part here is scheme, it doesn't check
731 // the actual content. Thus we can take only the prefix of the url, to avoid 730 // the actual content. Thus we can take only the prefix of the url, to avoid
732 // unneeded copying of a potentially long string. 731 // unneeded copying of a potentially long string.
733 const size_t kDataUriPrefixMaxLen = 64; 732 const size_t kDataUriPrefixMaxLen = 64;
734 GURL data_url(std::string( 733 GURL data_url(std::string(
735 GetDataURLAsString()->front_as<char>(), 734 GetDataURLAsString()->front_as<char>(),
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 parent_node->children.push_back( 839 parent_node->children.push_back(
841 new NavigationEntryImpl::TreeNode(parent_node, frame_entry)); 840 new NavigationEntryImpl::TreeNode(parent_node, frame_entry));
842 } 841 }
843 842
844 FrameNavigationEntry* NavigationEntryImpl::GetFrameEntry( 843 FrameNavigationEntry* NavigationEntryImpl::GetFrameEntry(
845 FrameTreeNode* frame_tree_node) const { 844 FrameTreeNode* frame_tree_node) const {
846 NavigationEntryImpl::TreeNode* tree_node = FindFrameEntry(frame_tree_node); 845 NavigationEntryImpl::TreeNode* tree_node = FindFrameEntry(frame_tree_node);
847 return tree_node ? tree_node->frame_entry.get() : nullptr; 846 return tree_node ? tree_node->frame_entry.get() : nullptr;
848 } 847 }
849 848
850 bool NavigationEntryImpl::HasSubtreeHistoryItems(
851 FrameTreeNode* frame_tree_node) const {
852 NavigationEntryImpl::TreeNode* tree_node = FindFrameEntry(frame_tree_node);
853 return tree_node && !tree_node->children.empty();
854 }
855
856 void NavigationEntryImpl::ClearStaleFrameEntriesForNewFrame( 849 void NavigationEntryImpl::ClearStaleFrameEntriesForNewFrame(
857 FrameTreeNode* frame_tree_node) { 850 FrameTreeNode* frame_tree_node) {
858 DCHECK(!frame_tree_node->IsMainFrame()); 851 DCHECK(!frame_tree_node->IsMainFrame());
859 852
860 NavigationEntryImpl::TreeNode* node = nullptr; 853 NavigationEntryImpl::TreeNode* node = nullptr;
861 std::queue<NavigationEntryImpl::TreeNode*> work_queue; 854 std::queue<NavigationEntryImpl::TreeNode*> work_queue;
862 int count = 0; 855 int count = 0;
863 856
864 work_queue.push(root_node()); 857 work_queue.push(root_node());
865 while (!work_queue.empty()) { 858 while (!work_queue.empty()) {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 return node; 906 return node;
914 907
915 // Enqueue any children and keep looking. 908 // Enqueue any children and keep looking.
916 for (auto* child : node->children) 909 for (auto* child : node->children)
917 work_queue.push(child); 910 work_queue.push(child);
918 } 911 }
919 return nullptr; 912 return nullptr;
920 } 913 }
921 914
922 } // namespace content 915 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigation_entry_impl.h ('k') | content/browser/frame_host/navigation_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698