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

Unified Diff: content/renderer/history_controller.cc

Issue 248013003: Remove WebHistoryItem child usage (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/history_controller.cc
diff --git a/content/renderer/history_controller.cc b/content/renderer/history_controller.cc
index b47930e39d3371062f89fd919482a7308a0c1baf..6aeeae9415c03f75214a8c1c5dfcba14f3deda05 100644
--- a/content/renderer/history_controller.cc
+++ b/content/renderer/history_controller.cc
@@ -35,18 +35,14 @@
#include "content/renderer/history_controller.h"
-#include <deque>
-
#include "content/renderer/render_frame_impl.h"
#include "content/renderer/render_view_impl.h"
-#include "third_party/WebKit/public/platform/WebVector.h"
#include "third_party/WebKit/public/web/WebFrame.h"
using blink::WebFrame;
using blink::WebHistoryCommitType;
using blink::WebHistoryItem;
using blink::WebURLRequest;
-using blink::WebVector;
namespace content {
@@ -131,35 +127,6 @@ void HistoryController::RecursiveGoToEntry(
}
}
-void HistoryController::GoToItem(const WebHistoryItem& target_item,
- WebURLRequest::CachePolicy cache_policy) {
- // We don't have enough information to set a correct frame id here. This
- // might be a restore from disk, and the frame ids might not match up if the
- // state was saved from a different process. Ensure the HistoryEntry's main
- // frame id matches the actual main frame id. Its subframe ids are invalid to
- // ensure they don't accidentally match a potentially random frame.
- HistoryEntry* new_entry = new HistoryEntry(
- target_item, render_view_->main_render_frame()->GetRoutingID());
- std::deque<HistoryEntry::HistoryNode*> history_nodes;
- history_nodes.push_back(new_entry->root_history_node());
- while (!history_nodes.empty()) {
- // For each item, read the children (if any) off the WebHistoryItem,
- // create a new HistoryNode for each child and attach it,
- // then clear the children on the WebHistoryItem.
- HistoryEntry::HistoryNode* history_node = history_nodes.front();
- history_nodes.pop_front();
-
- WebVector<WebHistoryItem> children = history_node->item().children();
- for (size_t i = 0; i < children.size(); i++) {
- HistoryEntry::HistoryNode* child_history_node =
- history_node->AddChild(children[i], kInvalidFrameRoutingID);
- history_nodes.push_back(child_history_node);
- }
- history_node->item().setChildren(WebVector<WebHistoryItem>());
- }
- GoToEntry(new_entry, cache_policy);
-}
-
void HistoryController::UpdateForInitialLoadInChildFrame(
RenderFrameImpl* frame,
const WebHistoryItem& item) {
@@ -195,27 +162,12 @@ void HistoryController::UpdateForCommit(RenderFrameImpl* frame,
}
}
-static WebHistoryItem ItemForExport(HistoryEntry::HistoryNode* history_node) {
- DCHECK(history_node);
- WebHistoryItem item = history_node->item();
- item.setChildren(WebVector<WebHistoryItem>());
- std::vector<HistoryEntry::HistoryNode*>& child_nodes =
- history_node->children();
- for (size_t i = 0; i < child_nodes.size(); i++)
- item.appendToChildren(ItemForExport(child_nodes.at(i)));
- return item;
+HistoryEntry* HistoryController::GetCurrentEntry() {
+ return current_entry_.get();
}
-WebHistoryItem HistoryController::GetCurrentItemForExport() {
- if (!current_entry_)
- return WebHistoryItem();
- return ItemForExport(current_entry_->root_history_node());
-}
-
-WebHistoryItem HistoryController::GetPreviousItemForExport() {
- if (!previous_entry_)
- return WebHistoryItem();
- return ItemForExport(previous_entry_->root_history_node());
+HistoryEntry* HistoryController::GetPreviousEntry() {
+ return previous_entry_.get();
}
WebHistoryItem HistoryController::GetItemForNewChildFrame(

Powered by Google App Engine
This is Rietveld 408576698