| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <queue> | 9 #include <queue> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 has_user_gesture(), | 685 has_user_gesture(), |
| 686 #endif | 686 #endif |
| 687 transferred_global_request_id().child_id, | 687 transferred_global_request_id().child_id, |
| 688 transferred_global_request_id().request_id); | 688 transferred_global_request_id().request_id); |
| 689 } | 689 } |
| 690 | 690 |
| 691 RequestNavigationParams NavigationEntryImpl::ConstructRequestNavigationParams( | 691 RequestNavigationParams NavigationEntryImpl::ConstructRequestNavigationParams( |
| 692 const FrameNavigationEntry& frame_entry, | 692 const FrameNavigationEntry& frame_entry, |
| 693 bool is_same_document_history_load, | 693 bool is_same_document_history_load, |
| 694 bool is_history_navigation_in_new_child, | 694 bool is_history_navigation_in_new_child, |
| 695 const std::set<std::string>& subframe_unique_names, | 695 const std::map<std::string, bool>& subframe_unique_names, |
| 696 bool has_committed_real_load, | 696 bool has_committed_real_load, |
| 697 bool intended_as_new_entry, | 697 bool intended_as_new_entry, |
| 698 int pending_history_list_offset, | 698 int pending_history_list_offset, |
| 699 int current_history_list_offset, | 699 int current_history_list_offset, |
| 700 int current_history_list_length) const { | 700 int current_history_list_length) const { |
| 701 // Set the redirect chain to the navigation's redirects, unless returning to a | 701 // Set the redirect chain to the navigation's redirects, unless returning to a |
| 702 // completed navigation (whose previous redirects don't apply). | 702 // completed navigation (whose previous redirects don't apply). |
| 703 std::vector<GURL> redirects; | 703 std::vector<GURL> redirects; |
| 704 if (ui::PageTransitionIsNewNavigation(GetTransitionType())) { | 704 if (ui::PageTransitionIsNewNavigation(GetTransitionType())) { |
| 705 redirects = GetRedirectChain(); | 705 redirects = GetRedirectChain(); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 parent_node->children.push_back( | 841 parent_node->children.push_back( |
| 842 new NavigationEntryImpl::TreeNode(parent_node, frame_entry)); | 842 new NavigationEntryImpl::TreeNode(parent_node, frame_entry)); |
| 843 } | 843 } |
| 844 | 844 |
| 845 FrameNavigationEntry* NavigationEntryImpl::GetFrameEntry( | 845 FrameNavigationEntry* NavigationEntryImpl::GetFrameEntry( |
| 846 FrameTreeNode* frame_tree_node) const { | 846 FrameTreeNode* frame_tree_node) const { |
| 847 NavigationEntryImpl::TreeNode* tree_node = FindFrameEntry(frame_tree_node); | 847 NavigationEntryImpl::TreeNode* tree_node = FindFrameEntry(frame_tree_node); |
| 848 return tree_node ? tree_node->frame_entry.get() : nullptr; | 848 return tree_node ? tree_node->frame_entry.get() : nullptr; |
| 849 } | 849 } |
| 850 | 850 |
| 851 std::set<std::string> NavigationEntryImpl::GetSubframeUniqueNames( | 851 std::map<std::string, bool> NavigationEntryImpl::GetSubframeUniqueNames( |
| 852 FrameTreeNode* frame_tree_node) const { | 852 FrameTreeNode* frame_tree_node) const { |
| 853 std::set<std::string> names; | 853 std::map<std::string, bool> names; |
| 854 NavigationEntryImpl::TreeNode* tree_node = FindFrameEntry(frame_tree_node); | 854 NavigationEntryImpl::TreeNode* tree_node = FindFrameEntry(frame_tree_node); |
| 855 if (tree_node) { | 855 if (tree_node) { |
| 856 // Return the names of all immediate children. | 856 // Return the names of all immediate children. |
| 857 for (TreeNode* child : tree_node->children) | 857 for (TreeNode* child : tree_node->children) { |
| 858 names.insert(child->frame_entry->frame_unique_name()); | 858 // Keep track of whether we would be loading about:blank, since the |
| 859 // renderer should be allowed to just commit the initial blank frame if |
| 860 // that was the default URL. PageState doesn't matter there, because |
| 861 // content injected into about:blank frames doesn't use it. |
| 862 // |
| 863 // Be careful not to include iframe srcdoc URLs in this check, which do |
| 864 // need their PageState. The committed URL in that case gets rewritten to |
| 865 // about:blank, but we can detect it via the PageState's URL. |
| 866 // |
| 867 // See https://crbug.com/657896 for details. |
| 868 bool is_about_blank = false; |
| 869 ExplodedPageState exploded_page_state; |
| 870 if (DecodePageState(child->frame_entry->page_state().ToEncodedData(), |
| 871 &exploded_page_state)) { |
| 872 ExplodedFrameState frame_state = exploded_page_state.top; |
| 873 if (UTF16ToUTF8(frame_state.url_string.string()) == url::kAboutBlankURL) |
| 874 is_about_blank = true; |
| 875 } |
| 876 |
| 877 names[child->frame_entry->frame_unique_name()] = is_about_blank; |
| 878 } |
| 859 } | 879 } |
| 860 return names; | 880 return names; |
| 861 } | 881 } |
| 862 | 882 |
| 863 void NavigationEntryImpl::ClearStaleFrameEntriesForNewFrame( | 883 void NavigationEntryImpl::ClearStaleFrameEntriesForNewFrame( |
| 864 FrameTreeNode* frame_tree_node) { | 884 FrameTreeNode* frame_tree_node) { |
| 865 DCHECK(!frame_tree_node->IsMainFrame()); | 885 DCHECK(!frame_tree_node->IsMainFrame()); |
| 866 | 886 |
| 867 NavigationEntryImpl::TreeNode* node = nullptr; | 887 NavigationEntryImpl::TreeNode* node = nullptr; |
| 868 std::queue<NavigationEntryImpl::TreeNode*> work_queue; | 888 std::queue<NavigationEntryImpl::TreeNode*> work_queue; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 920 return node; | 940 return node; |
| 921 | 941 |
| 922 // Enqueue any children and keep looking. | 942 // Enqueue any children and keep looking. |
| 923 for (auto* child : node->children) | 943 for (auto* child : node->children) |
| 924 work_queue.push(child); | 944 work_queue.push(child); |
| 925 } | 945 } |
| 926 return nullptr; | 946 return nullptr; |
| 927 } | 947 } |
| 928 | 948 |
| 929 } // namespace content | 949 } // namespace content |
| OLD | NEW |