| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_TAB_CONTENTS_NAVIGATION_ENTRY_H_ | 5 #ifndef CONTENT_BROWSER_TAB_CONTENTS_NAVIGATION_ENTRY_IMPL_H_ |
| 6 #define CONTENT_BROWSER_TAB_CONTENTS_NAVIGATION_ENTRY_H_ | 6 #define CONTENT_BROWSER_TAB_CONTENTS_NAVIGATION_ENTRY_IMPL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/compiler_specific.h" | |
| 11 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 12 #include "content/public/browser/favicon_status.h" | 11 #include "content/public/browser/favicon_status.h" |
| 13 #include "content/public/browser/global_request_id.h" | 12 #include "content/public/browser/global_request_id.h" |
| 14 #include "content/public/browser/navigation_entry.h" | 13 #include "content/public/browser/navigation_entry.h" |
| 15 #include "content/public/browser/ssl_status.h" | 14 #include "content/public/browser/ssl_status.h" |
| 16 | 15 |
| 17 class SiteInstance; | 16 class SiteInstance; |
| 18 | 17 |
| 19 class CONTENT_EXPORT NavigationEntry | 18 namespace content { |
| 20 : public NON_EXPORTED_BASE(content::NavigationEntry) { | 19 |
| 20 class NavigationEntryImpl : public NavigationEntry { |
| 21 public: | 21 public: |
| 22 static NavigationEntryImpl* FromNavigationEntry(NavigationEntry* entry); |
| 22 | 23 |
| 23 static NavigationEntry* FromNavigationEntry(content::NavigationEntry* entry); | 24 NavigationEntryImpl(); |
| 25 NavigationEntryImpl(SiteInstance* instance, |
| 26 int page_id, |
| 27 const GURL& url, |
| 28 const Referrer& referrer, |
| 29 const string16& title, |
| 30 PageTransition transition_type, |
| 31 bool is_renderer_initiated); |
| 32 virtual ~NavigationEntryImpl(); |
| 24 | 33 |
| 25 NavigationEntry(); | 34 // NavigationEntry implementation: |
| 26 NavigationEntry(SiteInstance* instance, | |
| 27 int page_id, | |
| 28 const GURL& url, | |
| 29 const content::Referrer& referrer, | |
| 30 const string16& title, | |
| 31 content::PageTransition transition_type, | |
| 32 bool is_renderer_initiated); | |
| 33 virtual ~NavigationEntry(); | |
| 34 | |
| 35 // content::NavigationEntry implementation: | |
| 36 virtual int GetUniqueID() const OVERRIDE; | 35 virtual int GetUniqueID() const OVERRIDE; |
| 37 virtual content::PageType GetPageType() const OVERRIDE; | 36 virtual PageType GetPageType() const OVERRIDE; |
| 38 virtual void SetURL(const GURL& url) OVERRIDE; | 37 virtual void SetURL(const GURL& url) OVERRIDE; |
| 39 virtual const GURL& GetURL() const OVERRIDE; | 38 virtual const GURL& GetURL() const OVERRIDE; |
| 40 virtual void SetReferrer(const content::Referrer& referrer) OVERRIDE; | 39 virtual void SetReferrer(const Referrer& referrer) OVERRIDE; |
| 41 virtual const content::Referrer& GetReferrer() const OVERRIDE; | 40 virtual const Referrer& GetReferrer() const OVERRIDE; |
| 42 virtual void SetVirtualURL(const GURL& url) OVERRIDE; | 41 virtual void SetVirtualURL(const GURL& url) OVERRIDE; |
| 43 virtual const GURL& GetVirtualURL() const OVERRIDE; | 42 virtual const GURL& GetVirtualURL() const OVERRIDE; |
| 44 virtual void SetTitle(const string16& title) OVERRIDE; | 43 virtual void SetTitle(const string16& title) OVERRIDE; |
| 45 virtual const string16& GetTitle() const OVERRIDE; | 44 virtual const string16& GetTitle() const OVERRIDE; |
| 46 virtual void SetContentState(const std::string& state) OVERRIDE; | 45 virtual void SetContentState(const std::string& state) OVERRIDE; |
| 47 virtual const std::string& GetContentState() const OVERRIDE; | 46 virtual const std::string& GetContentState() const OVERRIDE; |
| 48 virtual void SetPageID(int page_id) OVERRIDE; | 47 virtual void SetPageID(int page_id) OVERRIDE; |
| 49 virtual int32 GetPageID() const OVERRIDE; | 48 virtual int32 GetPageID() const OVERRIDE; |
| 50 virtual const string16& GetTitleForDisplay( | 49 virtual const string16& GetTitleForDisplay( |
| 51 const std::string& languages) const OVERRIDE; | 50 const std::string& languages) const OVERRIDE; |
| 52 virtual bool IsViewSourceMode() const OVERRIDE; | 51 virtual bool IsViewSourceMode() const OVERRIDE; |
| 53 virtual void SetTransitionType( | 52 virtual void SetTransitionType(PageTransition transition_type) OVERRIDE; |
| 54 content::PageTransition transition_type) OVERRIDE; | 53 virtual PageTransition GetTransitionType() const OVERRIDE; |
| 55 virtual content::PageTransition GetTransitionType() const OVERRIDE; | |
| 56 virtual const GURL& GetUserTypedURL() const OVERRIDE; | 54 virtual const GURL& GetUserTypedURL() const OVERRIDE; |
| 57 virtual void SetHasPostData(bool has_post_data) OVERRIDE; | 55 virtual void SetHasPostData(bool has_post_data) OVERRIDE; |
| 58 virtual bool GetHasPostData() const OVERRIDE; | 56 virtual bool GetHasPostData() const OVERRIDE; |
| 59 virtual const content::FaviconStatus& GetFavicon() const OVERRIDE; | 57 virtual const FaviconStatus& GetFavicon() const OVERRIDE; |
| 60 virtual content::FaviconStatus& GetFavicon() OVERRIDE; | 58 virtual FaviconStatus& GetFavicon() OVERRIDE; |
| 61 virtual const content::SSLStatus& GetSSL() const OVERRIDE; | 59 virtual const SSLStatus& GetSSL() const OVERRIDE; |
| 62 virtual content::SSLStatus& GetSSL() OVERRIDE; | 60 virtual SSLStatus& GetSSL() OVERRIDE; |
| 63 | 61 |
| 64 void set_unique_id(int unique_id) { | 62 void set_unique_id(int unique_id) { |
| 65 unique_id_ = unique_id; | 63 unique_id_ = unique_id; |
| 66 } | 64 } |
| 67 | 65 |
| 68 // The SiteInstance tells us how to share sub-processes when the tab type is | 66 // The SiteInstance tells us how to share sub-processes when the tab type is |
| 69 // TAB_CONTENTS_WEB. This will be NULL otherwise. This is a reference counted | 67 // TAB_CONTENTS_WEB. This will be NULL otherwise. This is a reference counted |
| 70 // pointer to a shared site instance. | 68 // pointer to a shared site instance. |
| 71 // | 69 // |
| 72 // Note that the SiteInstance should usually not be changed after it is set, | 70 // Note that the SiteInstance should usually not be changed after it is set, |
| 73 // but this may happen if the NavigationEntry was cloned and needs to use a | 71 // but this may happen if the NavigationEntry was cloned and needs to use a |
| 74 // different SiteInstance. | 72 // different SiteInstance. |
| 75 void set_site_instance(SiteInstance* site_instance); | 73 void set_site_instance(SiteInstance* site_instance); |
| 76 SiteInstance* site_instance() const { | 74 SiteInstance* site_instance() const { |
| 77 return site_instance_; | 75 return site_instance_; |
| 78 } | 76 } |
| 79 | 77 |
| 80 void set_page_type(content::PageType page_type) { | 78 void set_page_type(PageType page_type) { |
| 81 page_type_ = page_type; | 79 page_type_ = page_type; |
| 82 } | 80 } |
| 83 | 81 |
| 84 bool has_virtual_url() const { | 82 bool has_virtual_url() const { |
| 85 return !virtual_url_.is_empty(); | 83 return !virtual_url_.is_empty(); |
| 86 } | 84 } |
| 87 | 85 |
| 88 bool update_virtual_url_with_url() const { | 86 bool update_virtual_url_with_url() const { |
| 89 return update_virtual_url_with_url_; | 87 return update_virtual_url_with_url_; |
| 90 } | 88 } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 // The RestoreType for this entry. This is set if the entry was retored. This | 127 // The RestoreType for this entry. This is set if the entry was retored. This |
| 130 // is set to RESTORE_NONE once the entry is loaded. | 128 // is set to RESTORE_NONE once the entry is loaded. |
| 131 void set_restore_type(RestoreType type) { | 129 void set_restore_type(RestoreType type) { |
| 132 restore_type_ = type; | 130 restore_type_ = type; |
| 133 } | 131 } |
| 134 RestoreType restore_type() const { | 132 RestoreType restore_type() const { |
| 135 return restore_type_; | 133 return restore_type_; |
| 136 } | 134 } |
| 137 | 135 |
| 138 void set_transferred_global_request_id( | 136 void set_transferred_global_request_id( |
| 139 const content::GlobalRequestID& transferred_global_request_id) { | 137 const GlobalRequestID& transferred_global_request_id) { |
| 140 transferred_global_request_id_ = transferred_global_request_id; | 138 transferred_global_request_id_ = transferred_global_request_id; |
| 141 } | 139 } |
| 142 | 140 |
| 143 content::GlobalRequestID transferred_global_request_id() const { | 141 GlobalRequestID transferred_global_request_id() const { |
| 144 return transferred_global_request_id_; | 142 return transferred_global_request_id_; |
| 145 } | 143 } |
| 146 | 144 |
| 147 private: | 145 private: |
| 148 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | 146 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING |
| 149 // Session/Tab restore save portions of this class so that it can be recreated | 147 // Session/Tab restore save portions of this class so that it can be recreated |
| 150 // later. If you add a new field that needs to be persisted you'll have to | 148 // later. If you add a new field that needs to be persisted you'll have to |
| 151 // update SessionService/TabRestoreService appropriately. | 149 // update SessionService/TabRestoreService appropriately. |
| 152 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | 150 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING |
| 153 | 151 |
| 154 // See the accessors above for descriptions. | 152 // See the accessors above for descriptions. |
| 155 int unique_id_; | 153 int unique_id_; |
| 156 scoped_refptr<SiteInstance> site_instance_; | 154 scoped_refptr<SiteInstance> site_instance_; |
| 157 content::PageType page_type_; | 155 PageType page_type_; |
| 158 GURL url_; | 156 GURL url_; |
| 159 content::Referrer referrer_; | 157 Referrer referrer_; |
| 160 GURL virtual_url_; | 158 GURL virtual_url_; |
| 161 bool update_virtual_url_with_url_; | 159 bool update_virtual_url_with_url_; |
| 162 string16 title_; | 160 string16 title_; |
| 163 content::FaviconStatus favicon_; | 161 FaviconStatus favicon_; |
| 164 std::string content_state_; | 162 std::string content_state_; |
| 165 int32 page_id_; | 163 int32 page_id_; |
| 166 content::SSLStatus ssl_; | 164 SSLStatus ssl_; |
| 167 content::PageTransition transition_type_; | 165 PageTransition transition_type_; |
| 168 GURL user_typed_url_; | 166 GURL user_typed_url_; |
| 169 bool has_post_data_; | 167 bool has_post_data_; |
| 170 RestoreType restore_type_; | 168 RestoreType restore_type_; |
| 171 | 169 |
| 172 // This member is not persisted with sesssion restore. | 170 // This member is not persisted with sesssion restore. |
| 173 std::string extra_headers_; | 171 std::string extra_headers_; |
| 174 | 172 |
| 175 // Whether the entry, while loading, was created for a renderer-initiated | 173 // Whether the entry, while loading, was created for a renderer-initiated |
| 176 // navigation. This dictates whether the URL should be displayed before the | 174 // navigation. This dictates whether the URL should be displayed before the |
| 177 // navigation commits. It is cleared on commit and not persisted. | 175 // navigation commits. It is cleared on commit and not persisted. |
| 178 bool is_renderer_initiated_; | 176 bool is_renderer_initiated_; |
| 179 | 177 |
| 180 // This is a cached version of the result of GetTitleForDisplay. It prevents | 178 // This is a cached version of the result of GetTitleForDisplay. It prevents |
| 181 // us from having to do URL formatting on the URL every time the title is | 179 // us from having to do URL formatting on the URL every time the title is |
| 182 // displayed. When the URL, virtual URL, or title is set, this should be | 180 // displayed. When the URL, virtual URL, or title is set, this should be |
| 183 // cleared to force a refresh. | 181 // cleared to force a refresh. |
| 184 mutable string16 cached_display_title_; | 182 mutable string16 cached_display_title_; |
| 185 | 183 |
| 186 // In case a navigation is transferred to a new RVH but the request has | 184 // In case a navigation is transferred to a new RVH but the request has |
| 187 // been generated in the renderer already, this identifies the old request so | 185 // been generated in the renderer already, this identifies the old request so |
| 188 // that it can be resumed. The old request is stored until the | 186 // that it can be resumed. The old request is stored until the |
| 189 // ResourceDispatcher receives the navigation from the renderer which | 187 // ResourceDispatcher receives the navigation from the renderer which |
| 190 // carries this |transferred_global_request_id_| annotation. Once the request | 188 // carries this |transferred_global_request_id_| annotation. Once the request |
| 191 // is transferred to the new process, this is cleared and the request | 189 // is transferred to the new process, this is cleared and the request |
| 192 // continues as normal. | 190 // continues as normal. |
| 193 content::GlobalRequestID transferred_global_request_id_; | 191 GlobalRequestID transferred_global_request_id_; |
| 194 | 192 |
| 195 // Copy and assignment is explicitly allowed for this class. | 193 // Copy and assignment is explicitly allowed for this class. |
| 196 }; | 194 }; |
| 197 | 195 |
| 198 #endif // CONTENT_BROWSER_TAB_CONTENTS_NAVIGATION_ENTRY_H_ | 196 } // namespace content |
| 197 |
| 198 #endif // CONTENT_BROWSER_TAB_CONTENTS_NAVIGATION_ENTRY_IMPL_H_ |
| OLD | NEW |