[Session restore] Rename group name Enabled to Restore.
[chromium-blink-merge.git] / content / browser / frame_host / frame_navigation_entry.h
blob2d38a2533f1edb63b280e12f449cacbce0697cf7
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_FRAME_HOST_FRAME_NAVIGATION_ENTRY_H_
6 #define CONTENT_BROWSER_FRAME_HOST_FRAME_NAVIGATION_ENTRY_H_
8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h"
10 #include "content/browser/site_instance_impl.h"
11 #include "content/public/common/referrer.h"
13 namespace content {
15 // Represents a session history item for a particular frame.
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
19 // frame.
21 // TODO(creis): In --site-per-process, fill in a tree of FrameNavigationEntries
22 // in each NavigationEntry, one per frame. FrameNavigationEntries may be shared
23 // across NavigationEntries if the frame hasn't changed.
24 class CONTENT_EXPORT FrameNavigationEntry
25 : public base::RefCounted<FrameNavigationEntry> {
26 public:
27 FrameNavigationEntry();
28 FrameNavigationEntry(SiteInstanceImpl* site_instance,
29 const GURL& url,
30 const Referrer& referrer);
32 // Creates a copy of this FrameNavigationEntry that can be modified
33 // independently from the original.
34 FrameNavigationEntry* Clone() const;
36 // The SiteInstance responsible for rendering this frame. All frames sharing
37 // 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
39 // this object remains in the session history.
40 void set_site_instance(SiteInstanceImpl* site_instance) {
41 site_instance_ = site_instance;
43 SiteInstanceImpl* site_instance() const { return site_instance_.get(); }
45 // The actual URL loaded in the frame. This is in contrast to the virtual
46 // URL, which is shown to the user.
47 void set_url(const GURL& url) { url_ = url; }
48 const GURL& url() const { return url_; }
50 // The referring URL. Can be empty.
51 void set_referrer(const Referrer& referrer) { referrer_ = referrer; }
52 const Referrer& referrer() const { return referrer_; }
54 private:
55 friend class base::RefCounted<FrameNavigationEntry>;
56 virtual ~FrameNavigationEntry();
58 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
59 // For all new fields, update |Clone|.
60 // TODO(creis): These fields have implications for session restore. This is
61 // currently managed by NavigationEntry, but the logic will move here.
62 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
64 // See the accessors above for descriptions.
65 scoped_refptr<SiteInstanceImpl> site_instance_;
66 GURL url_;
67 Referrer referrer_;
69 DISALLOW_COPY_AND_ASSIGN(FrameNavigationEntry);
72 } // namespace content
74 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_NAVIGATION_ENTRY_H_