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

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

Issue 1006693002: Add NavigationEntryImpl::TreeNode for tracking FrameNavigationEntries. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Initial patch 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
« 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 currently owned by a single NavigationEntry and only tracks the 17 // This class is refcounted and can be shared across multiple NavigationEntries.
18 // main frame. 18 // For now, it is owned by a single NavigationEntry and only tracks the main
19 // frame.
19 // 20 //
20 // TODO(creis): Keep a tree of FrameNavigationEntries in each NavigationEntry, 21 // TODO(creis): In --site-per-process, fill in a tree of FrameNavigationEntries
21 // one per frame. FrameNavigationEntries may be shared across NavigationEntries 22 // in each NavigationEntry, one per frame. FrameNavigationEntries may be shared
22 // if the frame hasn't changed. 23 // across NavigationEntries if the frame hasn't changed.
23 class CONTENT_EXPORT FrameNavigationEntry { 24 class CONTENT_EXPORT FrameNavigationEntry
25 : public base::RefCounted<FrameNavigationEntry> {
24 public: 26 public:
25 FrameNavigationEntry(); 27 FrameNavigationEntry();
26 FrameNavigationEntry(SiteInstanceImpl* site_instance, 28 FrameNavigationEntry(SiteInstanceImpl* site_instance,
27 const GURL& url, 29 const GURL& url,
28 const Referrer& referrer); 30 const Referrer& referrer);
29 virtual ~FrameNavigationEntry(); 31
32 // Creates a copy of this FrameNavigationEntry that can be modified
33 // independently from the original.
34 FrameNavigationEntry* Clone() const;
30 35
31 // The SiteInstance responsible for rendering this frame. All frames sharing 36 // The SiteInstance responsible for rendering this frame. All frames sharing
32 // a SiteInstance must live in the same process. This is a refcounted pointer 37 // a SiteInstance must live in the same process. This is a refcounted pointer
33 // that keeps the SiteInstance (not necessarily the process) alive as long as 38 // that keeps the SiteInstance (not necessarily the process) alive as long as
34 // this object remains in the session history. 39 // this object remains in the session history.
35 void set_site_instance(SiteInstanceImpl* site_instance) { 40 void set_site_instance(SiteInstanceImpl* site_instance) {
36 site_instance_ = site_instance; 41 site_instance_ = site_instance;
37 } 42 }
38 SiteInstanceImpl* site_instance() const { return site_instance_.get(); } 43 SiteInstanceImpl* site_instance() const { return site_instance_.get(); }
39 44
40 // The actual URL loaded in the frame. This is in contrast to the virtual 45 // The actual URL loaded in the frame. This is in contrast to the virtual
41 // URL, which is shown to the user. 46 // URL, which is shown to the user.
42 // TODO(creis): Move virtual URL and related members to FrameNavigationEntry.
Charlie Reis 2015/03/12 23:29:55 Unrelated, but I realized this TODO wasn't true.
43 void set_url(const GURL& url) { url_ = url; } 47 void set_url(const GURL& url) { url_ = url; }
44 const GURL& url() const { return url_; } 48 const GURL& url() const { return url_; }
45 49
46 // The referring URL. Can be empty. 50 // The referring URL. Can be empty.
47 void set_referrer(const Referrer& referrer) { referrer_ = referrer; } 51 void set_referrer(const Referrer& referrer) { referrer_ = referrer; }
48 const Referrer& referrer() const { return referrer_; } 52 const Referrer& referrer() const { return referrer_; }
49 53
50 private: 54 private:
55 friend class base::RefCounted<FrameNavigationEntry>;
56 virtual ~FrameNavigationEntry();
57
58 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
59 // For all new fields, update |Clone|.
51 // TODO(creis): These fields have implications for session restore. This is 60 // TODO(creis): These fields have implications for session restore. This is
52 // currently managed by NavigationEntry, but the logic will move here. 61 // currently managed by NavigationEntry, but the logic will move here.
62 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
53 63
54 // See the accessors above for descriptions. 64 // See the accessors above for descriptions.
55 scoped_refptr<SiteInstanceImpl> site_instance_; 65 scoped_refptr<SiteInstanceImpl> site_instance_;
56 GURL url_; 66 GURL url_;
57 Referrer referrer_; 67 Referrer referrer_;
58 68
59 // Copy and assignment is explicitly allowed for this class. 69 DISALLOW_COPY_AND_ASSIGN(FrameNavigationEntry);
60 }; 70 };
61 71
62 } // namespace content 72 } // namespace content
63 73
64 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_NAVIGATION_ENTRY_H_ 74 #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