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> |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 | 684 |
685 std::string method; | 685 std::string method; |
686 | 686 |
687 // TODO(clamy): Consult the FrameNavigationEntry in all modes that use | 687 // TODO(clamy): Consult the FrameNavigationEntry in all modes that use |
688 // subframe navigation entries. | 688 // subframe navigation entries. |
689 if (IsBrowserSideNavigationEnabled()) | 689 if (IsBrowserSideNavigationEnabled()) |
690 method = frame_entry.method(); | 690 method = frame_entry.method(); |
691 else | 691 else |
692 method = (post_body.get() || GetHasPostData()) ? "POST" : "GET"; | 692 method = (post_body.get() || GetHasPostData()) ? "POST" : "GET"; |
693 | 693 |
| 694 NavigationGesture gesture = NavigationGestureAuto; |
| 695 #if defined(OS_ANDROID) |
| 696 gesture = has_user_gesture() ? NavigationGestureUser : NavigationGestureAuto; |
| 697 #endif |
694 return CommonNavigationParams( | 698 return CommonNavigationParams( |
695 dest_url, dest_referrer, GetTransitionType(), navigation_type, | 699 dest_url, dest_referrer, GetTransitionType(), navigation_type, gesture, |
696 !IsViewSourceMode(), should_replace_entry(), ui_timestamp, report_type, | 700 !IsViewSourceMode(), should_replace_entry(), ui_timestamp, report_type, |
697 GetBaseURLForDataURL(), GetHistoryURLForDataURL(), lofi_state, | 701 GetBaseURLForDataURL(), GetHistoryURLForDataURL(), lofi_state, |
698 navigation_start, method, post_body ? post_body : post_data_); | 702 navigation_start, method, post_body ? post_body : post_data_); |
699 } | 703 } |
700 | 704 |
701 StartNavigationParams NavigationEntryImpl::ConstructStartNavigationParams() | 705 StartNavigationParams NavigationEntryImpl::ConstructStartNavigationParams() |
702 const { | 706 const { |
703 return StartNavigationParams(extra_headers(), | 707 return StartNavigationParams(extra_headers(), |
704 transferred_global_request_id().child_id, | 708 transferred_global_request_id().child_id, |
705 transferred_global_request_id().request_id); | 709 transferred_global_request_id().request_id); |
(...skipping 21 matching lines...) Expand all Loading... |
727 int current_length_to_send = current_history_list_length; | 731 int current_length_to_send = current_history_list_length; |
728 if (should_clear_history_list()) { | 732 if (should_clear_history_list()) { |
729 // Set the history list related parameters to the same values a | 733 // Set the history list related parameters to the same values a |
730 // NavigationController would return before its first navigation. This will | 734 // NavigationController would return before its first navigation. This will |
731 // fully clear the RenderView's view of the session history. | 735 // fully clear the RenderView's view of the session history. |
732 pending_offset_to_send = -1; | 736 pending_offset_to_send = -1; |
733 current_offset_to_send = -1; | 737 current_offset_to_send = -1; |
734 current_length_to_send = 0; | 738 current_length_to_send = 0; |
735 } | 739 } |
736 | 740 |
737 bool user_gesture = false; | |
738 #if defined(OS_ANDROID) | |
739 user_gesture = has_user_gesture(); | |
740 #endif | |
741 RequestNavigationParams request_params( | 741 RequestNavigationParams request_params( |
742 GetIsOverridingUserAgent(), redirects, GetCanLoadLocalResources(), | 742 GetIsOverridingUserAgent(), redirects, GetCanLoadLocalResources(), |
743 frame_entry.page_state(), GetUniqueID(), is_same_document_history_load, | 743 frame_entry.page_state(), GetUniqueID(), is_same_document_history_load, |
744 is_history_navigation_in_new_child, subframe_unique_names, | 744 is_history_navigation_in_new_child, subframe_unique_names, |
745 has_committed_real_load, intended_as_new_entry, pending_offset_to_send, | 745 has_committed_real_load, intended_as_new_entry, pending_offset_to_send, |
746 current_offset_to_send, current_length_to_send, IsViewSourceMode(), | 746 current_offset_to_send, current_length_to_send, IsViewSourceMode(), |
747 should_clear_history_list(), user_gesture); | 747 should_clear_history_list()); |
748 #if defined(OS_ANDROID) | 748 #if defined(OS_ANDROID) |
749 if (GetDataURLAsString() && | 749 if (GetDataURLAsString() && |
750 GetDataURLAsString()->size() <= kMaxLengthOfDataURLString) { | 750 GetDataURLAsString()->size() <= kMaxLengthOfDataURLString) { |
751 // The number of characters that is enough for validating a data: URI. From | 751 // The number of characters that is enough for validating a data: URI. From |
752 // the GURL's POV, the only important part here is scheme, it doesn't check | 752 // the GURL's POV, the only important part here is scheme, it doesn't check |
753 // the actual content. Thus we can take only the prefix of the url, to avoid | 753 // the actual content. Thus we can take only the prefix of the url, to avoid |
754 // unneeded copying of a potentially long string. | 754 // unneeded copying of a potentially long string. |
755 const size_t kDataUriPrefixMaxLen = 64; | 755 const size_t kDataUriPrefixMaxLen = 64; |
756 GURL data_url(std::string( | 756 GURL data_url(std::string( |
757 GetDataURLAsString()->front_as<char>(), | 757 GetDataURLAsString()->front_as<char>(), |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
956 return node; | 956 return node; |
957 | 957 |
958 // Enqueue any children and keep looking. | 958 // Enqueue any children and keep looking. |
959 for (auto* child : node->children) | 959 for (auto* child : node->children) |
960 work_queue.push(child); | 960 work_queue.push(child); |
961 } | 961 } |
962 return nullptr; | 962 return nullptr; |
963 } | 963 } |
964 | 964 |
965 } // namespace content | 965 } // namespace content |
OLD | NEW |