Chromium Code Reviews| 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 #include "content/browser/tab_contents/navigation_entry_impl.h" | 5 #include "content/browser/tab_contents/navigation_entry_impl.h" |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "content/browser/site_instance.h" | |
| 10 #include "content/public/common/content_constants.h" | 9 #include "content/public/common/content_constants.h" |
| 11 #include "content/public/common/url_constants.h" | 10 #include "content/public/common/url_constants.h" |
| 12 #include "net/base/net_util.h" | 11 #include "net/base/net_util.h" |
| 13 #include "ui/base/text/text_elider.h" | 12 #include "ui/base/text/text_elider.h" |
| 14 | 13 |
| 15 // Use this to get a new unique ID for a NavigationEntry during construction. | 14 // Use this to get a new unique ID for a NavigationEntry during construction. |
| 16 // The returned ID is guaranteed to be nonzero (which is the "no ID" indicator). | 15 // The returned ID is guaranteed to be nonzero (which is the "no ID" indicator). |
| 17 static int GetUniqueIDInConstructor() { | 16 static int GetUniqueIDInConstructor() { |
| 18 static int unique_id_counter = 0; | 17 static int unique_id_counter = 0; |
| 19 return ++unique_id_counter; | 18 return ++unique_id_counter; |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 39 site_instance_(NULL), | 38 site_instance_(NULL), |
| 40 page_type_(PAGE_TYPE_NORMAL), | 39 page_type_(PAGE_TYPE_NORMAL), |
| 41 update_virtual_url_with_url_(false), | 40 update_virtual_url_with_url_(false), |
| 42 page_id_(-1), | 41 page_id_(-1), |
| 43 transition_type_(PAGE_TRANSITION_LINK), | 42 transition_type_(PAGE_TRANSITION_LINK), |
| 44 has_post_data_(false), | 43 has_post_data_(false), |
| 45 restore_type_(RESTORE_NONE), | 44 restore_type_(RESTORE_NONE), |
| 46 is_renderer_initiated_(false) { | 45 is_renderer_initiated_(false) { |
| 47 } | 46 } |
| 48 | 47 |
| 49 NavigationEntryImpl::NavigationEntryImpl(SiteInstance* instance, | 48 NavigationEntryImpl::NavigationEntryImpl(content::SiteInstance* instance, |
|
jam
2012/01/24 03:29:33
nit: this class should only be created by code in
ananta
2012/01/24 23:46:26
Done.
| |
| 50 int page_id, | 49 int page_id, |
| 51 const GURL& url, | 50 const GURL& url, |
| 52 const Referrer& referrer, | 51 const Referrer& referrer, |
| 53 const string16& title, | 52 const string16& title, |
| 54 PageTransition transition_type, | 53 PageTransition transition_type, |
| 55 bool is_renderer_initiated) | 54 bool is_renderer_initiated) |
| 56 : unique_id_(GetUniqueIDInConstructor()), | 55 : unique_id_(GetUniqueIDInConstructor()), |
| 57 site_instance_(instance), | 56 site_instance_(reinterpret_cast<SiteInstanceImpl*>(instance)), |
|
jam
2012/01/24 03:29:33
ditto
ananta
2012/01/24 23:46:26
Done.
| |
| 58 page_type_(PAGE_TYPE_NORMAL), | 57 page_type_(PAGE_TYPE_NORMAL), |
| 59 url_(url), | 58 url_(url), |
| 60 referrer_(referrer), | 59 referrer_(referrer), |
| 61 update_virtual_url_with_url_(false), | 60 update_virtual_url_with_url_(false), |
| 62 title_(title), | 61 title_(title), |
| 63 page_id_(page_id), | 62 page_id_(page_id), |
| 64 transition_type_(transition_type), | 63 transition_type_(transition_type), |
| 65 has_post_data_(false), | 64 has_post_data_(false), |
| 66 restore_type_(RESTORE_NONE), | 65 restore_type_(RESTORE_NONE), |
| 67 is_renderer_initiated_(is_renderer_initiated) { | 66 is_renderer_initiated_(is_renderer_initiated) { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 122 } | 121 } |
| 123 | 122 |
| 124 void NavigationEntryImpl::SetPageID(int page_id) { | 123 void NavigationEntryImpl::SetPageID(int page_id) { |
| 125 page_id_ = page_id; | 124 page_id_ = page_id; |
| 126 } | 125 } |
| 127 | 126 |
| 128 int32 NavigationEntryImpl::GetPageID() const { | 127 int32 NavigationEntryImpl::GetPageID() const { |
| 129 return page_id_; | 128 return page_id_; |
| 130 } | 129 } |
| 131 | 130 |
| 132 void NavigationEntryImpl::set_site_instance(SiteInstance* site_instance) { | 131 void NavigationEntryImpl::set_site_instance( |
| 133 site_instance_ = site_instance; | 132 content::SiteInstance* site_instance) { |
| 133 site_instance_ = reinterpret_cast<SiteInstanceImpl*>(site_instance); | |
|
jam
2012/01/24 03:29:33
ditto
ananta
2012/01/24 23:46:26
Done.
| |
| 134 } | 134 } |
| 135 | 135 |
| 136 const string16& NavigationEntryImpl::GetTitleForDisplay( | 136 const string16& NavigationEntryImpl::GetTitleForDisplay( |
| 137 const std::string& languages) const { | 137 const std::string& languages) const { |
| 138 // Most pages have real titles. Don't even bother caching anything if this is | 138 // Most pages have real titles. Don't even bother caching anything if this is |
| 139 // the case. | 139 // the case. |
| 140 if (!title_.empty()) | 140 if (!title_.empty()) |
| 141 return title_; | 141 return title_; |
| 142 | 142 |
| 143 // More complicated cases will use the URLs as the title. This result we will | 143 // More complicated cases will use the URLs as the title. This result we will |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 199 | 199 |
| 200 const SSLStatus& NavigationEntryImpl::GetSSL() const { | 200 const SSLStatus& NavigationEntryImpl::GetSSL() const { |
| 201 return ssl_; | 201 return ssl_; |
| 202 } | 202 } |
| 203 | 203 |
| 204 SSLStatus& NavigationEntryImpl::GetSSL() { | 204 SSLStatus& NavigationEntryImpl::GetSSL() { |
| 205 return ssl_; | 205 return ssl_; |
| 206 } | 206 } |
| 207 | 207 |
| 208 } // namespace content | 208 } // namespace content |
| OLD | NEW |