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

Side by Side Diff: content/browser/frame_host/frame_navigation_entry.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | content/browser/frame_host/frame_navigation_entry.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/referrer.h" 12 #include "content/public/common/referrer.h"
12 13
13 namespace content { 14 namespace content {
14 15
15 // Represents a session history item for a particular frame. 16 // Represents a session history item for a particular frame.
16 // 17 //
17 // This class is refcounted and can be shared across multiple NavigationEntries. 18 // This class is refcounted and can be shared across multiple NavigationEntries.
18 // 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
19 // frame. 20 // frame.
20 // 21 //
21 // 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
22 // in each NavigationEntry, one per frame. FrameNavigationEntries may be shared 23 // in each NavigationEntry, one per frame. FrameNavigationEntries may be shared
23 // across NavigationEntries if the frame hasn't changed. 24 // across NavigationEntries if the frame hasn't changed.
24 class CONTENT_EXPORT FrameNavigationEntry 25 class CONTENT_EXPORT FrameNavigationEntry
25 : public base::RefCounted<FrameNavigationEntry> { 26 : public base::RefCounted<FrameNavigationEntry> {
26 public: 27 public:
27 FrameNavigationEntry(); 28 FrameNavigationEntry();
28 FrameNavigationEntry(SiteInstanceImpl* site_instance, 29 FrameNavigationEntry(SiteInstanceImpl* instance,
29 const GURL& url, 30 const GURL& url,
30 const Referrer& referrer); 31 const Referrer& referrer);
31 32
32 // Creates a copy of this FrameNavigationEntry that can be modified 33 // Creates a copy of this FrameNavigationEntry that can be modified
33 // independently from the original. 34 // independently from the original.
34 FrameNavigationEntry* Clone() const; 35 FrameNavigationEntry* Clone() const;
35 36
37 // The ID of the FrameTreeNode this is associated with, which does not change
38 // across process swaps or if the FrameTreeNode itself is deleted and later
39 // restored for a history navigation.
40 // TODO(creis): This should probably be set in the constructor.
41 void set_frame_tree_node_id(int frame_tree_node_id) {
42 frame_tree_node_id_ = frame_tree_node_id;
43 }
44 int frame_tree_node_id() const { return frame_tree_node_id_; }
45
36 // The SiteInstance responsible for rendering this frame. All frames sharing 46 // The SiteInstance responsible for rendering this frame. All frames sharing
37 // a SiteInstance must live in the same process. This is a refcounted pointer 47 // a SiteInstance must live in the same process. This is a refcounted pointer
38 // that keeps the SiteInstance (not necessarily the process) alive as long as 48 // that keeps the SiteInstance (not necessarily the process) alive as long as
39 // this object remains in the session history. 49 // this object remains in the session history.
40 void set_site_instance(SiteInstanceImpl* site_instance) { 50 void set_site_instance(SiteInstanceImpl* site_instance) {
41 site_instance_ = site_instance; 51 site_instance_ = site_instance;
42 } 52 }
43 SiteInstanceImpl* site_instance() const { return site_instance_.get(); } 53 SiteInstanceImpl* site_instance() const { return site_instance_.get(); }
44 54
45 // The actual URL loaded in the frame. This is in contrast to the virtual 55 // The actual URL loaded in the frame. This is in contrast to the virtual
46 // URL, which is shown to the user. 56 // URL, which is shown to the user.
47 void set_url(const GURL& url) { url_ = url; } 57 void set_url(const GURL& url) { url_ = url; }
48 const GURL& url() const { return url_; } 58 const GURL& url() const { return url_; }
49 59
50 // The referring URL. Can be empty. 60 // The referring URL. Can be empty.
51 void set_referrer(const Referrer& referrer) { referrer_ = referrer; } 61 void set_referrer(const Referrer& referrer) { referrer_ = referrer; }
52 const Referrer& referrer() const { return referrer_; } 62 const Referrer& referrer() const { return referrer_; }
53 63
64 // Keeps track of where this entry belongs in the frame's session history.
65 void set_item_sequence_number(int64 item_sequence_number) {
66 item_sequence_number_ = item_sequence_number;
67 }
68 int64 item_sequence_number() { return item_sequence_number_; }
69 void set_document_sequence_number(int64 document_sequence_number) {
70 document_sequence_number_ = document_sequence_number;
71 }
72 int64 document_sequence_number() { return document_sequence_number_; }
73
74 // TODO(creis): Make these FrameState.
75 void set_page_state(const PageState& state) { page_state_ = state; }
76 const PageState& page_state() const { return page_state_; }
77
54 private: 78 private:
55 friend class base::RefCounted<FrameNavigationEntry>; 79 friend class base::RefCounted<FrameNavigationEntry>;
56 virtual ~FrameNavigationEntry(); 80 virtual ~FrameNavigationEntry();
57 81
58 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING 82 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
59 // For all new fields, update |Clone|. 83 // For all new fields, update |Clone|.
60 // TODO(creis): These fields have implications for session restore. This is 84 // TODO(creis): These fields have implications for session restore. This is
61 // currently managed by NavigationEntry, but the logic will move here. 85 // currently managed by NavigationEntry, but the logic will move here.
62 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING 86 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
63 87
64 // See the accessors above for descriptions. 88 // See the accessors above for descriptions.
65 scoped_refptr<SiteInstanceImpl> site_instance_; 89 scoped_refptr<SiteInstanceImpl> site_instance_;
66 GURL url_; 90 GURL url_;
67 Referrer referrer_; 91 Referrer referrer_;
92 PageState page_state_;
93 int frame_tree_node_id_;
94 int64 item_sequence_number_;
95 int64 document_sequence_number_;
68 96
69 DISALLOW_COPY_AND_ASSIGN(FrameNavigationEntry); 97 DISALLOW_COPY_AND_ASSIGN(FrameNavigationEntry);
70 }; 98 };
71 99
72 } // namespace content 100 } // namespace content
73 101
74 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_NAVIGATION_ENTRY_H_ 102 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_NAVIGATION_ENTRY_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/frame_host/frame_navigation_entry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698