| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_NAVIGATION_ENTRY_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_IMPL_H_ |
| 6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_IMPL_H_ | 6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_IMPL_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 "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 class CONTENT_EXPORT NavigationEntryImpl | 27 class CONTENT_EXPORT NavigationEntryImpl |
| 28 : public NON_EXPORTED_BASE(NavigationEntry) { | 28 : public NON_EXPORTED_BASE(NavigationEntry) { |
| 29 public: | 29 public: |
| 30 // Represents a tree of FrameNavigationEntries that make up this joint session | 30 // Represents a tree of FrameNavigationEntries that make up this joint session |
| 31 // history item. The tree currently only tracks the main frame. | 31 // history item. The tree currently only tracks the main frame. |
| 32 // TODO(creis): Populate the tree with subframe entries in --site-per-process. | 32 // TODO(creis): Populate the tree with subframe entries in --site-per-process. |
| 33 struct TreeNode { | 33 struct TreeNode { |
| 34 TreeNode(FrameNavigationEntry* frame_entry); | 34 TreeNode(FrameNavigationEntry* frame_entry); |
| 35 ~TreeNode(); | 35 ~TreeNode(); |
| 36 | 36 |
| 37 // Returns whether this TreeNode corresponds to |frame_tree_node|. |
| 38 bool MatchesFrame(FrameTreeNode* frame_tree_node) const; |
| 39 |
| 37 // Returns a deep copy of the tree with copies of each node's | 40 // Returns a deep copy of the tree with copies of each node's |
| 38 // FrameNavigationEntries. We do not yet share FrameNavigationEntries | 41 // FrameNavigationEntries. We do not yet share FrameNavigationEntries |
| 39 // across trees. | 42 // across trees. |
| 40 // TODO(creis): For --site-per-process, share FrameNavigationEntries between | 43 // TODO(creis): For --site-per-process, share FrameNavigationEntries between |
| 41 // NavigationEntries of the same tab. | 44 // NavigationEntries of the same tab. |
| 42 TreeNode* Clone() const; | 45 TreeNode* Clone() const; |
| 43 | 46 |
| 44 // Ref counted pointer that keeps the FrameNavigationEntry alive as long as | 47 // Ref counted pointer that keeps the FrameNavigationEntry alive as long as |
| 45 // it is needed by this node's NavigationEntry. | 48 // it is needed by this node's NavigationEntry. |
| 46 scoped_refptr<FrameNavigationEntry> frame_entry; | 49 scoped_refptr<FrameNavigationEntry> frame_entry; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 // tab) and one that draws them from a different pool (for use in a new tab). | 130 // tab) and one that draws them from a different pool (for use in a new tab). |
| 128 NavigationEntryImpl* Clone() const; | 131 NavigationEntryImpl* Clone() const; |
| 129 | 132 |
| 130 // Helper functions to construct NavigationParameters for a navigation to this | 133 // Helper functions to construct NavigationParameters for a navigation to this |
| 131 // NavigationEntry. | 134 // NavigationEntry. |
| 132 CommonNavigationParams ConstructCommonNavigationParams( | 135 CommonNavigationParams ConstructCommonNavigationParams( |
| 133 FrameMsg_Navigate_Type::Value navigation_type) const; | 136 FrameMsg_Navigate_Type::Value navigation_type) const; |
| 134 StartNavigationParams ConstructStartNavigationParams() const; | 137 StartNavigationParams ConstructStartNavigationParams() const; |
| 135 RequestNavigationParams ConstructRequestNavigationParams( | 138 RequestNavigationParams ConstructRequestNavigationParams( |
| 136 base::TimeTicks navigation_start, | 139 base::TimeTicks navigation_start, |
| 140 bool has_committed_real_load, |
| 137 bool intended_as_new_entry, | 141 bool intended_as_new_entry, |
| 138 int pending_offset_to_send, | 142 int pending_offset_to_send, |
| 139 int current_offset_to_send, | 143 int current_offset_to_send, |
| 140 int current_length_to_send) const; | 144 int current_length_to_send) const; |
| 141 | 145 |
| 142 // Once a navigation entry is committed, we should no longer track several | 146 // Once a navigation entry is committed, we should no longer track several |
| 143 // pieces of non-persisted state, as documented on the members below. | 147 // pieces of non-persisted state, as documented on the members below. |
| 144 void ResetForCommit(); | 148 void ResetForCommit(); |
| 145 | 149 |
| 146 // Exposes the tree of FrameNavigationEntries that make up this joint session | 150 // Exposes the tree of FrameNavigationEntries that make up this joint session |
| 147 // history item. | 151 // history item. |
| 148 // In default Chrome, this tree only has a root node with an unshared | 152 // In default Chrome, this tree only has a root node with an unshared |
| 149 // FrameNavigationEntry. Subframes are only added to the tree if the | 153 // FrameNavigationEntry. Subframes are only added to the tree if the |
| 150 // --site-per-process flag is passed. | 154 // --site-per-process flag is passed. |
| 151 TreeNode* root_node() const { | 155 TreeNode* root_node() const { |
| 152 return frame_tree_.get(); | 156 return frame_tree_.get(); |
| 153 } | 157 } |
| 154 | 158 |
| 155 // Finds the TreeNode associated with |frame_tree_node_id| to add or update | 159 // Finds the TreeNode associated with |frame_tree_node_id| to add or update |
| 156 // its FrameNavigationEntry. A new FrameNavigationEntry is added if none | 160 // its FrameNavigationEntry. A new FrameNavigationEntry is added if none |
| 157 // exists, or else the existing one (which might be shared with other | 161 // exists, or else the existing one (which might be shared with other |
| 158 // NavigationEntries) is updated with the given parameters. | 162 // NavigationEntries) is updated with the given parameters. |
| 163 // Does nothing if there is no entry already and |url| is about:blank, since |
| 164 // that does not count as a real commit. |
| 159 void AddOrUpdateFrameEntry(FrameTreeNode* frame_tree_node, | 165 void AddOrUpdateFrameEntry(FrameTreeNode* frame_tree_node, |
| 160 SiteInstanceImpl* site_instance, | 166 SiteInstanceImpl* site_instance, |
| 161 const GURL& url, | 167 const GURL& url, |
| 162 const Referrer& referrer); | 168 const Referrer& referrer); |
| 163 | 169 |
| 170 // Returns whether this entry has a FrameNavigationEntry for the given |
| 171 // |frame_tree_node|. |
| 172 bool HasFrameEntry(FrameTreeNode* frame_tree_node) const; |
| 173 |
| 164 void set_unique_id(int unique_id) { | 174 void set_unique_id(int unique_id) { |
| 165 unique_id_ = unique_id; | 175 unique_id_ = unique_id; |
| 166 } | 176 } |
| 167 | 177 |
| 168 // The SiteInstance represents which pages must share processes. This is a | 178 // The SiteInstance represents which pages must share processes. This is a |
| 169 // reference counted pointer to a shared SiteInstance. | 179 // reference counted pointer to a shared SiteInstance. |
| 170 // | 180 // |
| 171 // Note that the SiteInstance should usually not be changed after it is set, | 181 // Note that the SiteInstance should usually not be changed after it is set, |
| 172 // but this may happen if the NavigationEntry was cloned and needs to use a | 182 // but this may happen if the NavigationEntry was cloned and needs to use a |
| 173 // different SiteInstance. | 183 // different SiteInstance. |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 return intent_received_timestamp_; | 310 return intent_received_timestamp_; |
| 301 } | 311 } |
| 302 | 312 |
| 303 void set_intent_received_timestamp( | 313 void set_intent_received_timestamp( |
| 304 const base::TimeTicks intent_received_timestamp) { | 314 const base::TimeTicks intent_received_timestamp) { |
| 305 intent_received_timestamp_ = intent_received_timestamp; | 315 intent_received_timestamp_ = intent_received_timestamp; |
| 306 } | 316 } |
| 307 #endif | 317 #endif |
| 308 | 318 |
| 309 private: | 319 private: |
| 320 // Finds the TreeNode associated with |frame_tree_node|, if any. |
| 321 NavigationEntryImpl::TreeNode* FindFrameEntry( |
| 322 FrameTreeNode* frame_tree_node) const; |
| 323 |
| 310 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | 324 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING |
| 311 // Session/Tab restore save portions of this class so that it can be recreated | 325 // Session/Tab restore save portions of this class so that it can be recreated |
| 312 // later. If you add a new field that needs to be persisted you'll have to | 326 // later. If you add a new field that needs to be persisted you'll have to |
| 313 // update SessionService/TabRestoreService and Android WebView | 327 // update SessionService/TabRestoreService and Android WebView |
| 314 // state_serializer.cc appropriately. | 328 // state_serializer.cc appropriately. |
| 315 // For all new fields, update |Clone| and possibly |ResetForCommit|. | 329 // For all new fields, update |Clone| and possibly |ResetForCommit|. |
| 316 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | 330 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING |
| 317 | 331 |
| 318 // Tree of FrameNavigationEntries, one for each frame on the page. | 332 // Tree of FrameNavigationEntries, one for each frame on the page. |
| 319 // TODO(creis): Once FrameNavigationEntries can be shared across multiple | 333 // TODO(creis): Once FrameNavigationEntries can be shared across multiple |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 // persisted, unless specific data is taken out/put back in at save/restore | 448 // persisted, unless specific data is taken out/put back in at save/restore |
| 435 // time (see TabNavigation for an example of this). | 449 // time (see TabNavigation for an example of this). |
| 436 std::map<std::string, base::string16> extra_data_; | 450 std::map<std::string, base::string16> extra_data_; |
| 437 | 451 |
| 438 DISALLOW_COPY_AND_ASSIGN(NavigationEntryImpl); | 452 DISALLOW_COPY_AND_ASSIGN(NavigationEntryImpl); |
| 439 }; | 453 }; |
| 440 | 454 |
| 441 } // namespace content | 455 } // namespace content |
| 442 | 456 |
| 443 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_IMPL_H_ | 457 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_IMPL_H_ |
| OLD | NEW |