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 "base/basictypes.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "content/browser/site_instance_impl.h" | 10 #include "content/browser/site_instance_impl.h" |
11 #include "content/public/common/page_state.h" | 11 #include "content/public/common/page_state.h" |
12 #include "content/public/common/referrer.h" | 12 #include "content/public/common/referrer.h" |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 | 15 |
16 // Represents a session history item for a particular frame. | 16 // Represents a session history item for a particular frame. |
17 // | 17 // |
18 // This class is refcounted and can be shared across multiple NavigationEntries. | 18 // 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 | 19 // For now, it is owned by a single NavigationEntry and only tracks the main |
20 // frame. | 20 // frame. |
21 // | 21 // |
22 // TODO(creis): In --site-per-process, fill in a tree of FrameNavigationEntries | 22 // TODO(creis): In --site-per-process, fill in a tree of FrameNavigationEntries |
23 // in each NavigationEntry, one per frame. FrameNavigationEntries may be shared | 23 // in each NavigationEntry, one per frame. FrameNavigationEntries may be shared |
24 // across NavigationEntries if the frame hasn't changed. | 24 // across NavigationEntries if the frame hasn't changed. |
25 class CONTENT_EXPORT FrameNavigationEntry | 25 class CONTENT_EXPORT FrameNavigationEntry |
26 : public base::RefCounted<FrameNavigationEntry> { | 26 : public base::RefCounted<FrameNavigationEntry> { |
27 public: | 27 public: |
28 // TODO(creis): We should not use FTN IDs here, since they will change if you | 28 // TODO(creis): We should not use FTN IDs here, since they will change if you |
29 // leave a page and come back later. We should evaluate whether Blink's | 29 // leave a page and come back later. We should evaluate whether Blink's |
30 // frame sequence numbers or unique names would work instead, similar to | 30 // unique names would work instead, similar to HistoryNode. |
31 // HistoryNode. | |
32 explicit FrameNavigationEntry(int64 frame_tree_node_id); | 31 explicit FrameNavigationEntry(int64 frame_tree_node_id); |
33 FrameNavigationEntry(int64 frame_tree_node_id, | 32 FrameNavigationEntry(int64 frame_tree_node_id, |
| 33 int64 item_sequence_number, |
| 34 int64 document_sequence_number, |
34 SiteInstanceImpl* site_instance, | 35 SiteInstanceImpl* site_instance, |
35 const GURL& url, | 36 const GURL& url, |
36 const Referrer& referrer); | 37 const Referrer& referrer); |
37 | 38 |
38 // Creates a copy of this FrameNavigationEntry that can be modified | 39 // Creates a copy of this FrameNavigationEntry that can be modified |
39 // independently from the original. | 40 // independently from the original. |
40 FrameNavigationEntry* Clone() const; | 41 FrameNavigationEntry* Clone() const; |
41 | 42 |
42 // Updates all the members of this entry. | 43 // Updates all the members of this entry. |
43 void UpdateEntry(SiteInstanceImpl* site_instance, | 44 void UpdateEntry(int64 item_sequence_number, |
| 45 int64 document_sequence_number, |
| 46 SiteInstanceImpl* site_instance, |
44 const GURL& url, | 47 const GURL& url, |
45 const Referrer& referrer, | 48 const Referrer& referrer, |
46 const PageState& page_state); | 49 const PageState& page_state); |
47 | 50 |
48 // The ID of the FrameTreeNode this entry is for. -1 for the main frame, | 51 // The ID of the FrameTreeNode this entry is for. -1 for the main frame, |
49 // since we don't always know the FrameTreeNode ID when creating the overall | 52 // since we don't always know the FrameTreeNode ID when creating the overall |
50 // NavigationEntry. | 53 // NavigationEntry. |
51 // TODO(creis): Replace with frame sequence number or unique name. | 54 // TODO(creis): Replace with frame sequence number or unique name. |
52 int64 frame_tree_node_id() const { return frame_tree_node_id_; } | 55 int64 frame_tree_node_id() const { return frame_tree_node_id_; } |
53 | 56 |
| 57 // Keeps track of where this entry belongs in the frame's session history. |
| 58 // The item sequence number identifies each stop in the back/forward history |
| 59 // and is globally unique. The document sequence number increments for each |
| 60 // new document and is also globally unique. In-page navigations get a new |
| 61 // item sequence number but the same document sequence number. |
| 62 void set_item_sequence_number(int64 item_sequence_number) { |
| 63 item_sequence_number_ = item_sequence_number; |
| 64 } |
| 65 int64 item_sequence_number() const { return item_sequence_number_; } |
| 66 void set_document_sequence_number(int64 document_sequence_number) { |
| 67 document_sequence_number_ = document_sequence_number; |
| 68 } |
| 69 int64 document_sequence_number() const { return document_sequence_number_; } |
| 70 |
54 // The SiteInstance responsible for rendering this frame. All frames sharing | 71 // The SiteInstance responsible for rendering this frame. All frames sharing |
55 // a SiteInstance must live in the same process. This is a refcounted pointer | 72 // a SiteInstance must live in the same process. This is a refcounted pointer |
56 // that keeps the SiteInstance (not necessarily the process) alive as long as | 73 // that keeps the SiteInstance (not necessarily the process) alive as long as |
57 // this object remains in the session history. | 74 // this object remains in the session history. |
58 void set_site_instance(SiteInstanceImpl* site_instance) { | 75 void set_site_instance(SiteInstanceImpl* site_instance) { |
59 site_instance_ = site_instance; | 76 site_instance_ = site_instance; |
60 } | 77 } |
61 SiteInstanceImpl* site_instance() const { return site_instance_.get(); } | 78 SiteInstanceImpl* site_instance() const { return site_instance_.get(); } |
62 | 79 |
63 // The actual URL loaded in the frame. This is in contrast to the virtual | 80 // The actual URL loaded in the frame. This is in contrast to the virtual |
(...skipping 13 matching lines...) Expand all Loading... |
77 virtual ~FrameNavigationEntry(); | 94 virtual ~FrameNavigationEntry(); |
78 | 95 |
79 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | 96 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING |
80 // For all new fields, update |Clone|. | 97 // For all new fields, update |Clone|. |
81 // TODO(creis): These fields have implications for session restore. This is | 98 // TODO(creis): These fields have implications for session restore. This is |
82 // currently managed by NavigationEntry, but the logic will move here. | 99 // currently managed by NavigationEntry, but the logic will move here. |
83 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | 100 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING |
84 | 101 |
85 // See the accessors above for descriptions. | 102 // See the accessors above for descriptions. |
86 int64 frame_tree_node_id_; | 103 int64 frame_tree_node_id_; |
| 104 int64 item_sequence_number_; |
| 105 int64 document_sequence_number_; |
87 scoped_refptr<SiteInstanceImpl> site_instance_; | 106 scoped_refptr<SiteInstanceImpl> site_instance_; |
88 GURL url_; | 107 GURL url_; |
89 Referrer referrer_; | 108 Referrer referrer_; |
90 // TODO(creis): Change this to FrameState. | 109 // TODO(creis): Change this to FrameState. |
91 PageState page_state_; | 110 PageState page_state_; |
92 | 111 |
93 DISALLOW_COPY_AND_ASSIGN(FrameNavigationEntry); | 112 DISALLOW_COPY_AND_ASSIGN(FrameNavigationEntry); |
94 }; | 113 }; |
95 | 114 |
96 } // namespace content | 115 } // namespace content |
97 | 116 |
98 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_NAVIGATION_ENTRY_H_ | 117 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_NAVIGATION_ENTRY_H_ |
OLD | NEW |