| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 CHROME_BROWSER_TAB_CONTENTS_NAVIGATION_ENTRY_H_ | 5 #ifndef CHROME_BROWSER_TAB_CONTENTS_NAVIGATION_ENTRY_H_ |
| 6 #define CHROME_BROWSER_TAB_CONTENTS_NAVIGATION_ENTRY_H_ | 6 #define CHROME_BROWSER_TAB_CONTENTS_NAVIGATION_ENTRY_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 // The page type tells us if this entry is for an interstitial or error page. | 212 // The page type tells us if this entry is for an interstitial or error page. |
| 213 // See the PageType enum above. | 213 // See the PageType enum above. |
| 214 void set_page_type(PageType page_type) { | 214 void set_page_type(PageType page_type) { |
| 215 page_type_ = page_type; | 215 page_type_ = page_type; |
| 216 } | 216 } |
| 217 PageType page_type() const { | 217 PageType page_type() const { |
| 218 return page_type_; | 218 return page_type_; |
| 219 } | 219 } |
| 220 | 220 |
| 221 // The actual URL of the page. For some about pages, this may be a scary | 221 // The actual URL of the page. For some about pages, this may be a scary |
| 222 // data: URL or something like that. Use display_url() below for showing to | 222 // data: URL or something like that. Use virtual_url() below for showing to |
| 223 // the user. | 223 // the user. |
| 224 void set_url(const GURL& url) { | 224 void set_url(const GURL& url) { |
| 225 url_ = url; | 225 url_ = url; |
| 226 cached_display_title_.clear(); | 226 cached_display_title_.clear(); |
| 227 } | 227 } |
| 228 const GURL& url() const { | 228 const GURL& url() const { |
| 229 return url_; | 229 return url_; |
| 230 } | 230 } |
| 231 | 231 |
| 232 // The referring URL. Can be empty. | 232 // The referring URL. Can be empty. |
| 233 void set_referrer(const GURL& referrer) { | 233 void set_referrer(const GURL& referrer) { |
| 234 referrer_ = referrer; | 234 referrer_ = referrer; |
| 235 } | 235 } |
| 236 const GURL& referrer() const { | 236 const GURL& referrer() const { |
| 237 return referrer_; | 237 return referrer_; |
| 238 } | 238 } |
| 239 | 239 |
| 240 // The display URL, when nonempty, will override the actual URL of the page | 240 // The virtual URL, when nonempty, will override the actual URL of the page |
| 241 // when we display it to the user. This allows us to have nice and friendly | 241 // when we display it to the user. This allows us to have nice and friendly |
| 242 // URLs that the user sees for things like about: URLs, but actually feed | 242 // URLs that the user sees for things like about: URLs, but actually feed |
| 243 // the renderer a data URL that results in the content loading. | 243 // the renderer a data URL that results in the content loading. |
| 244 // | 244 // |
| 245 // display_url() will return the URL to display to the user in all cases, so | 245 // virtual_url() will return the URL to display to the user in all cases, so |
| 246 // if there is no overridden display URL, it will return the actual one. | 246 // if there is no overridden display URL, it will return the actual one. |
| 247 void set_display_url(const GURL& url) { | 247 void set_virtual_url(const GURL& url) { |
| 248 display_url_ = (url == url_) ? GURL() : url; | 248 virtual_url_ = (url == url_) ? GURL() : url; |
| 249 cached_display_title_.clear(); | 249 cached_display_title_.clear(); |
| 250 } | 250 } |
| 251 bool has_display_url() const { | 251 bool has_virtual_url() const { |
| 252 return !display_url_.is_empty(); | 252 return !virtual_url_.is_empty(); |
| 253 } | 253 } |
| 254 const GURL& display_url() const { | 254 const GURL& virtual_url() const { |
| 255 return display_url_.is_empty() ? url_ : display_url_; | 255 return virtual_url_.is_empty() ? url_ : virtual_url_; |
| 256 } | 256 } |
| 257 | 257 |
| 258 // The title as set by the page. This will be empty if there is no title set. | 258 // The title as set by the page. This will be empty if there is no title set. |
| 259 // The caller is responsible for detecting when there is no title and | 259 // The caller is responsible for detecting when there is no title and |
| 260 // displaying the appropriate "Untitled" label if this is being displayed to | 260 // displaying the appropriate "Untitled" label if this is being displayed to |
| 261 // the user. | 261 // the user. |
| 262 void set_title(const string16& title) { | 262 void set_title(const string16& title) { |
| 263 title_ = title; | 263 title_ = title; |
| 264 cached_display_title_.clear(); | 264 cached_display_title_.clear(); |
| 265 } | 265 } |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 // later. If you add a new field that needs to be persisted you'll have to | 378 // later. If you add a new field that needs to be persisted you'll have to |
| 379 // update SessionService/TabRestoreService appropriately. | 379 // update SessionService/TabRestoreService appropriately. |
| 380 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | 380 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING |
| 381 | 381 |
| 382 // See the accessors above for descriptions. | 382 // See the accessors above for descriptions. |
| 383 int unique_id_; | 383 int unique_id_; |
| 384 scoped_refptr<SiteInstance> site_instance_; | 384 scoped_refptr<SiteInstance> site_instance_; |
| 385 PageType page_type_; | 385 PageType page_type_; |
| 386 GURL url_; | 386 GURL url_; |
| 387 GURL referrer_; | 387 GURL referrer_; |
| 388 GURL display_url_; | 388 GURL virtual_url_; |
| 389 string16 title_; | 389 string16 title_; |
| 390 FaviconStatus favicon_; | 390 FaviconStatus favicon_; |
| 391 std::string content_state_; | 391 std::string content_state_; |
| 392 int32 page_id_; | 392 int32 page_id_; |
| 393 SSLStatus ssl_; | 393 SSLStatus ssl_; |
| 394 PageTransition::Type transition_type_; | 394 PageTransition::Type transition_type_; |
| 395 GURL user_typed_url_; | 395 GURL user_typed_url_; |
| 396 bool has_post_data_; | 396 bool has_post_data_; |
| 397 bool restored_; | 397 bool restored_; |
| 398 | 398 |
| 399 // This is a cached version of the result of GetTitleForDisplay. It prevents | 399 // This is a cached version of the result of GetTitleForDisplay. It prevents |
| 400 // us from having to do URL formatting on the URL evey time the title is | 400 // us from having to do URL formatting on the URL evey time the title is |
| 401 // displayed. When the URL, display URL, or title is set, this should be | 401 // displayed. When the URL, virtual URL, or title is set, this should be |
| 402 // cleared to force a refresh. | 402 // cleared to force a refresh. |
| 403 string16 cached_display_title_; | 403 string16 cached_display_title_; |
| 404 | 404 |
| 405 // Copy and assignment is explicitly allowed for this class. | 405 // Copy and assignment is explicitly allowed for this class. |
| 406 }; | 406 }; |
| 407 | 407 |
| 408 #endif // CHROME_BROWSER_TAB_CONTENTS_NAVIGATION_ENTRY_H_ | 408 #endif // CHROME_BROWSER_TAB_CONTENTS_NAVIGATION_ENTRY_H_ |
| OLD | NEW |