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/browser/frame_host/navigation_handle_impl.h" |
18 #include "content/common/content_constants_internal.h" | 19 #include "content/common/content_constants_internal.h" |
19 #include "content/common/navigation_params.h" | 20 #include "content/common/navigation_params.h" |
20 #include "content/common/page_state_serialization.h" | 21 #include "content/common/page_state_serialization.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 |
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 ui_timestamp = intent_received_timestamp(); | 584 ui_timestamp = intent_received_timestamp(); |
584 #endif | 585 #endif |
585 | 586 |
586 return CommonNavigationParams( | 587 return CommonNavigationParams( |
587 dest_url, dest_referrer, GetTransitionType(), navigation_type, | 588 dest_url, dest_referrer, GetTransitionType(), navigation_type, |
588 !IsViewSourceMode(), should_replace_entry(), ui_timestamp, report_type, | 589 !IsViewSourceMode(), should_replace_entry(), ui_timestamp, report_type, |
589 GetBaseURLForDataURL(), GetHistoryURLForDataURL(), lofi_state, | 590 GetBaseURLForDataURL(), GetHistoryURLForDataURL(), lofi_state, |
590 navigation_start, GetHasPostData() ? "POST" : "GET"); | 591 navigation_start, GetHasPostData() ? "POST" : "GET"); |
591 } | 592 } |
592 | 593 |
593 StartNavigationParams NavigationEntryImpl::ConstructStartNavigationParams() | 594 StartNavigationParams NavigationEntryImpl::ConstructStartNavigationParams( |
594 const { | 595 const NavigationHandleImpl& navigation_handle) const { |
595 std::vector<unsigned char> browser_initiated_post_data; | 596 scoped_refptr<ResourceRequestBody> post_data; |
596 if (GetBrowserInitiatedPostData()) { | 597 if (const base::RefCountedMemory* memory = GetBrowserInitiatedPostData()) { |
597 browser_initiated_post_data.assign( | 598 post_data = new ResourceRequestBody(); |
598 GetBrowserInitiatedPostData()->front(), | 599 post_data->AppendBytes(memory->front_as<char>(), memory->size()); |
599 GetBrowserInitiatedPostData()->front() + | 600 } else { |
600 GetBrowserInitiatedPostData()->size()); | 601 post_data = navigation_handle.resource_request_body(); |
601 } | 602 } |
602 | 603 |
603 return StartNavigationParams(extra_headers(), browser_initiated_post_data, | 604 return StartNavigationParams(extra_headers(), post_data, |
604 #if defined(OS_ANDROID) | 605 #if defined(OS_ANDROID) |
605 has_user_gesture(), | 606 has_user_gesture(), |
606 #endif | 607 #endif |
607 transferred_global_request_id().child_id, | 608 transferred_global_request_id().child_id, |
608 transferred_global_request_id().request_id); | 609 transferred_global_request_id().request_id); |
609 } | 610 } |
610 | 611 |
611 RequestNavigationParams NavigationEntryImpl::ConstructRequestNavigationParams( | 612 RequestNavigationParams NavigationEntryImpl::ConstructRequestNavigationParams( |
612 const FrameNavigationEntry& frame_entry, | 613 const FrameNavigationEntry& frame_entry, |
613 bool is_same_document_history_load, | 614 bool is_same_document_history_load, |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
758 return node; | 759 return node; |
759 | 760 |
760 // Enqueue any children and keep looking. | 761 // Enqueue any children and keep looking. |
761 for (auto& child : node->children) | 762 for (auto& child : node->children) |
762 work_queue.push(child); | 763 work_queue.push(child); |
763 } | 764 } |
764 return nullptr; | 765 return nullptr; |
765 } | 766 } |
766 | 767 |
767 } // namespace content | 768 } // namespace content |
OLD | NEW |