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/time/time.h" | 10 #include "base/time/time.h" |
11 #include "content/browser/frame_host/frame_navigation_entry.h" | 11 #include "content/browser/frame_host/frame_navigation_entry.h" |
12 #include "content/browser/site_instance_impl.h" | 12 #include "content/browser/site_instance_impl.h" |
13 #include "content/common/frame_message_enums.h" | 13 #include "content/common/frame_message_enums.h" |
14 #include "content/public/browser/favicon_status.h" | 14 #include "content/public/browser/favicon_status.h" |
15 #include "content/public/browser/global_request_id.h" | 15 #include "content/public/browser/global_request_id.h" |
16 #include "content/public/browser/navigation_entry.h" | 16 #include "content/public/browser/navigation_entry.h" |
17 #include "content/public/common/page_state.h" | 17 #include "content/public/common/page_state.h" |
18 #include "content/public/common/ssl_status.h" | 18 #include "content/public/common/ssl_status.h" |
19 | 19 |
20 namespace content { | 20 namespace content { |
21 class NavigationControllerImpl; | 21 class NavigationControllerImpl; |
22 struct CommitNavigationParams; | 22 struct CommitNavigationParams; |
23 struct CommonNavigationParams; | 23 struct CommonNavigationParams; |
24 struct HistoryNavigationParams; | 24 struct HistoryNavigationParams; |
25 struct StartNavigationParams; | 25 struct StartNavigationParams; |
26 | 26 |
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 |
| 31 // history item. The tree currently only tracks the main frame. |
| 32 // TODO(creis): Populate the tree with subframe entries in --site-per-process. |
| 33 struct TreeNode { |
| 34 TreeNode(FrameNavigationEntry* frame_entry); |
| 35 ~TreeNode(); |
| 36 |
| 37 // Returns a deep copy of the tree with copies of each node's |
| 38 // FrameNavigationEntries. We do not yet share FrameNavigationEntries |
| 39 // across trees. |
| 40 // TODO(creis): For --site-per-process, share FrameNavigationEntries between |
| 41 // NavigationEntries of the same tab. |
| 42 TreeNode* Clone() const; |
| 43 |
| 44 // Ref counted pointer that keeps the FrameNavigationEntry alive as long as |
| 45 // it is needed by this node's NavigationEntry. |
| 46 scoped_refptr<FrameNavigationEntry> frame_entry; |
| 47 }; |
| 48 |
30 static NavigationEntryImpl* FromNavigationEntry(NavigationEntry* entry); | 49 static NavigationEntryImpl* FromNavigationEntry(NavigationEntry* entry); |
31 | 50 |
32 // The value of bindings() before it is set during commit. | 51 // The value of bindings() before it is set during commit. |
33 static int kInvalidBindings; | 52 static int kInvalidBindings; |
34 | 53 |
35 NavigationEntryImpl(); | 54 NavigationEntryImpl(); |
36 NavigationEntryImpl(SiteInstanceImpl* instance, | 55 NavigationEntryImpl(SiteInstanceImpl* instance, |
37 int page_id, | 56 int page_id, |
38 const GURL& url, | 57 const GURL& url, |
39 const Referrer& referrer, | 58 const Referrer& referrer, |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 } | 133 } |
115 | 134 |
116 // The SiteInstance represents which pages must share processes. This is a | 135 // The SiteInstance represents which pages must share processes. This is a |
117 // reference counted pointer to a shared SiteInstance. | 136 // reference counted pointer to a shared SiteInstance. |
118 // | 137 // |
119 // Note that the SiteInstance should usually not be changed after it is set, | 138 // Note that the SiteInstance should usually not be changed after it is set, |
120 // but this may happen if the NavigationEntry was cloned and needs to use a | 139 // but this may happen if the NavigationEntry was cloned and needs to use a |
121 // different SiteInstance. | 140 // different SiteInstance. |
122 void set_site_instance(SiteInstanceImpl* site_instance); | 141 void set_site_instance(SiteInstanceImpl* site_instance); |
123 SiteInstanceImpl* site_instance() const { | 142 SiteInstanceImpl* site_instance() const { |
124 return frame_entry_.site_instance(); | 143 return frame_tree_->frame_entry->site_instance(); |
125 } | 144 } |
126 | 145 |
127 // The |source_site_instance| is used to identify the SiteInstance of the | 146 // The |source_site_instance| is used to identify the SiteInstance of the |
128 // frame that initiated the navigation. | 147 // frame that initiated the navigation. |
129 void set_source_site_instance(SiteInstanceImpl* source_site_instance); | 148 void set_source_site_instance(SiteInstanceImpl* source_site_instance); |
130 SiteInstanceImpl* source_site_instance() const { | 149 SiteInstanceImpl* source_site_instance() const { |
131 return source_site_instance_.get(); | 150 return source_site_instance_.get(); |
132 } | 151 } |
133 | 152 |
134 // Remember the set of bindings granted to this NavigationEntry at the time | 153 // Remember the set of bindings granted to this NavigationEntry at the time |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 | 283 |
265 private: | 284 private: |
266 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | 285 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING |
267 // Session/Tab restore save portions of this class so that it can be recreated | 286 // Session/Tab restore save portions of this class so that it can be recreated |
268 // later. If you add a new field that needs to be persisted you'll have to | 287 // later. If you add a new field that needs to be persisted you'll have to |
269 // update SessionService/TabRestoreService and Android WebView | 288 // update SessionService/TabRestoreService and Android WebView |
270 // state_serializer.cc appropriately. | 289 // state_serializer.cc appropriately. |
271 // For all new fields, update |Clone| and possibly |ResetForCommit|. | 290 // For all new fields, update |Clone| and possibly |ResetForCommit|. |
272 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | 291 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING |
273 | 292 |
274 // The FrameNavigationEntry for the main frame. | 293 // Tree of FrameNavigationEntries, one for each frame on the page. |
275 // TODO(creis): Make this a tree with nodes for each frame in the page. | 294 // TODO(creis): Once FrameNavigationEntries can be shared across multiple |
276 FrameNavigationEntry frame_entry_; | 295 // NavigationEntries, we will need to update Session/Tab restore. For now, |
| 296 // each NavigationEntry's tree has its own unshared FrameNavigationEntries. |
| 297 scoped_ptr<TreeNode> frame_tree_; |
277 | 298 |
278 // See the accessors above for descriptions. | 299 // See the accessors above for descriptions. |
279 int unique_id_; | 300 int unique_id_; |
280 // TODO(creis): Persist bindings_. http://crbug.com/173672. | 301 // TODO(creis): Persist bindings_. http://crbug.com/173672. |
281 int bindings_; | 302 int bindings_; |
282 PageType page_type_; | 303 PageType page_type_; |
283 GURL virtual_url_; | 304 GURL virtual_url_; |
284 bool update_virtual_url_with_url_; | 305 bool update_virtual_url_with_url_; |
285 base::string16 title_; | 306 base::string16 title_; |
286 FaviconStatus favicon_; | 307 FaviconStatus favicon_; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 // persisted, unless specific data is taken out/put back in at save/restore | 413 // persisted, unless specific data is taken out/put back in at save/restore |
393 // time (see TabNavigation for an example of this). | 414 // time (see TabNavigation for an example of this). |
394 std::map<std::string, base::string16> extra_data_; | 415 std::map<std::string, base::string16> extra_data_; |
395 | 416 |
396 DISALLOW_COPY_AND_ASSIGN(NavigationEntryImpl); | 417 DISALLOW_COPY_AND_ASSIGN(NavigationEntryImpl); |
397 }; | 418 }; |
398 | 419 |
399 } // namespace content | 420 } // namespace content |
400 | 421 |
401 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_IMPL_H_ | 422 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_ENTRY_IMPL_H_ |
OLD | NEW |