OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/web_contents/navigation_entry_impl.h" | 5 #include "content/browser/web_contents/navigation_entry_impl.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "content/public/common/content_constants.h" | 10 #include "content/public/common/content_constants.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 site_instance_(NULL), | 41 site_instance_(NULL), |
42 bindings_(kInvalidBindings), | 42 bindings_(kInvalidBindings), |
43 page_type_(PAGE_TYPE_NORMAL), | 43 page_type_(PAGE_TYPE_NORMAL), |
44 update_virtual_url_with_url_(false), | 44 update_virtual_url_with_url_(false), |
45 page_id_(-1), | 45 page_id_(-1), |
46 transition_type_(PAGE_TRANSITION_LINK), | 46 transition_type_(PAGE_TRANSITION_LINK), |
47 has_post_data_(false), | 47 has_post_data_(false), |
48 post_id_(-1), | 48 post_id_(-1), |
49 restore_type_(RESTORE_NONE), | 49 restore_type_(RESTORE_NONE), |
50 is_overriding_user_agent_(false), | 50 is_overriding_user_agent_(false), |
| 51 http_status_code_(0), |
51 is_renderer_initiated_(false), | 52 is_renderer_initiated_(false), |
52 should_replace_entry_(false), | 53 should_replace_entry_(false), |
53 should_clear_history_list_(false), | 54 should_clear_history_list_(false), |
54 can_load_local_resources_(false) { | 55 can_load_local_resources_(false) { |
55 } | 56 } |
56 | 57 |
57 NavigationEntryImpl::NavigationEntryImpl(SiteInstanceImpl* instance, | 58 NavigationEntryImpl::NavigationEntryImpl(SiteInstanceImpl* instance, |
58 int page_id, | 59 int page_id, |
59 const GURL& url, | 60 const GURL& url, |
60 const Referrer& referrer, | 61 const Referrer& referrer, |
61 const string16& title, | 62 const string16& title, |
62 PageTransition transition_type, | 63 PageTransition transition_type, |
63 bool is_renderer_initiated) | 64 bool is_renderer_initiated) |
64 : unique_id_(GetUniqueIDInConstructor()), | 65 : unique_id_(GetUniqueIDInConstructor()), |
65 site_instance_(instance), | 66 site_instance_(instance), |
66 bindings_(kInvalidBindings), | 67 bindings_(kInvalidBindings), |
67 page_type_(PAGE_TYPE_NORMAL), | 68 page_type_(PAGE_TYPE_NORMAL), |
68 url_(url), | 69 url_(url), |
69 referrer_(referrer), | 70 referrer_(referrer), |
70 update_virtual_url_with_url_(false), | 71 update_virtual_url_with_url_(false), |
71 title_(title), | 72 title_(title), |
72 page_id_(page_id), | 73 page_id_(page_id), |
73 transition_type_(transition_type), | 74 transition_type_(transition_type), |
74 has_post_data_(false), | 75 has_post_data_(false), |
75 post_id_(-1), | 76 post_id_(-1), |
76 restore_type_(RESTORE_NONE), | 77 restore_type_(RESTORE_NONE), |
77 is_overriding_user_agent_(false), | 78 is_overriding_user_agent_(false), |
| 79 http_status_code_(0), |
78 is_renderer_initiated_(is_renderer_initiated), | 80 is_renderer_initiated_(is_renderer_initiated), |
79 should_replace_entry_(false), | 81 should_replace_entry_(false), |
80 should_clear_history_list_(false), | 82 should_clear_history_list_(false), |
81 can_load_local_resources_(false) { | 83 can_load_local_resources_(false) { |
82 } | 84 } |
83 | 85 |
84 NavigationEntryImpl::~NavigationEntryImpl() { | 86 NavigationEntryImpl::~NavigationEntryImpl() { |
85 } | 87 } |
86 | 88 |
87 int NavigationEntryImpl::GetUniqueID() const { | 89 int NavigationEntryImpl::GetUniqueID() const { |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 } | 272 } |
271 | 273 |
272 void NavigationEntryImpl::SetTimestamp(base::Time timestamp) { | 274 void NavigationEntryImpl::SetTimestamp(base::Time timestamp) { |
273 timestamp_ = timestamp; | 275 timestamp_ = timestamp; |
274 } | 276 } |
275 | 277 |
276 base::Time NavigationEntryImpl::GetTimestamp() const { | 278 base::Time NavigationEntryImpl::GetTimestamp() const { |
277 return timestamp_; | 279 return timestamp_; |
278 } | 280 } |
279 | 281 |
| 282 void NavigationEntryImpl::SetHttpStatusCode(int http_status_code) { |
| 283 http_status_code_ = http_status_code; |
| 284 } |
| 285 |
| 286 int NavigationEntryImpl::GetHttpStatusCode() const { |
| 287 return http_status_code_; |
| 288 } |
| 289 |
280 void NavigationEntryImpl::SetCanLoadLocalResources(bool allow) { | 290 void NavigationEntryImpl::SetCanLoadLocalResources(bool allow) { |
281 can_load_local_resources_ = allow; | 291 can_load_local_resources_ = allow; |
282 } | 292 } |
283 | 293 |
284 bool NavigationEntryImpl::GetCanLoadLocalResources() const { | 294 bool NavigationEntryImpl::GetCanLoadLocalResources() const { |
285 return can_load_local_resources_; | 295 return can_load_local_resources_; |
286 } | 296 } |
287 | 297 |
288 void NavigationEntryImpl::SetFrameToNavigate(const std::string& frame_name) { | 298 void NavigationEntryImpl::SetFrameToNavigate(const std::string& frame_name) { |
289 frame_to_navigate_ = frame_name; | 299 frame_to_navigate_ = frame_name; |
(...skipping 22 matching lines...) Expand all Loading... |
312 } | 322 } |
313 | 323 |
314 void NavigationEntryImpl::SetScreenshotPNGData( | 324 void NavigationEntryImpl::SetScreenshotPNGData( |
315 scoped_refptr<base::RefCountedBytes> png_data) { | 325 scoped_refptr<base::RefCountedBytes> png_data) { |
316 screenshot_ = png_data; | 326 screenshot_ = png_data; |
317 if (screenshot_.get()) | 327 if (screenshot_.get()) |
318 UMA_HISTOGRAM_MEMORY_KB("Overscroll.ScreenshotSize", screenshot_->size()); | 328 UMA_HISTOGRAM_MEMORY_KB("Overscroll.ScreenshotSize", screenshot_->size()); |
319 } | 329 } |
320 | 330 |
321 } // namespace content | 331 } // namespace content |
OLD | NEW |