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 // If SiteIsolationPolicy::UseSubframeNavigationEntries is true, there will be a |
23 // in each NavigationEntry, one per frame. FrameNavigationEntries may be shared | 23 // tree of FrameNavigationEntries in each NavigationEntry, one per frame. |
24 // across NavigationEntries if the frame hasn't changed. | 24 // TODO(creis): Share these FrameNavigationEntries across NavigationEntries if |
25 // the frame hasn't changed. | |
25 class CONTENT_EXPORT FrameNavigationEntry | 26 class CONTENT_EXPORT FrameNavigationEntry |
26 : public base::RefCounted<FrameNavigationEntry> { | 27 : public base::RefCounted<FrameNavigationEntry> { |
27 public: | 28 public: |
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 | |
30 // unique names would work instead, similar to HistoryNode. | |
31 explicit FrameNavigationEntry(int frame_tree_node_id); | 29 explicit FrameNavigationEntry(int frame_tree_node_id); |
32 FrameNavigationEntry(int frame_tree_node_id, | 30 FrameNavigationEntry(int frame_tree_node_id, |
31 std::string target, | |
33 int64 item_sequence_number, | 32 int64 item_sequence_number, |
34 int64 document_sequence_number, | 33 int64 document_sequence_number, |
35 SiteInstanceImpl* site_instance, | 34 SiteInstanceImpl* site_instance, |
36 const GURL& url, | 35 const GURL& url, |
37 const Referrer& referrer); | 36 const Referrer& referrer); |
38 | 37 |
39 // Creates a copy of this FrameNavigationEntry that can be modified | 38 // Creates a copy of this FrameNavigationEntry that can be modified |
40 // independently from the original. | 39 // independently from the original. |
41 FrameNavigationEntry* Clone() const; | 40 FrameNavigationEntry* Clone() const; |
42 | 41 |
43 // Updates all the members of this entry. | 42 // Updates all the members of this entry. |
44 void UpdateEntry(int64 item_sequence_number, | 43 void UpdateEntry(std::string target, |
44 int64 item_sequence_number, | |
45 int64 document_sequence_number, | 45 int64 document_sequence_number, |
46 SiteInstanceImpl* site_instance, | 46 SiteInstanceImpl* site_instance, |
47 const GURL& url, | 47 const GURL& url, |
48 const Referrer& referrer, | 48 const Referrer& referrer, |
49 const PageState& page_state); | 49 const PageState& page_state); |
50 | 50 |
51 // 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, |
52 // 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 |
53 // NavigationEntry. | 53 // NavigationEntry. |
54 // TODO(creis): Replace with frame sequence number or unique name. | 54 // TODO(creis): Consider removing |frame_tree_node_id| in favor of |target|, |
55 // if we can move unique name computation to the browser process. | |
55 int frame_tree_node_id() const { return frame_tree_node_id_; } | 56 int frame_tree_node_id() const { return frame_tree_node_id_; } |
56 | 57 |
58 // The unique name of the frame this entry is for. This is a stable name for | |
59 // the frame based on its position in the tree and relation to other named | |
60 // frames, which does not change after cross-process navigations or restores. | |
61 // Only the main frame can have an empty name. | |
Avi (use Gerrit)
2015/11/09 20:58:26
If this is a "unique name", why is this called "ta
Charlie Reis
2015/11/09 21:28:48
The risk with putting a "unique name" on FrameNavi
Avi (use Gerrit)
2015/11/09 21:30:58
That sounds like it doesn't avoid what you were wo
Charlie Reis
2015/11/09 21:38:41
I think it does. I was worried that it would be o
Avi (use Gerrit)
2015/11/09 21:44:39
If you're OK with "unique frame name" then I'm OK
Charlie Reis
2015/11/09 21:49:24
Nate, what would you think about changing blink::H
Nate Chapin
2015/11/09 21:52:23
I'd prefer frameUniqueName() to uniqueFrameName(),
Charlie Reis
2015/11/09 22:19:41
Thanks. I went with that, and we can update the o
| |
62 std::string target() const { return target_; } | |
63 void set_target(std::string target) { target_ = target; } | |
64 | |
57 // Keeps track of where this entry belongs in the frame's session history. | 65 // 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 | 66 // The item sequence number identifies each stop in the back/forward history |
59 // and is globally unique. The document sequence number increments for each | 67 // 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 | 68 // new document and is also globally unique. In-page navigations get a new |
61 // item sequence number but the same document sequence number. These numbers | 69 // item sequence number but the same document sequence number. These numbers |
62 // should not change once assigned. | 70 // should not change once assigned. |
63 void set_item_sequence_number(int64 item_sequence_number); | 71 void set_item_sequence_number(int64 item_sequence_number); |
64 int64 item_sequence_number() const { return item_sequence_number_; } | 72 int64 item_sequence_number() const { return item_sequence_number_; } |
65 void set_document_sequence_number(int64 document_sequence_number); | 73 void set_document_sequence_number(int64 document_sequence_number); |
66 int64 document_sequence_number() const { return document_sequence_number_; } | 74 int64 document_sequence_number() const { return document_sequence_number_; } |
(...skipping 17 matching lines...) Expand all Loading... | |
84 const Referrer& referrer() const { return referrer_; } | 92 const Referrer& referrer() const { return referrer_; } |
85 | 93 |
86 void set_page_state(const PageState& page_state) { page_state_ = page_state; } | 94 void set_page_state(const PageState& page_state) { page_state_ = page_state; } |
87 const PageState& page_state() const { return page_state_; } | 95 const PageState& page_state() const { return page_state_; } |
88 | 96 |
89 private: | 97 private: |
90 friend class base::RefCounted<FrameNavigationEntry>; | 98 friend class base::RefCounted<FrameNavigationEntry>; |
91 virtual ~FrameNavigationEntry(); | 99 virtual ~FrameNavigationEntry(); |
92 | 100 |
93 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | 101 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING |
94 // For all new fields, update |Clone|. | 102 // Add all new fields to |UpdateEntry|. |
95 // TODO(creis): These fields have implications for session restore. This is | 103 // TODO(creis): These fields have implications for session restore. This is |
96 // currently managed by NavigationEntry, but the logic will move here. | 104 // currently managed by NavigationEntry, but the logic will move here. |
97 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | 105 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING |
98 | 106 |
99 // See the accessors above for descriptions. | 107 // See the accessors above for descriptions. |
100 int frame_tree_node_id_; | 108 int frame_tree_node_id_; |
109 std::string target_; | |
101 int64 item_sequence_number_; | 110 int64 item_sequence_number_; |
102 int64 document_sequence_number_; | 111 int64 document_sequence_number_; |
103 scoped_refptr<SiteInstanceImpl> site_instance_; | 112 scoped_refptr<SiteInstanceImpl> site_instance_; |
104 GURL url_; | 113 GURL url_; |
105 Referrer referrer_; | 114 Referrer referrer_; |
106 // TODO(creis): Change this to FrameState. | 115 // TODO(creis): Change this to FrameState. |
107 PageState page_state_; | 116 PageState page_state_; |
108 | 117 |
109 DISALLOW_COPY_AND_ASSIGN(FrameNavigationEntry); | 118 DISALLOW_COPY_AND_ASSIGN(FrameNavigationEntry); |
110 }; | 119 }; |
111 | 120 |
112 } // namespace content | 121 } // namespace content |
113 | 122 |
114 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_NAVIGATION_ENTRY_H_ | 123 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_NAVIGATION_ENTRY_H_ |
OLD | NEW |