| 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/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 // |
| (...skipping 13 matching lines...) Expand all Loading... |
| 34 const GURL& url, | 35 const GURL& url, |
| 35 const Referrer& referrer); | 36 const Referrer& referrer); |
| 36 | 37 |
| 37 // Creates a copy of this FrameNavigationEntry that can be modified | 38 // Creates a copy of this FrameNavigationEntry that can be modified |
| 38 // independently from the original. | 39 // independently from the original. |
| 39 FrameNavigationEntry* Clone() const; | 40 FrameNavigationEntry* Clone() const; |
| 40 | 41 |
| 41 // Updates all the members of this entry. | 42 // Updates all the members of this entry. |
| 42 void UpdateEntry(SiteInstanceImpl* site_instance, | 43 void UpdateEntry(SiteInstanceImpl* site_instance, |
| 43 const GURL& url, | 44 const GURL& url, |
| 44 const Referrer& referrer); | 45 const Referrer& referrer, |
| 46 const PageState& page_state); |
| 45 | 47 |
| 46 // The ID of the FrameTreeNode this entry is for. -1 for the main frame, | 48 // 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 | 49 // since we don't always know the FrameTreeNode ID when creating the overall |
| 48 // NavigationEntry. | 50 // NavigationEntry. |
| 49 // TODO(creis): Replace with frame sequence number or unique name. | 51 // TODO(creis): Replace with frame sequence number or unique name. |
| 50 int64 frame_tree_node_id() const { return frame_tree_node_id_; } | 52 int64 frame_tree_node_id() const { return frame_tree_node_id_; } |
| 51 | 53 |
| 52 // The SiteInstance responsible for rendering this frame. All frames sharing | 54 // The SiteInstance responsible for rendering this frame. All frames sharing |
| 53 // a SiteInstance must live in the same process. This is a refcounted pointer | 55 // a SiteInstance must live in the same process. This is a refcounted pointer |
| 54 // that keeps the SiteInstance (not necessarily the process) alive as long as | 56 // that keeps the SiteInstance (not necessarily the process) alive as long as |
| 55 // this object remains in the session history. | 57 // this object remains in the session history. |
| 56 void set_site_instance(SiteInstanceImpl* site_instance) { | 58 void set_site_instance(SiteInstanceImpl* site_instance) { |
| 57 site_instance_ = site_instance; | 59 site_instance_ = site_instance; |
| 58 } | 60 } |
| 59 SiteInstanceImpl* site_instance() const { return site_instance_.get(); } | 61 SiteInstanceImpl* site_instance() const { return site_instance_.get(); } |
| 60 | 62 |
| 61 // The actual URL loaded in the frame. This is in contrast to the virtual | 63 // The actual URL loaded in the frame. This is in contrast to the virtual |
| 62 // URL, which is shown to the user. | 64 // URL, which is shown to the user. |
| 63 void set_url(const GURL& url) { url_ = url; } | 65 void set_url(const GURL& url) { url_ = url; } |
| 64 const GURL& url() const { return url_; } | 66 const GURL& url() const { return url_; } |
| 65 | 67 |
| 66 // The referring URL. Can be empty. | 68 // The referring URL. Can be empty. |
| 67 void set_referrer(const Referrer& referrer) { referrer_ = referrer; } | 69 void set_referrer(const Referrer& referrer) { referrer_ = referrer; } |
| 68 const Referrer& referrer() const { return referrer_; } | 70 const Referrer& referrer() const { return referrer_; } |
| 69 | 71 |
| 72 void set_page_state(const PageState& page_state) { page_state_ = page_state; } |
| 73 const PageState& page_state() const { return page_state_; } |
| 74 |
| 70 private: | 75 private: |
| 71 friend class base::RefCounted<FrameNavigationEntry>; | 76 friend class base::RefCounted<FrameNavigationEntry>; |
| 72 virtual ~FrameNavigationEntry(); | 77 virtual ~FrameNavigationEntry(); |
| 73 | 78 |
| 74 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | 79 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING |
| 75 // For all new fields, update |Clone|. | 80 // For all new fields, update |Clone|. |
| 76 // TODO(creis): These fields have implications for session restore. This is | 81 // TODO(creis): These fields have implications for session restore. This is |
| 77 // currently managed by NavigationEntry, but the logic will move here. | 82 // currently managed by NavigationEntry, but the logic will move here. |
| 78 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | 83 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING |
| 79 | 84 |
| 80 // See the accessors above for descriptions. | 85 // See the accessors above for descriptions. |
| 81 int64 frame_tree_node_id_; | 86 int64 frame_tree_node_id_; |
| 82 scoped_refptr<SiteInstanceImpl> site_instance_; | 87 scoped_refptr<SiteInstanceImpl> site_instance_; |
| 83 GURL url_; | 88 GURL url_; |
| 84 Referrer referrer_; | 89 Referrer referrer_; |
| 90 // TODO(creis): Change this to FrameState. |
| 91 PageState page_state_; |
| 85 | 92 |
| 86 DISALLOW_COPY_AND_ASSIGN(FrameNavigationEntry); | 93 DISALLOW_COPY_AND_ASSIGN(FrameNavigationEntry); |
| 87 }; | 94 }; |
| 88 | 95 |
| 89 } // namespace content | 96 } // namespace content |
| 90 | 97 |
| 91 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_NAVIGATION_ENTRY_H_ | 98 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_NAVIGATION_ENTRY_H_ |
| OLD | NEW |