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

Side by Side Diff: content/browser/frame_host/frame_navigation_entry.h

Issue 1102563003: Fill in FrameNavigationEntries for auto subframe navigations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes Created 5 years, 7 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
« 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/referrer.h" 11 #include "content/public/common/referrer.h"
12 12
13 namespace content { 13 namespace content {
14 14
15 // Represents a session history item for a particular frame. 15 // Represents a session history item for a particular frame.
16 // 16 //
17 // This class is refcounted and can be shared across multiple NavigationEntries. 17 // 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 18 // For now, it is owned by a single NavigationEntry and only tracks the main
19 // frame. 19 // frame.
20 // 20 //
21 // TODO(creis): In --site-per-process, fill in a tree of FrameNavigationEntries 21 // TODO(creis): In --site-per-process, fill in a tree of FrameNavigationEntries
22 // in each NavigationEntry, one per frame. FrameNavigationEntries may be shared 22 // in each NavigationEntry, one per frame. FrameNavigationEntries may be shared
23 // across NavigationEntries if the frame hasn't changed. 23 // across NavigationEntries if the frame hasn't changed.
24 class CONTENT_EXPORT FrameNavigationEntry 24 class CONTENT_EXPORT FrameNavigationEntry
25 : public base::RefCounted<FrameNavigationEntry> { 25 : public base::RefCounted<FrameNavigationEntry> {
26 public: 26 public:
27 FrameNavigationEntry(); 27 // TODO(creis): We should not use FTN IDs here, since they will change if you
28 FrameNavigationEntry(SiteInstanceImpl* site_instance, 28 // leave a page and come back later. We should evaluate whether Blink's
29 // frame sequence numbers or unique names would work instead, similar to
30 // HistoryNode.
31 explicit FrameNavigationEntry(int64 frame_tree_node_id);
32 FrameNavigationEntry(int64 frame_tree_node_id,
33 SiteInstanceImpl* site_instance,
29 const GURL& url, 34 const GURL& url,
30 const Referrer& referrer); 35 const Referrer& referrer);
31 36
32 // Creates a copy of this FrameNavigationEntry that can be modified 37 // Creates a copy of this FrameNavigationEntry that can be modified
33 // independently from the original. 38 // independently from the original.
34 FrameNavigationEntry* Clone() const; 39 FrameNavigationEntry* Clone() const;
35 40
41 // Updates all the members of this entry.
42 void UpdateEntry(SiteInstanceImpl* site_instance,
43 const GURL& url,
44 const Referrer& referrer);
45
46 // The ID of the FrameTreeNode this entry is for. -1 for the main frame,
47 // since we don't always know the FrameTreeNode ID when creating the overall
48 // NavigationEntry.
49 // TODO(creis): Replace with frame sequence number or unique name.
50 int64 frame_tree_node_id() const { return frame_tree_node_id_; }
51
36 // The SiteInstance responsible for rendering this frame. All frames sharing 52 // The SiteInstance responsible for rendering this frame. All frames sharing
37 // a SiteInstance must live in the same process. This is a refcounted pointer 53 // 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 54 // that keeps the SiteInstance (not necessarily the process) alive as long as
39 // this object remains in the session history. 55 // this object remains in the session history.
40 void set_site_instance(SiteInstanceImpl* site_instance) { 56 void set_site_instance(SiteInstanceImpl* site_instance) {
41 site_instance_ = site_instance; 57 site_instance_ = site_instance;
42 } 58 }
43 SiteInstanceImpl* site_instance() const { return site_instance_.get(); } 59 SiteInstanceImpl* site_instance() const { return site_instance_.get(); }
44 60
45 // The actual URL loaded in the frame. This is in contrast to the virtual 61 // The actual URL loaded in the frame. This is in contrast to the virtual
46 // URL, which is shown to the user. 62 // URL, which is shown to the user.
47 void set_url(const GURL& url) { url_ = url; } 63 void set_url(const GURL& url) { url_ = url; }
48 const GURL& url() const { return url_; } 64 const GURL& url() const { return url_; }
49 65
50 // The referring URL. Can be empty. 66 // The referring URL. Can be empty.
51 void set_referrer(const Referrer& referrer) { referrer_ = referrer; } 67 void set_referrer(const Referrer& referrer) { referrer_ = referrer; }
52 const Referrer& referrer() const { return referrer_; } 68 const Referrer& referrer() const { return referrer_; }
53 69
54 private: 70 private:
55 friend class base::RefCounted<FrameNavigationEntry>; 71 friend class base::RefCounted<FrameNavigationEntry>;
56 virtual ~FrameNavigationEntry(); 72 virtual ~FrameNavigationEntry();
57 73
58 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING 74 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
59 // For all new fields, update |Clone|. 75 // For all new fields, update |Clone|.
60 // TODO(creis): These fields have implications for session restore. This is 76 // TODO(creis): These fields have implications for session restore. This is
61 // currently managed by NavigationEntry, but the logic will move here. 77 // currently managed by NavigationEntry, but the logic will move here.
62 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING 78 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
63 79
64 // See the accessors above for descriptions. 80 // See the accessors above for descriptions.
81 int64 frame_tree_node_id_;
65 scoped_refptr<SiteInstanceImpl> site_instance_; 82 scoped_refptr<SiteInstanceImpl> site_instance_;
66 GURL url_; 83 GURL url_;
67 Referrer referrer_; 84 Referrer referrer_;
68 85
69 DISALLOW_COPY_AND_ASSIGN(FrameNavigationEntry); 86 DISALLOW_COPY_AND_ASSIGN(FrameNavigationEntry);
70 }; 87 };
71 88
72 } // namespace content 89 } // namespace content
73 90
74 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_NAVIGATION_ENTRY_H_ 91 #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