| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef CONTENT_BROWSER_FRAME_HOST_FRAME_NAVIGATION_ENTRY_H_ | 5 #ifndef CONTENT_BROWSER_FRAME_HOST_FRAME_NAVIGATION_ENTRY_H_ |
| 6 #define CONTENT_BROWSER_FRAME_HOST_FRAME_NAVIGATION_ENTRY_H_ | 6 #define CONTENT_BROWSER_FRAME_HOST_FRAME_NAVIGATION_ENTRY_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "content/browser/site_instance_impl.h" | 12 #include "content/browser/site_instance_impl.h" |
| 13 #include "content/public/common/page_state.h" | 13 #include "content/public/common/page_state.h" |
| 14 #include "content/public/common/referrer.h" | 14 #include "content/public/common/referrer.h" |
| 15 | 15 |
| 16 namespace content { | 16 namespace content { |
| 17 | 17 |
| 18 // Represents a session history item for a particular frame. | 18 // Represents a session history item for a particular frame. It is matched with |
| 19 // corresponding FrameTreeNodes using unique name (or by the root position). |
| 19 // | 20 // |
| 20 // This class is refcounted and can be shared across multiple NavigationEntries. | 21 // This class is refcounted and can be shared across multiple NavigationEntries. |
| 21 // For now, it is owned by a single NavigationEntry and only tracks the main | 22 // For now, it is owned by a single NavigationEntry and only tracks the main |
| 22 // frame. | 23 // frame. |
| 23 // | 24 // |
| 24 // If SiteIsolationPolicy::UseSubframeNavigationEntries is true, there will be a | 25 // If SiteIsolationPolicy::UseSubframeNavigationEntries is true, there will be a |
| 25 // tree of FrameNavigationEntries in each NavigationEntry, one per frame. | 26 // tree of FrameNavigationEntries in each NavigationEntry, one per frame. |
| 26 // TODO(creis): Share these FrameNavigationEntries across NavigationEntries if | 27 // TODO(creis): Share these FrameNavigationEntries across NavigationEntries if |
| 27 // the frame hasn't changed. | 28 // the frame hasn't changed. |
| 28 class CONTENT_EXPORT FrameNavigationEntry | 29 class CONTENT_EXPORT FrameNavigationEntry |
| 29 : public base::RefCounted<FrameNavigationEntry> { | 30 : public base::RefCounted<FrameNavigationEntry> { |
| 30 public: | 31 public: |
| 31 explicit FrameNavigationEntry(int frame_tree_node_id); | 32 FrameNavigationEntry(); |
| 32 FrameNavigationEntry(int frame_tree_node_id, | 33 FrameNavigationEntry(const std::string& frame_unique_name, |
| 33 const std::string& frame_unique_name, | |
| 34 int64_t item_sequence_number, | 34 int64_t item_sequence_number, |
| 35 int64_t document_sequence_number, | 35 int64_t document_sequence_number, |
| 36 scoped_refptr<SiteInstanceImpl> site_instance, | 36 scoped_refptr<SiteInstanceImpl> site_instance, |
| 37 const GURL& url, | 37 const GURL& url, |
| 38 const Referrer& referrer, | 38 const Referrer& referrer, |
| 39 const std::string& method, | 39 const std::string& method, |
| 40 int64_t post_id); | 40 int64_t post_id); |
| 41 | 41 |
| 42 // Creates a copy of this FrameNavigationEntry that can be modified | 42 // Creates a copy of this FrameNavigationEntry that can be modified |
| 43 // independently from the original. | 43 // independently from the original. |
| 44 FrameNavigationEntry* Clone() const; | 44 FrameNavigationEntry* Clone() const; |
| 45 | 45 |
| 46 // Updates all the members of this entry. | 46 // Updates all the members of this entry. |
| 47 void UpdateEntry(const std::string& frame_unique_name, | 47 void UpdateEntry(const std::string& frame_unique_name, |
| 48 int64_t item_sequence_number, | 48 int64_t item_sequence_number, |
| 49 int64_t document_sequence_number, | 49 int64_t document_sequence_number, |
| 50 SiteInstanceImpl* site_instance, | 50 SiteInstanceImpl* site_instance, |
| 51 const GURL& url, | 51 const GURL& url, |
| 52 const Referrer& referrer, | 52 const Referrer& referrer, |
| 53 const PageState& page_state, | 53 const PageState& page_state, |
| 54 const std::string& method, | 54 const std::string& method, |
| 55 int64_t post_id); | 55 int64_t post_id); |
| 56 | 56 |
| 57 // The ID of the FrameTreeNode this entry is for. -1 for the main frame, | |
| 58 // since we don't always know the FrameTreeNode ID when creating the overall | |
| 59 // NavigationEntry. | |
| 60 // TODO(creis): Consider removing |frame_tree_node_id| in favor of | |
| 61 // |frame_unique_name|, if we can move unique name computation to the browser | |
| 62 // process. | |
| 63 int frame_tree_node_id() const { return frame_tree_node_id_; } | |
| 64 void set_frame_tree_node_id(int frame_tree_node_id) { | |
| 65 frame_tree_node_id_ = frame_tree_node_id; | |
| 66 } | |
| 67 | |
| 68 // The unique name of the frame this entry is for. This is a stable name for | 57 // The unique name of the frame this entry is for. This is a stable name for |
| 69 // the frame based on its position in the tree and relation to other named | 58 // the frame based on its position in the tree and relation to other named |
| 70 // frames, which does not change after cross-process navigations or restores. | 59 // frames, which does not change after cross-process navigations or restores. |
| 71 // Only the main frame can have an empty name. | 60 // Only the main frame can have an empty name. |
| 72 // | 61 // |
| 73 // This is unique relative to other frames in the same page, but not among | 62 // This is unique relative to other frames in the same page, but not among |
| 74 // other pages (i.e., not globally unique). | 63 // other pages (i.e., not globally unique). |
| 75 const std::string& frame_unique_name() const { return frame_unique_name_; } | 64 const std::string& frame_unique_name() const { return frame_unique_name_; } |
| 76 void set_frame_unique_name(const std::string& frame_unique_name) { | 65 void set_frame_unique_name(const std::string& frame_unique_name) { |
| 77 frame_unique_name_ = frame_unique_name; | 66 frame_unique_name_ = frame_unique_name; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 friend class base::RefCounted<FrameNavigationEntry>; | 111 friend class base::RefCounted<FrameNavigationEntry>; |
| 123 virtual ~FrameNavigationEntry(); | 112 virtual ~FrameNavigationEntry(); |
| 124 | 113 |
| 125 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | 114 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING |
| 126 // Add all new fields to |UpdateEntry|. | 115 // Add all new fields to |UpdateEntry|. |
| 127 // TODO(creis): These fields have implications for session restore. This is | 116 // TODO(creis): These fields have implications for session restore. This is |
| 128 // currently managed by NavigationEntry, but the logic will move here. | 117 // currently managed by NavigationEntry, but the logic will move here. |
| 129 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | 118 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING |
| 130 | 119 |
| 131 // See the accessors above for descriptions. | 120 // See the accessors above for descriptions. |
| 132 int frame_tree_node_id_; | |
| 133 std::string frame_unique_name_; | 121 std::string frame_unique_name_; |
| 134 int64_t item_sequence_number_; | 122 int64_t item_sequence_number_; |
| 135 int64_t document_sequence_number_; | 123 int64_t document_sequence_number_; |
| 136 scoped_refptr<SiteInstanceImpl> site_instance_; | 124 scoped_refptr<SiteInstanceImpl> site_instance_; |
| 137 GURL url_; | 125 GURL url_; |
| 138 Referrer referrer_; | 126 Referrer referrer_; |
| 139 // TODO(creis): Change this to FrameState. | 127 // TODO(creis): Change this to FrameState. |
| 140 PageState page_state_; | 128 PageState page_state_; |
| 141 std::string method_; | 129 std::string method_; |
| 142 int64_t post_id_; | 130 int64_t post_id_; |
| 143 | 131 |
| 144 DISALLOW_COPY_AND_ASSIGN(FrameNavigationEntry); | 132 DISALLOW_COPY_AND_ASSIGN(FrameNavigationEntry); |
| 145 }; | 133 }; |
| 146 | 134 |
| 147 } // namespace content | 135 } // namespace content |
| 148 | 136 |
| 149 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_NAVIGATION_ENTRY_H_ | 137 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_NAVIGATION_ENTRY_H_ |
| OLD | NEW |