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/render_frame_host_impl.h" | 5 #include "content/browser/frame_host/render_frame_host_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 #include "device/geolocation/geolocation_service_context.h" | 98 #include "device/geolocation/geolocation_service_context.h" |
99 #include "device/vr/features.h" | 99 #include "device/vr/features.h" |
100 #include "device/wake_lock/public/interfaces/wake_lock_context.mojom.h" | 100 #include "device/wake_lock/public/interfaces/wake_lock_context.mojom.h" |
101 #include "device/wake_lock/public/interfaces/wake_lock_service.mojom.h" | 101 #include "device/wake_lock/public/interfaces/wake_lock_service.mojom.h" |
102 #include "media/base/media_switches.h" | 102 #include "media/base/media_switches.h" |
103 #include "media/media_features.h" | 103 #include "media/media_features.h" |
104 #include "media/mojo/interfaces/media_service.mojom.h" | 104 #include "media/mojo/interfaces/media_service.mojom.h" |
105 #include "media/mojo/interfaces/remoting.mojom.h" | 105 #include "media/mojo/interfaces/remoting.mojom.h" |
106 #include "mojo/public/cpp/bindings/associated_interface_ptr.h" | 106 #include "mojo/public/cpp/bindings/associated_interface_ptr.h" |
107 #include "mojo/public/cpp/bindings/strong_binding.h" | 107 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 108 #include "mojo/public/cpp/system/data_pipe.h" |
108 #include "services/service_manager/public/cpp/connector.h" | 109 #include "services/service_manager/public/cpp/connector.h" |
109 #include "services/service_manager/public/cpp/interface_provider.h" | 110 #include "services/service_manager/public/cpp/interface_provider.h" |
110 #include "ui/accessibility/ax_tree.h" | 111 #include "ui/accessibility/ax_tree.h" |
111 #include "ui/accessibility/ax_tree_id_registry.h" | 112 #include "ui/accessibility/ax_tree_id_registry.h" |
112 #include "ui/accessibility/ax_tree_update.h" | 113 #include "ui/accessibility/ax_tree_update.h" |
113 #include "ui/gfx/geometry/quad_f.h" | 114 #include "ui/gfx/geometry/quad_f.h" |
114 #include "url/gurl.h" | 115 #include "url/gurl.h" |
115 | 116 |
116 #if defined(OS_ANDROID) | 117 #if defined(OS_ANDROID) |
117 #include "content/browser/android/java_interfaces_impl.h" | 118 #include "content/browser/android/java_interfaces_impl.h" |
(...skipping 2517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2635 void RenderFrameHostImpl::NavigateToInterstitialURL(const GURL& data_url) { | 2636 void RenderFrameHostImpl::NavigateToInterstitialURL(const GURL& data_url) { |
2636 DCHECK(data_url.SchemeIs(url::kDataScheme)); | 2637 DCHECK(data_url.SchemeIs(url::kDataScheme)); |
2637 CommonNavigationParams common_params( | 2638 CommonNavigationParams common_params( |
2638 data_url, Referrer(), ui::PAGE_TRANSITION_LINK, | 2639 data_url, Referrer(), ui::PAGE_TRANSITION_LINK, |
2639 FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT, false, false, | 2640 FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT, false, false, |
2640 base::TimeTicks::Now(), FrameMsg_UILoadMetricsReportType::NO_REPORT, | 2641 base::TimeTicks::Now(), FrameMsg_UILoadMetricsReportType::NO_REPORT, |
2641 GURL(), GURL(), PREVIEWS_OFF, base::TimeTicks::Now(), "GET", nullptr, | 2642 GURL(), GURL(), PREVIEWS_OFF, base::TimeTicks::Now(), "GET", nullptr, |
2642 base::Optional<SourceLocation>(), | 2643 base::Optional<SourceLocation>(), |
2643 CSPDisposition::CHECK /* should_check_main_world_csp */); | 2644 CSPDisposition::CHECK /* should_check_main_world_csp */); |
2644 if (IsBrowserSideNavigationEnabled()) { | 2645 if (IsBrowserSideNavigationEnabled()) { |
2645 CommitNavigation(nullptr, nullptr, common_params, RequestNavigationParams(), | 2646 CommitNavigation(nullptr, nullptr, mojo::ScopedDataPipeConsumerHandle(), |
2646 false); | 2647 common_params, RequestNavigationParams(), false); |
2647 } else { | 2648 } else { |
2648 Navigate(common_params, StartNavigationParams(), RequestNavigationParams()); | 2649 Navigate(common_params, StartNavigationParams(), RequestNavigationParams()); |
2649 } | 2650 } |
2650 } | 2651 } |
2651 | 2652 |
2652 void RenderFrameHostImpl::Stop() { | 2653 void RenderFrameHostImpl::Stop() { |
2653 Send(new FrameMsg_Stop(routing_id_)); | 2654 Send(new FrameMsg_Stop(routing_id_)); |
2654 } | 2655 } |
2655 | 2656 |
2656 void RenderFrameHostImpl::DispatchBeforeUnload(bool for_navigation, | 2657 void RenderFrameHostImpl::DispatchBeforeUnload(bool for_navigation, |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2795 const base::string16& user_input) { | 2796 const base::string16& user_input) { |
2796 FrameHostMsg_RunJavaScriptDialog::WriteReplyParams(reply_msg, success, | 2797 FrameHostMsg_RunJavaScriptDialog::WriteReplyParams(reply_msg, success, |
2797 user_input); | 2798 user_input); |
2798 Send(reply_msg); | 2799 Send(reply_msg); |
2799 } | 2800 } |
2800 | 2801 |
2801 // PlzNavigate | 2802 // PlzNavigate |
2802 void RenderFrameHostImpl::CommitNavigation( | 2803 void RenderFrameHostImpl::CommitNavigation( |
2803 ResourceResponse* response, | 2804 ResourceResponse* response, |
2804 std::unique_ptr<StreamHandle> body, | 2805 std::unique_ptr<StreamHandle> body, |
| 2806 mojo::ScopedDataPipeConsumerHandle handle, |
2805 const CommonNavigationParams& common_params, | 2807 const CommonNavigationParams& common_params, |
2806 const RequestNavigationParams& request_params, | 2808 const RequestNavigationParams& request_params, |
2807 bool is_view_source) { | 2809 bool is_view_source) { |
2808 DCHECK( | 2810 DCHECK( |
2809 (response && body.get()) || | 2811 (response && (body.get() || handle.is_valid())) || |
2810 common_params.url.SchemeIs(url::kDataScheme) || | 2812 common_params.url.SchemeIs(url::kDataScheme) || |
2811 !ShouldMakeNetworkRequestForURL(common_params.url) || | 2813 !ShouldMakeNetworkRequestForURL(common_params.url) || |
2812 FrameMsg_Navigate_Type::IsSameDocument(common_params.navigation_type) || | 2814 FrameMsg_Navigate_Type::IsSameDocument(common_params.navigation_type) || |
2813 IsRendererDebugURL(common_params.url)); | 2815 IsRendererDebugURL(common_params.url)); |
2814 UpdatePermissionsForNavigation(common_params, request_params); | 2816 UpdatePermissionsForNavigation(common_params, request_params); |
2815 | 2817 |
2816 // Get back to a clean state, in case we start a new navigation without | 2818 // Get back to a clean state, in case we start a new navigation without |
2817 // completing an unload handler. | 2819 // completing an unload handler. |
2818 ResetWaitingState(); | 2820 ResetWaitingState(); |
2819 | 2821 |
2820 // The renderer can exit view source mode when any error or cancellation | 2822 // The renderer can exit view source mode when any error or cancellation |
2821 // happen. When reusing the same renderer, overwrite to recover the mode. | 2823 // happen. When reusing the same renderer, overwrite to recover the mode. |
2822 if (is_view_source && | 2824 if (is_view_source && |
2823 this == frame_tree_node_->render_manager()->current_frame_host()) { | 2825 this == frame_tree_node_->render_manager()->current_frame_host()) { |
2824 DCHECK(!GetParent()); | 2826 DCHECK(!GetParent()); |
2825 render_view_host()->Send(new FrameMsg_EnableViewSourceMode(routing_id_)); | 2827 render_view_host()->Send(new FrameMsg_EnableViewSourceMode(routing_id_)); |
2826 } | 2828 } |
2827 | 2829 |
2828 const GURL body_url = body.get() ? body->GetURL() : GURL(); | 2830 const GURL body_url = body.get() ? body->GetURL() : GURL(); |
2829 const ResourceResponseHead head = response ? | 2831 const ResourceResponseHead head = response ? |
2830 response->head : ResourceResponseHead(); | 2832 response->head : ResourceResponseHead(); |
2831 Send(new FrameMsg_CommitNavigation(routing_id_, head, body_url, common_params, | 2833 Send(new FrameMsg_CommitNavigation(routing_id_, head, body_url, |
| 2834 handle.release(), common_params, |
2832 request_params)); | 2835 request_params)); |
2833 | 2836 |
2834 // If a network request was made, update the Previews state. | 2837 // If a network request was made, update the Previews state. |
2835 if (ShouldMakeNetworkRequestForURL(common_params.url) && | 2838 if (ShouldMakeNetworkRequestForURL(common_params.url) && |
2836 !FrameMsg_Navigate_Type::IsSameDocument(common_params.navigation_type)) { | 2839 !FrameMsg_Navigate_Type::IsSameDocument(common_params.navigation_type)) { |
2837 last_navigation_previews_state_ = common_params.previews_state; | 2840 last_navigation_previews_state_ = common_params.previews_state; |
2838 } | 2841 } |
2839 | 2842 |
2840 // TODO(clamy): Release the stream handle once the renderer has finished | 2843 // TODO(clamy): Release the stream handle once the renderer has finished |
2841 // reading it. | 2844 // reading it. |
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3654 } | 3657 } |
3655 | 3658 |
3656 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame( | 3659 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame( |
3657 const std::string& interface_name, | 3660 const std::string& interface_name, |
3658 mojo::ScopedMessagePipeHandle pipe) { | 3661 mojo::ScopedMessagePipeHandle pipe) { |
3659 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe)); | 3662 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe)); |
3660 } | 3663 } |
3661 #endif | 3664 #endif |
3662 | 3665 |
3663 } // namespace content | 3666 } // namespace content |
OLD | NEW |