Remove WebHistoryItem child usage
HistoryEntry is now used to store the history tree.
BUG=
Review URL: https://codereview.chromium.org/248013003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@267274 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/content/renderer/history_entry.cc b/content/renderer/history_entry.cc
index 8d168ee5..63c1ea0 100644
--- a/content/renderer/history_entry.cc
+++ b/content/renderer/history_entry.cc
@@ -35,8 +35,6 @@
#include "content/renderer/history_entry.h"
-#include <deque>
-
#include "content/renderer/render_frame_impl.h"
#include "content/renderer/render_view_impl.h"
#include "third_party/WebKit/public/web/WebFrame.h"
@@ -53,6 +51,10 @@
return children_->back();
}
+HistoryEntry::HistoryNode* HistoryEntry::HistoryNode::AddChild() {
+ return AddChild(WebHistoryItem(), kInvalidFrameRoutingID);
+}
+
HistoryEntry::HistoryNode* HistoryEntry::HistoryNode::CloneAndReplace(
HistoryEntry* new_entry,
const WebHistoryItem& new_item,
@@ -90,13 +92,21 @@
return new_history_node;
}
+void HistoryEntry::HistoryNode::set_item(const WebHistoryItem& item) {
+ // The previous HistoryItem might not have had a target set, or it might be
+ // different than the current one.
+ entry_->unique_names_to_items_[item.target().utf8()] = this;
+ item_ = item;
+}
+
HistoryEntry::HistoryNode::HistoryNode(HistoryEntry* entry,
const WebHistoryItem& item,
int64_t frame_id)
: entry_(entry), item_(item) {
if (frame_id != kInvalidFrameRoutingID)
entry_->frames_to_items_[frame_id] = this;
- entry_->unique_names_to_items_[item.target().utf8()] = this;
+ if (!item.isNull())
+ entry_->unique_names_to_items_[item.target().utf8()] = this;
children_.reset(new ScopedVector<HistoryNode>);
}
@@ -138,6 +148,7 @@
}
HistoryEntry::HistoryEntry() {
+ root_.reset(new HistoryNode(this, WebHistoryItem(), kInvalidFrameRoutingID));
}
HistoryEntry::~HistoryEntry() {