| 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" |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 parent_node->children.push_back( | 589 parent_node->children.push_back( |
| 590 new NavigationEntryImpl::TreeNode(frame_entry)); | 590 new NavigationEntryImpl::TreeNode(frame_entry)); |
| 591 } | 591 } |
| 592 | 592 |
| 593 FrameNavigationEntry* NavigationEntryImpl::GetFrameEntry( | 593 FrameNavigationEntry* NavigationEntryImpl::GetFrameEntry( |
| 594 FrameTreeNode* frame_tree_node) const { | 594 FrameTreeNode* frame_tree_node) const { |
| 595 NavigationEntryImpl::TreeNode* tree_node = FindFrameEntry(frame_tree_node); | 595 NavigationEntryImpl::TreeNode* tree_node = FindFrameEntry(frame_tree_node); |
| 596 return tree_node ? tree_node->frame_entry.get() : nullptr; | 596 return tree_node ? tree_node->frame_entry.get() : nullptr; |
| 597 } | 597 } |
| 598 | 598 |
| 599 FrameNavigationEntry* NavigationEntryImpl::GetFrameEntryByUniqueName( |
| 600 const std::string& unique_name) const { |
| 601 NavigationEntryImpl::TreeNode* node = nullptr; |
| 602 std::queue<NavigationEntryImpl::TreeNode*> work_queue; |
| 603 work_queue.push(root_node()); |
| 604 while (!work_queue.empty()) { |
| 605 node = work_queue.front(); |
| 606 work_queue.pop(); |
| 607 if (node->frame_entry->frame_unique_name() == unique_name) |
| 608 return node->frame_entry.get(); |
| 609 |
| 610 // Enqueue any children and keep looking. |
| 611 for (auto& child : node->children) |
| 612 work_queue.push(child); |
| 613 } |
| 614 return nullptr; |
| 615 } |
| 616 |
| 599 void NavigationEntryImpl::SetScreenshotPNGData( | 617 void NavigationEntryImpl::SetScreenshotPNGData( |
| 600 scoped_refptr<base::RefCountedBytes> png_data) { | 618 scoped_refptr<base::RefCountedBytes> png_data) { |
| 601 screenshot_ = png_data; | 619 screenshot_ = png_data; |
| 602 if (screenshot_.get()) | 620 if (screenshot_.get()) |
| 603 UMA_HISTOGRAM_MEMORY_KB("Overscroll.ScreenshotSize", screenshot_->size()); | 621 UMA_HISTOGRAM_MEMORY_KB("Overscroll.ScreenshotSize", screenshot_->size()); |
| 604 } | 622 } |
| 605 | 623 |
| 606 GURL NavigationEntryImpl::GetHistoryURLForDataURL() const { | 624 GURL NavigationEntryImpl::GetHistoryURLForDataURL() const { |
| 607 return GetBaseURLForDataURL().is_empty() ? GURL() : GetVirtualURL(); | 625 return GetBaseURLForDataURL().is_empty() ? GURL() : GetVirtualURL(); |
| 608 } | 626 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 622 return node; | 640 return node; |
| 623 } | 641 } |
| 624 // Enqueue any children and keep looking. | 642 // Enqueue any children and keep looking. |
| 625 for (auto& child : node->children) | 643 for (auto& child : node->children) |
| 626 work_queue.push(child); | 644 work_queue.push(child); |
| 627 } | 645 } |
| 628 return nullptr; | 646 return nullptr; |
| 629 } | 647 } |
| 630 | 648 |
| 631 } // namespace content | 649 } // namespace content |
| OLD | NEW |