| 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 "base/basictypes.h" | 8 #include <stdint.h> |
| 9 |
| 10 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 10 #include "content/browser/site_instance_impl.h" | 12 #include "content/browser/site_instance_impl.h" |
| 11 #include "content/public/common/page_state.h" | 13 #include "content/public/common/page_state.h" |
| 12 #include "content/public/common/referrer.h" | 14 #include "content/public/common/referrer.h" |
| 13 | 15 |
| 14 namespace content { | 16 namespace content { |
| 15 | 17 |
| 16 // Represents a session history item for a particular frame. | 18 // Represents a session history item for a particular frame. |
| 17 // | 19 // |
| 18 // This class is refcounted and can be shared across multiple NavigationEntries. | 20 // This class is refcounted and can be shared across multiple NavigationEntries. |
| 19 // For now, it is owned by a single NavigationEntry and only tracks the main | 21 // For now, it is owned by a single NavigationEntry and only tracks the main |
| 20 // frame. | 22 // frame. |
| 21 // | 23 // |
| 22 // If SiteIsolationPolicy::UseSubframeNavigationEntries is true, there will be a | 24 // If SiteIsolationPolicy::UseSubframeNavigationEntries is true, there will be a |
| 23 // tree of FrameNavigationEntries in each NavigationEntry, one per frame. | 25 // tree of FrameNavigationEntries in each NavigationEntry, one per frame. |
| 24 // TODO(creis): Share these FrameNavigationEntries across NavigationEntries if | 26 // TODO(creis): Share these FrameNavigationEntries across NavigationEntries if |
| 25 // the frame hasn't changed. | 27 // the frame hasn't changed. |
| 26 class CONTENT_EXPORT FrameNavigationEntry | 28 class CONTENT_EXPORT FrameNavigationEntry |
| 27 : public base::RefCounted<FrameNavigationEntry> { | 29 : public base::RefCounted<FrameNavigationEntry> { |
| 28 public: | 30 public: |
| 29 explicit FrameNavigationEntry(int frame_tree_node_id); | 31 explicit FrameNavigationEntry(int frame_tree_node_id); |
| 30 FrameNavigationEntry(int frame_tree_node_id, | 32 FrameNavigationEntry(int frame_tree_node_id, |
| 31 const std::string& frame_unique_name, | 33 const std::string& frame_unique_name, |
| 32 int64 item_sequence_number, | 34 int64_t item_sequence_number, |
| 33 int64 document_sequence_number, | 35 int64_t document_sequence_number, |
| 34 SiteInstanceImpl* site_instance, | 36 SiteInstanceImpl* site_instance, |
| 35 const GURL& url, | 37 const GURL& url, |
| 36 const Referrer& referrer); | 38 const Referrer& referrer); |
| 37 | 39 |
| 38 // Creates a copy of this FrameNavigationEntry that can be modified | 40 // Creates a copy of this FrameNavigationEntry that can be modified |
| 39 // independently from the original. | 41 // independently from the original. |
| 40 FrameNavigationEntry* Clone() const; | 42 FrameNavigationEntry* Clone() const; |
| 41 | 43 |
| 42 // Updates all the members of this entry. | 44 // Updates all the members of this entry. |
| 43 void UpdateEntry(const std::string& frame_unique_name, | 45 void UpdateEntry(const std::string& frame_unique_name, |
| 44 int64 item_sequence_number, | 46 int64_t item_sequence_number, |
| 45 int64 document_sequence_number, | 47 int64_t document_sequence_number, |
| 46 SiteInstanceImpl* site_instance, | 48 SiteInstanceImpl* site_instance, |
| 47 const GURL& url, | 49 const GURL& url, |
| 48 const Referrer& referrer, | 50 const Referrer& referrer, |
| 49 const PageState& page_state); | 51 const PageState& page_state); |
| 50 | 52 |
| 51 // The ID of the FrameTreeNode this entry is for. -1 for the main frame, | 53 // The ID of the FrameTreeNode this entry is for. -1 for the main frame, |
| 52 // since we don't always know the FrameTreeNode ID when creating the overall | 54 // since we don't always know the FrameTreeNode ID when creating the overall |
| 53 // NavigationEntry. | 55 // NavigationEntry. |
| 54 // TODO(creis): Consider removing |frame_tree_node_id| in favor of | 56 // TODO(creis): Consider removing |frame_tree_node_id| in favor of |
| 55 // |frame_unique_name|, if we can move unique name computation to the browser | 57 // |frame_unique_name|, if we can move unique name computation to the browser |
| (...skipping 14 matching lines...) Expand all Loading... |
| 70 void set_frame_unique_name(const std::string& frame_unique_name) { | 72 void set_frame_unique_name(const std::string& frame_unique_name) { |
| 71 frame_unique_name_ = frame_unique_name; | 73 frame_unique_name_ = frame_unique_name; |
| 72 } | 74 } |
| 73 | 75 |
| 74 // Keeps track of where this entry belongs in the frame's session history. | 76 // Keeps track of where this entry belongs in the frame's session history. |
| 75 // The item sequence number identifies each stop in the back/forward history | 77 // The item sequence number identifies each stop in the back/forward history |
| 76 // and is globally unique. The document sequence number increments for each | 78 // and is globally unique. The document sequence number increments for each |
| 77 // new document and is also globally unique. In-page navigations get a new | 79 // new document and is also globally unique. In-page navigations get a new |
| 78 // item sequence number but the same document sequence number. These numbers | 80 // item sequence number but the same document sequence number. These numbers |
| 79 // should not change once assigned. | 81 // should not change once assigned. |
| 80 void set_item_sequence_number(int64 item_sequence_number); | 82 void set_item_sequence_number(int64_t item_sequence_number); |
| 81 int64 item_sequence_number() const { return item_sequence_number_; } | 83 int64_t item_sequence_number() const { return item_sequence_number_; } |
| 82 void set_document_sequence_number(int64 document_sequence_number); | 84 void set_document_sequence_number(int64_t document_sequence_number); |
| 83 int64 document_sequence_number() const { return document_sequence_number_; } | 85 int64_t document_sequence_number() const { return document_sequence_number_; } |
| 84 | 86 |
| 85 // The SiteInstance responsible for rendering this frame. All frames sharing | 87 // The SiteInstance responsible for rendering this frame. All frames sharing |
| 86 // a SiteInstance must live in the same process. This is a refcounted pointer | 88 // a SiteInstance must live in the same process. This is a refcounted pointer |
| 87 // that keeps the SiteInstance (not necessarily the process) alive as long as | 89 // that keeps the SiteInstance (not necessarily the process) alive as long as |
| 88 // this object remains in the session history. | 90 // this object remains in the session history. |
| 89 void set_site_instance(SiteInstanceImpl* site_instance) { | 91 void set_site_instance(SiteInstanceImpl* site_instance) { |
| 90 site_instance_ = site_instance; | 92 site_instance_ = site_instance; |
| 91 } | 93 } |
| 92 SiteInstanceImpl* site_instance() const { return site_instance_.get(); } | 94 SiteInstanceImpl* site_instance() const { return site_instance_.get(); } |
| 93 | 95 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 109 | 111 |
| 110 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | 112 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING |
| 111 // Add all new fields to |UpdateEntry|. | 113 // Add all new fields to |UpdateEntry|. |
| 112 // TODO(creis): These fields have implications for session restore. This is | 114 // TODO(creis): These fields have implications for session restore. This is |
| 113 // currently managed by NavigationEntry, but the logic will move here. | 115 // currently managed by NavigationEntry, but the logic will move here. |
| 114 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | 116 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING |
| 115 | 117 |
| 116 // See the accessors above for descriptions. | 118 // See the accessors above for descriptions. |
| 117 int frame_tree_node_id_; | 119 int frame_tree_node_id_; |
| 118 std::string frame_unique_name_; | 120 std::string frame_unique_name_; |
| 119 int64 item_sequence_number_; | 121 int64_t item_sequence_number_; |
| 120 int64 document_sequence_number_; | 122 int64_t document_sequence_number_; |
| 121 scoped_refptr<SiteInstanceImpl> site_instance_; | 123 scoped_refptr<SiteInstanceImpl> site_instance_; |
| 122 GURL url_; | 124 GURL url_; |
| 123 Referrer referrer_; | 125 Referrer referrer_; |
| 124 // TODO(creis): Change this to FrameState. | 126 // TODO(creis): Change this to FrameState. |
| 125 PageState page_state_; | 127 PageState page_state_; |
| 126 | 128 |
| 127 DISALLOW_COPY_AND_ASSIGN(FrameNavigationEntry); | 129 DISALLOW_COPY_AND_ASSIGN(FrameNavigationEntry); |
| 128 }; | 130 }; |
| 129 | 131 |
| 130 } // namespace content | 132 } // namespace content |
| 131 | 133 |
| 132 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_NAVIGATION_ENTRY_H_ | 134 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_NAVIGATION_ENTRY_H_ |
| OLD | NEW |