OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/frame_host/navigation_entry_impl.h" | 5 #include "content/browser/frame_host/navigation_entry_impl.h" |
6 | 6 |
| 7 #include <stddef.h> |
| 8 |
7 #include <queue> | 9 #include <queue> |
8 | 10 |
9 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
10 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
11 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "build/build_config.h" |
12 #include "components/url_formatter/url_formatter.h" | 15 #include "components/url_formatter/url_formatter.h" |
13 #include "content/common/content_constants_internal.h" | 16 #include "content/common/content_constants_internal.h" |
14 #include "content/common/navigation_params.h" | 17 #include "content/common/navigation_params.h" |
15 #include "content/common/page_state_serialization.h" | 18 #include "content/common/page_state_serialization.h" |
16 #include "content/common/site_isolation_policy.h" | 19 #include "content/common/site_isolation_policy.h" |
17 #include "content/public/common/content_constants.h" | 20 #include "content/public/common/content_constants.h" |
18 #include "content/public/common/url_constants.h" | 21 #include "content/public/common/url_constants.h" |
19 #include "ui/gfx/text_elider.h" | 22 #include "ui/gfx/text_elider.h" |
20 | 23 |
21 using base::UTF16ToUTF8; | 24 using base::UTF16ToUTF8; |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 if (!EncodePageState(exploded_state, &encoded_data)) | 299 if (!EncodePageState(exploded_state, &encoded_data)) |
297 return frame_tree_->frame_entry->page_state(); | 300 return frame_tree_->frame_entry->page_state(); |
298 | 301 |
299 return PageState::CreateFromEncodedData(encoded_data); | 302 return PageState::CreateFromEncodedData(encoded_data); |
300 } | 303 } |
301 | 304 |
302 void NavigationEntryImpl::SetPageID(int page_id) { | 305 void NavigationEntryImpl::SetPageID(int page_id) { |
303 page_id_ = page_id; | 306 page_id_ = page_id; |
304 } | 307 } |
305 | 308 |
306 int32 NavigationEntryImpl::GetPageID() const { | 309 int32_t NavigationEntryImpl::GetPageID() const { |
307 return page_id_; | 310 return page_id_; |
308 } | 311 } |
309 | 312 |
310 void NavigationEntryImpl::set_site_instance(SiteInstanceImpl* site_instance) { | 313 void NavigationEntryImpl::set_site_instance(SiteInstanceImpl* site_instance) { |
311 // TODO(creis): Update all callers and remove this method. | 314 // TODO(creis): Update all callers and remove this method. |
312 frame_tree_->frame_entry->set_site_instance(site_instance); | 315 frame_tree_->frame_entry->set_site_instance(site_instance); |
313 } | 316 } |
314 | 317 |
315 void NavigationEntryImpl::set_source_site_instance( | 318 void NavigationEntryImpl::set_source_site_instance( |
316 SiteInstanceImpl* source_site_instance) { | 319 SiteInstanceImpl* source_site_instance) { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 } | 388 } |
386 | 389 |
387 void NavigationEntryImpl::SetHasPostData(bool has_post_data) { | 390 void NavigationEntryImpl::SetHasPostData(bool has_post_data) { |
388 has_post_data_ = has_post_data; | 391 has_post_data_ = has_post_data; |
389 } | 392 } |
390 | 393 |
391 bool NavigationEntryImpl::GetHasPostData() const { | 394 bool NavigationEntryImpl::GetHasPostData() const { |
392 return has_post_data_; | 395 return has_post_data_; |
393 } | 396 } |
394 | 397 |
395 void NavigationEntryImpl::SetPostID(int64 post_id) { | 398 void NavigationEntryImpl::SetPostID(int64_t post_id) { |
396 post_id_ = post_id; | 399 post_id_ = post_id; |
397 } | 400 } |
398 | 401 |
399 int64 NavigationEntryImpl::GetPostID() const { | 402 int64_t NavigationEntryImpl::GetPostID() const { |
400 return post_id_; | 403 return post_id_; |
401 } | 404 } |
402 | 405 |
403 void NavigationEntryImpl::SetBrowserInitiatedPostData( | 406 void NavigationEntryImpl::SetBrowserInitiatedPostData( |
404 const base::RefCountedMemory* data) { | 407 const base::RefCountedMemory* data) { |
405 browser_initiated_post_data_ = data; | 408 browser_initiated_post_data_ = data; |
406 } | 409 } |
407 | 410 |
408 const base::RefCountedMemory* | 411 const base::RefCountedMemory* |
409 NavigationEntryImpl::GetBrowserInitiatedPostData() const { | 412 NavigationEntryImpl::GetBrowserInitiatedPostData() const { |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 #if defined(OS_ANDROID) | 667 #if defined(OS_ANDROID) |
665 // Reset the time stamp so that the metrics are not reported if this entry is | 668 // Reset the time stamp so that the metrics are not reported if this entry is |
666 // loaded again in the future. | 669 // loaded again in the future. |
667 set_intent_received_timestamp(base::TimeTicks()); | 670 set_intent_received_timestamp(base::TimeTicks()); |
668 #endif | 671 #endif |
669 } | 672 } |
670 | 673 |
671 void NavigationEntryImpl::AddOrUpdateFrameEntry( | 674 void NavigationEntryImpl::AddOrUpdateFrameEntry( |
672 FrameTreeNode* frame_tree_node, | 675 FrameTreeNode* frame_tree_node, |
673 const std::string& frame_unique_name, | 676 const std::string& frame_unique_name, |
674 int64 item_sequence_number, | 677 int64_t item_sequence_number, |
675 int64 document_sequence_number, | 678 int64_t document_sequence_number, |
676 SiteInstanceImpl* site_instance, | 679 SiteInstanceImpl* site_instance, |
677 const GURL& url, | 680 const GURL& url, |
678 const Referrer& referrer, | 681 const Referrer& referrer, |
679 const PageState& page_state) { | 682 const PageState& page_state) { |
680 // We should already have a TreeNode for the parent node by the time this node | 683 // We should already have a TreeNode for the parent node by the time this node |
681 // commits. Find it first. | 684 // commits. Find it first. |
682 DCHECK(frame_tree_node->parent()); | 685 DCHECK(frame_tree_node->parent()); |
683 NavigationEntryImpl::TreeNode* parent_node = | 686 NavigationEntryImpl::TreeNode* parent_node = |
684 FindFrameEntry(frame_tree_node->parent()); | 687 FindFrameEntry(frame_tree_node->parent()); |
685 if (!parent_node) { | 688 if (!parent_node) { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 return node; | 764 return node; |
762 } | 765 } |
763 // Enqueue any children and keep looking. | 766 // Enqueue any children and keep looking. |
764 for (auto& child : node->children) | 767 for (auto& child : node->children) |
765 work_queue.push(child); | 768 work_queue.push(child); |
766 } | 769 } |
767 return nullptr; | 770 return nullptr; |
768 } | 771 } |
769 | 772 |
770 } // namespace content | 773 } // namespace content |
OLD | NEW |