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 |
| 14 using content::SiteInstance; |
| 15 |
15 // Use this to get a new unique ID for a NavigationEntry during construction. | 16 // 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). | 17 // The returned ID is guaranteed to be nonzero (which is the "no ID" indicator). |
17 static int GetUniqueIDInConstructor() { | 18 static int GetUniqueIDInConstructor() { |
18 static int unique_id_counter = 0; | 19 static int unique_id_counter = 0; |
19 return ++unique_id_counter; | 20 return ++unique_id_counter; |
20 } | 21 } |
21 | 22 |
22 namespace content { | 23 namespace content { |
23 | 24 |
24 NavigationEntry* NavigationEntry::Create() { | 25 NavigationEntry* NavigationEntry::Create() { |
(...skipping 14 matching lines...) Expand all Loading... |
39 site_instance_(NULL), | 40 site_instance_(NULL), |
40 page_type_(PAGE_TYPE_NORMAL), | 41 page_type_(PAGE_TYPE_NORMAL), |
41 update_virtual_url_with_url_(false), | 42 update_virtual_url_with_url_(false), |
42 page_id_(-1), | 43 page_id_(-1), |
43 transition_type_(PAGE_TRANSITION_LINK), | 44 transition_type_(PAGE_TRANSITION_LINK), |
44 has_post_data_(false), | 45 has_post_data_(false), |
45 restore_type_(RESTORE_NONE), | 46 restore_type_(RESTORE_NONE), |
46 is_renderer_initiated_(false) { | 47 is_renderer_initiated_(false) { |
47 } | 48 } |
48 | 49 |
49 NavigationEntryImpl::NavigationEntryImpl(SiteInstance* instance, | 50 NavigationEntryImpl::NavigationEntryImpl(SiteInstanceImpl* instance, |
50 int page_id, | 51 int page_id, |
51 const GURL& url, | 52 const GURL& url, |
52 const Referrer& referrer, | 53 const Referrer& referrer, |
53 const string16& title, | 54 const string16& title, |
54 PageTransition transition_type, | 55 PageTransition transition_type, |
55 bool is_renderer_initiated) | 56 bool is_renderer_initiated) |
56 : unique_id_(GetUniqueIDInConstructor()), | 57 : unique_id_(GetUniqueIDInConstructor()), |
57 site_instance_(instance), | 58 site_instance_(instance), |
58 page_type_(PAGE_TYPE_NORMAL), | 59 page_type_(PAGE_TYPE_NORMAL), |
59 url_(url), | 60 url_(url), |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 } | 123 } |
123 | 124 |
124 void NavigationEntryImpl::SetPageID(int page_id) { | 125 void NavigationEntryImpl::SetPageID(int page_id) { |
125 page_id_ = page_id; | 126 page_id_ = page_id; |
126 } | 127 } |
127 | 128 |
128 int32 NavigationEntryImpl::GetPageID() const { | 129 int32 NavigationEntryImpl::GetPageID() const { |
129 return page_id_; | 130 return page_id_; |
130 } | 131 } |
131 | 132 |
132 void NavigationEntryImpl::set_site_instance(SiteInstance* site_instance) { | 133 void NavigationEntryImpl::set_site_instance(SiteInstanceImpl* site_instance) { |
133 site_instance_ = site_instance; | 134 site_instance_ = site_instance; |
134 } | 135 } |
135 | 136 |
136 const string16& NavigationEntryImpl::GetTitleForDisplay( | 137 const string16& NavigationEntryImpl::GetTitleForDisplay( |
137 const std::string& languages) const { | 138 const std::string& languages) const { |
138 // Most pages have real titles. Don't even bother caching anything if this is | 139 // Most pages have real titles. Don't even bother caching anything if this is |
139 // the case. | 140 // the case. |
140 if (!title_.empty()) | 141 if (!title_.empty()) |
141 return title_; | 142 return title_; |
142 | 143 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 | 200 |
200 const SSLStatus& NavigationEntryImpl::GetSSL() const { | 201 const SSLStatus& NavigationEntryImpl::GetSSL() const { |
201 return ssl_; | 202 return ssl_; |
202 } | 203 } |
203 | 204 |
204 SSLStatus& NavigationEntryImpl::GetSSL() { | 205 SSLStatus& NavigationEntryImpl::GetSSL() { |
205 return ssl_; | 206 return ssl_; |
206 } | 207 } |
207 | 208 |
208 } // namespace content | 209 } // namespace content |
OLD | NEW |