Chromium Code Reviews| 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 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 865 NavigationEntryImpl::TreeNode* tree_node = FindFrameEntry(frame_tree_node); | 865 NavigationEntryImpl::TreeNode* tree_node = FindFrameEntry(frame_tree_node); |
| 866 return tree_node ? tree_node->frame_entry.get() : nullptr; | 866 return tree_node ? tree_node->frame_entry.get() : nullptr; |
| 867 } | 867 } |
| 868 | 868 |
| 869 std::set<std::string> NavigationEntryImpl::GetSubframeUniqueNames( | 869 std::set<std::string> NavigationEntryImpl::GetSubframeUniqueNames( |
| 870 FrameTreeNode* frame_tree_node) const { | 870 FrameTreeNode* frame_tree_node) const { |
| 871 std::set<std::string> names; | 871 std::set<std::string> names; |
| 872 NavigationEntryImpl::TreeNode* tree_node = FindFrameEntry(frame_tree_node); | 872 NavigationEntryImpl::TreeNode* tree_node = FindFrameEntry(frame_tree_node); |
| 873 if (tree_node) { | 873 if (tree_node) { |
| 874 // Return the names of all immediate children. | 874 // Return the names of all immediate children. |
| 875 for (TreeNode* child : tree_node->children) | 875 for (TreeNode* child : tree_node->children) { |
| 876 // Ignore subframe unique names if we would just be staying at | |
| 877 // about:blank, since the renderer should be allowed to just commit the | |
| 878 // initial blank frame those cases. PageState doesn't matter there, | |
| 879 // because content injected into about:blank frames doesn't use it. | |
| 880 // | |
| 881 // Be careful not to include iframe srcdoc URLs, which do need their | |
| 882 // PageState. The committed URL in that case gets rewritten to | |
| 883 // about:blank, but we can detect in the PageState's URL. | |
|
alexmos
2016/10/21 06:34:16
nit: missing "it" after can detect?
Charlie Reis
2016/10/21 07:34:30
Done.
| |
| 884 // | |
| 885 // See https://crbug.com/657896 for details. | |
| 886 // TODO(creis): Find a way to detect cases when the iframe started at a | |
| 887 // real URL and later went to about:blank, since those are broken for now. | |
| 888 ExplodedPageState exploded_page_state; | |
| 889 if (DecodePageState(child->frame_entry->page_state().ToEncodedData(), | |
| 890 &exploded_page_state)) { | |
| 891 ExplodedFrameState frame_state = exploded_page_state.top; | |
| 892 if (UTF16ToUTF8(frame_state.url_string.string()) == url::kAboutBlankURL) | |
| 893 continue; | |
| 894 } | |
| 895 | |
| 876 names.insert(child->frame_entry->frame_unique_name()); | 896 names.insert(child->frame_entry->frame_unique_name()); |
| 897 } | |
| 877 } | 898 } |
| 878 return names; | 899 return names; |
| 879 } | 900 } |
| 880 | 901 |
| 881 void NavigationEntryImpl::ClearStaleFrameEntriesForNewFrame( | 902 void NavigationEntryImpl::ClearStaleFrameEntriesForNewFrame( |
| 882 FrameTreeNode* frame_tree_node) { | 903 FrameTreeNode* frame_tree_node) { |
| 883 DCHECK(!frame_tree_node->IsMainFrame()); | 904 DCHECK(!frame_tree_node->IsMainFrame()); |
| 884 | 905 |
| 885 NavigationEntryImpl::TreeNode* node = nullptr; | 906 NavigationEntryImpl::TreeNode* node = nullptr; |
| 886 std::queue<NavigationEntryImpl::TreeNode*> work_queue; | 907 std::queue<NavigationEntryImpl::TreeNode*> work_queue; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 938 return node; | 959 return node; |
| 939 | 960 |
| 940 // Enqueue any children and keep looking. | 961 // Enqueue any children and keep looking. |
| 941 for (auto* child : node->children) | 962 for (auto* child : node->children) |
| 942 work_queue.push(child); | 963 work_queue.push(child); |
| 943 } | 964 } |
| 944 return nullptr; | 965 return nullptr; |
| 945 } | 966 } |
| 946 | 967 |
| 947 } // namespace content | 968 } // namespace content |
| OLD | NEW |