Chromium Code Reviews| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 170 const FrameNavigationEntry& frame_entry, | 170 const FrameNavigationEntry& frame_entry, |
| 171 bool is_same_document_history_load, | 171 bool is_same_document_history_load, |
| 172 bool has_committed_real_load, | 172 bool has_committed_real_load, |
| 173 bool intended_as_new_entry, | 173 bool intended_as_new_entry, |
| 174 int pending_offset_to_send, | 174 int pending_offset_to_send, |
| 175 int current_offset_to_send, | 175 int current_offset_to_send, |
| 176 int current_length_to_send) const; | 176 int current_length_to_send) const; |
| 177 | 177 |
| 178 // Once a navigation entry is committed, we should no longer track several | 178 // Once a navigation entry is committed, we should no longer track several |
| 179 // pieces of non-persisted state, as documented on the members below. | 179 // pieces of non-persisted state, as documented on the members below. |
| 180 void ResetForCommit(); | 180 // |frame_entry| is the FrameNavigationEntry for the frame that committed |
| 181 // the navigation. It can be null if subframe navigation entries are not | |
|
Charlie Reis
2016/05/05 22:20:00
I wish it were as simple as "if subframe navigatio
nasko
2016/05/06 00:13:41
Done.
| |
| 182 // in use. | |
| 183 void ResetForCommit(FrameNavigationEntry* frame_entry); | |
| 181 | 184 |
| 182 // Exposes the tree of FrameNavigationEntries that make up this joint session | 185 // Exposes the tree of FrameNavigationEntries that make up this joint session |
| 183 // history item. | 186 // history item. |
| 184 // In default Chrome, this tree only has a root node with an unshared | 187 // In default Chrome, this tree only has a root node with an unshared |
| 185 // FrameNavigationEntry. Subframes are only added to the tree if the | 188 // FrameNavigationEntry. Subframes are only added to the tree if the |
| 186 // --site-per-process flag is passed. | 189 // --site-per-process flag is passed. |
| 187 TreeNode* root_node() const { | 190 TreeNode* root_node() const { |
| 188 return frame_tree_.get(); | 191 return frame_tree_.get(); |
| 189 } | 192 } |
| 190 | 193 |
| 191 // Finds the TreeNode associated with |frame_tree_node_id| to add or update | 194 // Finds the TreeNode associated with |frame_tree_node_id| to add or update |
| 192 // its FrameNavigationEntry. A new FrameNavigationEntry is added if none | 195 // its FrameNavigationEntry. A new FrameNavigationEntry is added if none |
| 193 // exists, or else the existing one (which might be shared with other | 196 // exists, or else the existing one (which might be shared with other |
| 194 // NavigationEntries) is updated with the given parameters. | 197 // NavigationEntries) is updated with the given parameters. |
| 195 // Does nothing if there is no entry already and |url| is about:blank, since | 198 // Does nothing if there is no entry already and |url| is about:blank, since |
| 196 // that does not count as a real commit. | 199 // that does not count as a real commit. |
| 197 void AddOrUpdateFrameEntry(FrameTreeNode* frame_tree_node, | 200 void AddOrUpdateFrameEntry( |
| 198 int64_t item_sequence_number, | 201 FrameTreeNode* frame_tree_node, |
| 199 int64_t document_sequence_number, | 202 int64_t item_sequence_number, |
| 200 SiteInstanceImpl* site_instance, | 203 int64_t document_sequence_number, |
| 201 const GURL& url, | 204 SiteInstanceImpl* site_instance, |
| 202 const Referrer& referrer, | 205 scoped_refptr<SiteInstanceImpl> source_site_instance, |
| 203 const PageState& page_state, | 206 const GURL& url, |
| 204 const std::string& method, | 207 const Referrer& referrer, |
| 205 int64_t post_id); | 208 const PageState& page_state, |
| 209 const std::string& method, | |
| 210 int64_t post_id); | |
| 206 | 211 |
| 207 // Returns the FrameNavigationEntry corresponding to |frame_tree_node|, if | 212 // Returns the FrameNavigationEntry corresponding to |frame_tree_node|, if |
| 208 // there is one in this NavigationEntry. | 213 // there is one in this NavigationEntry. |
| 209 FrameNavigationEntry* GetFrameEntry(FrameTreeNode* frame_tree_node) const; | 214 FrameNavigationEntry* GetFrameEntry(FrameTreeNode* frame_tree_node) const; |
| 210 | 215 |
| 211 void set_unique_id(int unique_id) { | 216 void set_unique_id(int unique_id) { |
| 212 unique_id_ = unique_id; | 217 unique_id_ = unique_id; |
| 213 } | 218 } |
| 214 | 219 |
| 215 // The SiteInstance represents which pages must share processes. This is a | 220 // The SiteInstance represents which pages must share processes. This is a |
| 216 // reference counted pointer to a shared SiteInstance. | 221 // reference counted pointer to a shared SiteInstance. |
| 217 // | 222 // |
| 218 // Note that the SiteInstance should usually not be changed after it is set, | 223 // Note that the SiteInstance should usually not be changed after it is set, |
| 219 // but this may happen if the NavigationEntry was cloned and needs to use a | 224 // but this may happen if the NavigationEntry was cloned and needs to use a |
| 220 // different SiteInstance. | 225 // different SiteInstance. |
| 221 void set_site_instance(scoped_refptr<SiteInstanceImpl> site_instance); | 226 void set_site_instance(scoped_refptr<SiteInstanceImpl> site_instance); |
| 222 SiteInstanceImpl* site_instance() const { | 227 SiteInstanceImpl* site_instance() const { |
| 223 return frame_tree_->frame_entry->site_instance(); | 228 return frame_tree_->frame_entry->site_instance(); |
| 224 } | 229 } |
| 225 | 230 |
| 226 // The |source_site_instance| is used to identify the SiteInstance of the | 231 // The |source_site_instance| is used to identify the SiteInstance of the |
| 227 // frame that initiated the navigation. | 232 // frame that initiated the navigation. It is set on the |
| 228 void set_source_site_instance(SiteInstanceImpl* source_site_instance); | 233 // FrameNavigationEntry for the main frame. |
| 229 SiteInstanceImpl* source_site_instance() const { | 234 void set_source_site_instance( |
| 230 return source_site_instance_.get(); | 235 scoped_refptr<SiteInstanceImpl> source_site_instance) { |
| 236 root_node()->frame_entry->set_source_site_instance( | |
| 237 source_site_instance.get()); | |
| 231 } | 238 } |
| 232 | 239 |
| 233 // Remember the set of bindings granted to this NavigationEntry at the time | 240 // Remember the set of bindings granted to this NavigationEntry at the time |
| 234 // of commit, to ensure that we do not grant it additional bindings if we | 241 // of commit, to ensure that we do not grant it additional bindings if we |
| 235 // navigate back to it in the future. This can only be changed once. | 242 // navigate back to it in the future. This can only be changed once. |
| 236 void SetBindings(int bindings); | 243 void SetBindings(int bindings); |
| 237 int bindings() const { | 244 int bindings() const { |
| 238 return bindings_; | 245 return bindings_; |
| 239 } | 246 } |
| 240 | 247 |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 411 // page. This screenshot is displayed during an overscroll-navigation | 418 // page. This screenshot is displayed during an overscroll-navigation |
| 412 // gesture. |screenshot_| will be NULL when the screenshot is not available | 419 // gesture. |screenshot_| will be NULL when the screenshot is not available |
| 413 // (e.g. after a session restore, or if taking the screenshot of a page | 420 // (e.g. after a session restore, or if taking the screenshot of a page |
| 414 // failed). The UI is responsible for dealing with missing screenshots | 421 // failed). The UI is responsible for dealing with missing screenshots |
| 415 // appropriately (e.g. display a placeholder image instead). | 422 // appropriately (e.g. display a placeholder image instead). |
| 416 scoped_refptr<base::RefCountedBytes> screenshot_; | 423 scoped_refptr<base::RefCountedBytes> screenshot_; |
| 417 | 424 |
| 418 // This member is not persisted with session restore. | 425 // This member is not persisted with session restore. |
| 419 std::string extra_headers_; | 426 std::string extra_headers_; |
| 420 | 427 |
| 421 // This member is cleared in |ResetForCommit| and not persisted. | |
| 422 scoped_refptr<SiteInstanceImpl> source_site_instance_; | |
| 423 | |
| 424 // Used for specifying base URL for pages loaded via data URLs. Only used and | 428 // Used for specifying base URL for pages loaded via data URLs. Only used and |
| 425 // persisted by Android WebView. | 429 // persisted by Android WebView. |
| 426 GURL base_url_for_data_url_; | 430 GURL base_url_for_data_url_; |
| 427 | 431 |
| 428 #if defined(OS_ANDROID) | 432 #if defined(OS_ANDROID) |
| 429 // Used for passing really big data URLs from browser to renderers. Only used | 433 // Used for passing really big data URLs from browser to renderers. Only used |
| 430 // and persisted by Android WebView. | 434 // and persisted by Android WebView. |
| 431 scoped_refptr<const base::RefCountedString> data_url_as_string_; | 435 scoped_refptr<const base::RefCountedString> data_url_as_string_; |
| 432 #endif | 436 #endif |
| 433 | 437 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 499 // persisted, unless specific data is taken out/put back in at save/restore | 503 // persisted, unless specific data is taken out/put back in at save/restore |
| 500 // time (see TabNavigation for an example of this). | 504 // time (see TabNavigation for an example of this). |
| 501 std::map<std::string, base::string16> extra_data_; | 505 std::map<std::string, base::string16> extra_data_; |
| 502 | 506 |
| 503 DISALLOW_COPY_AND_ASSIGN(NavigationEntryImpl); | 507 DISALLOW_COPY_AND_ASSIGN(NavigationEntryImpl); |
| 504 }; | 508 }; |
| 505 | 509 |
| 506 } // namespace content | 510 } // namespace content |
| 507 | 511 |
| 508 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_IMPL_H_ | 512 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_IMPL_H_ |
| OLD | NEW |