| 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> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <queue> | 9 #include <queue> |
| 10 #include <utility> | 10 #include <utility> |
| 11 | 11 |
| 12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
| 13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
| 14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
| 15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 17 #include "components/url_formatter/url_formatter.h" | 17 #include "components/url_formatter/url_formatter.h" |
| 18 #include "content/common/content_constants_internal.h" | 18 #include "content/common/content_constants_internal.h" |
| 19 #include "content/common/navigation_params.h" | 19 #include "content/common/navigation_params.h" |
| 20 #include "content/common/page_state_serialization.h" | 20 #include "content/common/page_state_serialization.h" |
| 21 #include "content/common/resource_request_body.h" |
| 21 #include "content/common/site_isolation_policy.h" | 22 #include "content/common/site_isolation_policy.h" |
| 22 #include "content/public/common/content_constants.h" | 23 #include "content/public/common/content_constants.h" |
| 23 #include "content/public/common/url_constants.h" | 24 #include "content/public/common/url_constants.h" |
| 24 #include "ui/gfx/text_elider.h" | 25 #include "ui/gfx/text_elider.h" |
| 25 | 26 |
| 26 using base::UTF16ToUTF8; | 27 using base::UTF16ToUTF8; |
| 27 | 28 |
| 28 namespace content { | 29 namespace content { |
| 29 | 30 |
| 30 namespace { | 31 namespace { |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 copy->redirect_chain_ = redirect_chain_; | 563 copy->redirect_chain_ = redirect_chain_; |
| 563 // ResetForCommit: should_clear_history_list_ | 564 // ResetForCommit: should_clear_history_list_ |
| 564 // ResetForCommit: frame_tree_node_id_ | 565 // ResetForCommit: frame_tree_node_id_ |
| 565 // ResetForCommit: intent_received_timestamp_ | 566 // ResetForCommit: intent_received_timestamp_ |
| 566 copy->extra_data_ = extra_data_; | 567 copy->extra_data_ = extra_data_; |
| 567 | 568 |
| 568 return copy; | 569 return copy; |
| 569 } | 570 } |
| 570 | 571 |
| 571 CommonNavigationParams NavigationEntryImpl::ConstructCommonNavigationParams( | 572 CommonNavigationParams NavigationEntryImpl::ConstructCommonNavigationParams( |
| 573 const std::string& method, |
| 572 const GURL& dest_url, | 574 const GURL& dest_url, |
| 573 const Referrer& dest_referrer, | 575 const Referrer& dest_referrer, |
| 574 FrameMsg_Navigate_Type::Value navigation_type, | 576 FrameMsg_Navigate_Type::Value navigation_type, |
| 575 LoFiState lofi_state, | 577 LoFiState lofi_state, |
| 576 const base::TimeTicks& navigation_start) const { | 578 const base::TimeTicks& navigation_start) const { |
| 577 FrameMsg_UILoadMetricsReportType::Value report_type = | 579 FrameMsg_UILoadMetricsReportType::Value report_type = |
| 578 FrameMsg_UILoadMetricsReportType::NO_REPORT; | 580 FrameMsg_UILoadMetricsReportType::NO_REPORT; |
| 579 base::TimeTicks ui_timestamp = base::TimeTicks(); | 581 base::TimeTicks ui_timestamp = base::TimeTicks(); |
| 580 #if defined(OS_ANDROID) | 582 #if defined(OS_ANDROID) |
| 581 if (!intent_received_timestamp().is_null()) | 583 if (!intent_received_timestamp().is_null()) |
| 582 report_type = FrameMsg_UILoadMetricsReportType::REPORT_INTENT; | 584 report_type = FrameMsg_UILoadMetricsReportType::REPORT_INTENT; |
| 583 ui_timestamp = intent_received_timestamp(); | 585 ui_timestamp = intent_received_timestamp(); |
| 584 #endif | 586 #endif |
| 585 | 587 |
| 588 if (GetHasPostData()) |
| 589 DCHECK_EQ("POST", method); |
| 590 |
| 586 return CommonNavigationParams( | 591 return CommonNavigationParams( |
| 587 dest_url, dest_referrer, GetTransitionType(), navigation_type, | 592 dest_url, dest_referrer, GetTransitionType(), navigation_type, |
| 588 !IsViewSourceMode(), should_replace_entry(), ui_timestamp, report_type, | 593 !IsViewSourceMode(), should_replace_entry(), ui_timestamp, report_type, |
| 589 GetBaseURLForDataURL(), GetHistoryURLForDataURL(), lofi_state, | 594 GetBaseURLForDataURL(), GetHistoryURLForDataURL(), lofi_state, |
| 590 navigation_start, GetHasPostData() ? "POST" : "GET"); | 595 navigation_start, method); |
| 591 } | 596 } |
| 592 | 597 |
| 593 StartNavigationParams NavigationEntryImpl::ConstructStartNavigationParams() | 598 StartNavigationParams NavigationEntryImpl::ConstructStartNavigationParams( |
| 594 const { | 599 const scoped_refptr<ResourceRequestBody>& post_body) const { |
| 595 std::vector<unsigned char> browser_initiated_post_data; | 600 scoped_refptr<ResourceRequestBody> browser_initiated_post_body; |
| 596 if (GetBrowserInitiatedPostData()) { | 601 if (const base::RefCountedMemory* memory = GetBrowserInitiatedPostData()) { |
| 597 browser_initiated_post_data.assign( | 602 browser_initiated_post_body = new ResourceRequestBody(); |
| 598 GetBrowserInitiatedPostData()->front(), | 603 browser_initiated_post_body->AppendBytes(memory->front_as<char>(), |
| 599 GetBrowserInitiatedPostData()->front() + | 604 memory->size()); |
| 600 GetBrowserInitiatedPostData()->size()); | |
| 601 } | 605 } |
| 602 | 606 |
| 603 return StartNavigationParams(extra_headers(), browser_initiated_post_data, | 607 return StartNavigationParams( |
| 608 extra_headers(), post_body ? post_body : browser_initiated_post_body, |
| 604 #if defined(OS_ANDROID) | 609 #if defined(OS_ANDROID) |
| 605 has_user_gesture(), | 610 has_user_gesture(), |
| 606 #endif | 611 #endif |
| 607 transferred_global_request_id().child_id, | 612 transferred_global_request_id().child_id, |
| 608 transferred_global_request_id().request_id); | 613 transferred_global_request_id().request_id); |
| 609 } | 614 } |
| 610 | 615 |
| 611 RequestNavigationParams NavigationEntryImpl::ConstructRequestNavigationParams( | 616 RequestNavigationParams NavigationEntryImpl::ConstructRequestNavigationParams( |
| 612 const FrameNavigationEntry& frame_entry, | 617 const FrameNavigationEntry& frame_entry, |
| 613 bool is_same_document_history_load, | 618 bool is_same_document_history_load, |
| 614 bool has_committed_real_load, | 619 bool has_committed_real_load, |
| 615 bool intended_as_new_entry, | 620 bool intended_as_new_entry, |
| 616 int pending_history_list_offset, | 621 int pending_history_list_offset, |
| 617 int current_history_list_offset, | 622 int current_history_list_offset, |
| 618 int current_history_list_length) const { | 623 int current_history_list_length) const { |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 return node; | 763 return node; |
| 759 | 764 |
| 760 // Enqueue any children and keep looking. | 765 // Enqueue any children and keep looking. |
| 761 for (auto& child : node->children) | 766 for (auto& child : node->children) |
| 762 work_queue.push(child); | 767 work_queue.push(child); |
| 763 } | 768 } |
| 764 return nullptr; | 769 return nullptr; |
| 765 } | 770 } |
| 766 | 771 |
| 767 } // namespace content | 772 } // namespace content |
| OLD | NEW |