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

Unified Diff: content/browser/frame_host/navigation_entry_impl.h

Issue 281653003: DRAFT CL: Add FrameNavigationEntry and track subframe session histories. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 5 years, 9 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/browser/frame_host/navigation_entry_impl.h
diff --git a/content/browser/frame_host/navigation_entry_impl.h b/content/browser/frame_host/navigation_entry_impl.h
index 0528da0db31bda4f4087a3beb3d0f6e105734986..2bacbbaa208a915a65f45fb8dba9934acb2ceaf8 100644
--- a/content/browser/frame_host/navigation_entry_impl.h
+++ b/content/browser/frame_host/navigation_entry_impl.h
@@ -7,8 +7,10 @@
#include "base/basictypes.h"
#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_vector.h"
#include "base/time/time.h"
#include "content/browser/frame_host/frame_navigation_entry.h"
+#include "content/browser/frame_host/frame_tree_node.h"
#include "content/browser/site_instance_impl.h"
#include "content/common/frame_message_enums.h"
#include "content/public/browser/favicon_status.h"
@@ -31,7 +33,8 @@ class CONTENT_EXPORT NavigationEntryImpl
// history item. The tree currently only tracks the main frame.
// TODO(creis): Populate the tree with subframe entries in --site-per-process.
struct TreeNode {
- TreeNode(FrameNavigationEntry* frame_entry);
+ TreeNode(NavigationEntryImpl* entry,
+ FrameNavigationEntry* frame_entry);
~TreeNode();
// Returns a deep copy of the tree with copies of each node's
@@ -41,9 +44,18 @@ class CONTENT_EXPORT NavigationEntryImpl
// NavigationEntries of the same tab.
TreeNode* Clone() const;
+ void SetFrameEntry(FrameNavigationEntry* new_frame_entry);
+
+ // Pointer to the NavigationEntry that owns us.
+ // TODO(creis): Remove this.
+ NavigationEntryImpl* entry;
+
// Ref counted pointer that keeps the FrameNavigationEntry alive as long as
// it is needed by this node's NavigationEntry.
scoped_refptr<FrameNavigationEntry> frame_entry;
+
+ // List of child TreeNodes, which will be deleted when this node is.
+ ScopedVector<TreeNode> children;
};
static NavigationEntryImpl* FromNavigationEntry(NavigationEntry* entry);
@@ -115,6 +127,10 @@ class CONTENT_EXPORT NavigationEntryImpl
const std::vector<GURL>& GetRedirectChain() const override;
bool IsRestored() const override;
+ TreeNode* root_node() const {
+ return frame_tree_.get();
+ }
+
// Creates a copy of this NavigationEntryImpl that can be modified
// independently from the original. Does not copy any value that would be
// cleared in ResetForCommit.
@@ -124,6 +140,14 @@ class CONTENT_EXPORT NavigationEntryImpl
// tab) and one that draws them from a different pool (for use in a new tab).
NavigationEntryImpl* Clone() const;
+ // Clears the frame tree before adding new TreeNodes to it.
+ void ResetFrameTree();
+
+ TreeNode* GetTreeNodeForFrame(FrameTreeNode* frame_tree_node);
+
+ // Returns the FrameNavigationEntry corresponding to |frame_tree_node|.
+ FrameNavigationEntry* GetFrameEntryForFrame(FrameTreeNode* frame_tree_node);
+
// Once a navigation entry is committed, we should no longer track several
// pieces of non-persisted state, as documented on the members below.
void ResetForCommit();
@@ -138,6 +162,7 @@ class CONTENT_EXPORT NavigationEntryImpl
// Note that the SiteInstance should usually not be changed after it is set,
// but this may happen if the NavigationEntry was cloned and needs to use a
// different SiteInstance.
+ // TODO(creis): This should live on the FNE, not here.
void set_site_instance(SiteInstanceImpl* site_instance);
SiteInstanceImpl* site_instance() const {
return frame_tree_->frame_entry->site_instance();
@@ -250,23 +275,17 @@ class CONTENT_EXPORT NavigationEntryImpl
should_clear_history_list_ = should_clear_history_list;
}
- // Indicates which FrameTreeNode to navigate. Currently only used if the
- // --site-per-process flag is passed.
- int64 frame_tree_node_id() const {
- return frame_tree_node_id_;
- }
- void set_frame_tree_node_id(int64 frame_tree_node_id) {
- frame_tree_node_id_ = frame_tree_node_id;
- }
-
// Returns the history URL for a data URL to use in Blink.
GURL GetHistoryURLForDataURL() const;
CommonNavigationParams ConstructCommonNavigationParams(
+ const FrameNavigationEntry& frame_entry,
FrameMsg_Navigate_Type::Value navigation_type) const;
CommitNavigationParams ConstructCommitNavigationParams(
base::TimeTicks navigation_start) const;
+ // TODO(creis): NavigationEntry should not depend on NavigationController.
HistoryNavigationParams ConstructHistoryNavigationParams(
+ const FrameNavigationEntry& frame_entry,
NavigationControllerImpl* controller) const;
StartNavigationParams ConstructStartNavigationParams() const;
@@ -290,6 +309,12 @@ class CONTENT_EXPORT NavigationEntryImpl
// For all new fields, update |Clone| and possibly |ResetForCommit|.
// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
+ typedef base::hash_map<int64, TreeNode*> FramesToItems;
+ FramesToItems frames_to_items_;
+
+ typedef base::hash_map<std::string, TreeNode*> UniqueNamesToItems;
+ UniqueNamesToItems unique_names_to_items_;
+
// Tree of FrameNavigationEntries, one for each frame on the page.
// TODO(creis): Once FrameNavigationEntries can be shared across multiple
// NavigationEntries, we will need to update Session/Tab restore. For now,
@@ -305,7 +330,6 @@ class CONTENT_EXPORT NavigationEntryImpl
bool update_virtual_url_with_url_;
base::string16 title_;
FaviconStatus favicon_;
- PageState page_state_;
int32 page_id_;
SSLStatus ssl_;
ui::PageTransition transition_type_;
@@ -396,13 +420,6 @@ class CONTENT_EXPORT NavigationEntryImpl
// persisted, because it is currently only used in tests.
std::string frame_to_navigate_;
- // If not -1, this indicates which FrameTreeNode to navigate. This field is
- // not persisted because it is experimental and only used when the
- // --site-per-process flag is passed. It is cleared in |ResetForCommit|
- // because we only use it while the navigation is pending.
- // TODO(creis): Move this to FrameNavigationEntry.
- int64 frame_tree_node_id_;
-
#if defined(OS_ANDROID)
// The time at which Chrome received the Android Intent that triggered this
// URL load operation. Reset at commit and not persisted.
« no previous file with comments | « content/browser/frame_host/navigation_controller_impl_unittest.cc ('k') | content/browser/frame_host/navigation_entry_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698