| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 #include "device/geolocation/geolocation_service_context.h" | 99 #include "device/geolocation/geolocation_service_context.h" |
| 100 #include "device/vr/features.h" | 100 #include "device/vr/features.h" |
| 101 #include "device/wake_lock/public/interfaces/wake_lock_context.mojom.h" | 101 #include "device/wake_lock/public/interfaces/wake_lock_context.mojom.h" |
| 102 #include "device/wake_lock/public/interfaces/wake_lock_service.mojom.h" | 102 #include "device/wake_lock/public/interfaces/wake_lock_service.mojom.h" |
| 103 #include "media/base/media_switches.h" | 103 #include "media/base/media_switches.h" |
| 104 #include "media/media_features.h" | 104 #include "media/media_features.h" |
| 105 #include "media/mojo/interfaces/media_service.mojom.h" | 105 #include "media/mojo/interfaces/media_service.mojom.h" |
| 106 #include "media/mojo/interfaces/remoting.mojom.h" | 106 #include "media/mojo/interfaces/remoting.mojom.h" |
| 107 #include "mojo/public/cpp/bindings/associated_interface_ptr.h" | 107 #include "mojo/public/cpp/bindings/associated_interface_ptr.h" |
| 108 #include "mojo/public/cpp/bindings/strong_binding.h" | 108 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 109 #include "mojo/public/cpp/system/data_pipe.h" |
| 109 #include "services/service_manager/public/cpp/connector.h" | 110 #include "services/service_manager/public/cpp/connector.h" |
| 110 #include "services/service_manager/public/cpp/interface_provider.h" | 111 #include "services/service_manager/public/cpp/interface_provider.h" |
| 111 #include "ui/accessibility/ax_tree.h" | 112 #include "ui/accessibility/ax_tree.h" |
| 112 #include "ui/accessibility/ax_tree_id_registry.h" | 113 #include "ui/accessibility/ax_tree_id_registry.h" |
| 113 #include "ui/accessibility/ax_tree_update.h" | 114 #include "ui/accessibility/ax_tree_update.h" |
| 114 #include "ui/gfx/geometry/quad_f.h" | 115 #include "ui/gfx/geometry/quad_f.h" |
| 115 #include "url/gurl.h" | 116 #include "url/gurl.h" |
| 116 | 117 |
| 117 #if defined(OS_ANDROID) | 118 #if defined(OS_ANDROID) |
| 118 #include "content/browser/android/java_interfaces_impl.h" | 119 #include "content/browser/android/java_interfaces_impl.h" |
| (...skipping 2524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2643 void RenderFrameHostImpl::NavigateToInterstitialURL(const GURL& data_url) { | 2644 void RenderFrameHostImpl::NavigateToInterstitialURL(const GURL& data_url) { |
| 2644 DCHECK(data_url.SchemeIs(url::kDataScheme)); | 2645 DCHECK(data_url.SchemeIs(url::kDataScheme)); |
| 2645 CommonNavigationParams common_params( | 2646 CommonNavigationParams common_params( |
| 2646 data_url, Referrer(), ui::PAGE_TRANSITION_LINK, | 2647 data_url, Referrer(), ui::PAGE_TRANSITION_LINK, |
| 2647 FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT, false, false, | 2648 FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT, false, false, |
| 2648 base::TimeTicks::Now(), FrameMsg_UILoadMetricsReportType::NO_REPORT, | 2649 base::TimeTicks::Now(), FrameMsg_UILoadMetricsReportType::NO_REPORT, |
| 2649 GURL(), GURL(), PREVIEWS_OFF, base::TimeTicks::Now(), "GET", nullptr, | 2650 GURL(), GURL(), PREVIEWS_OFF, base::TimeTicks::Now(), "GET", nullptr, |
| 2650 base::Optional<SourceLocation>(), | 2651 base::Optional<SourceLocation>(), |
| 2651 CSPDisposition::CHECK /* should_check_main_world_csp */); | 2652 CSPDisposition::CHECK /* should_check_main_world_csp */); |
| 2652 if (IsBrowserSideNavigationEnabled()) { | 2653 if (IsBrowserSideNavigationEnabled()) { |
| 2653 CommitNavigation(nullptr, nullptr, common_params, RequestNavigationParams(), | 2654 CommitNavigation(nullptr, nullptr, mojo::ScopedDataPipeConsumerHandle(), |
| 2654 false); | 2655 common_params, RequestNavigationParams(), false); |
| 2655 } else { | 2656 } else { |
| 2656 Navigate(common_params, StartNavigationParams(), RequestNavigationParams()); | 2657 Navigate(common_params, StartNavigationParams(), RequestNavigationParams()); |
| 2657 } | 2658 } |
| 2658 } | 2659 } |
| 2659 | 2660 |
| 2660 void RenderFrameHostImpl::Stop() { | 2661 void RenderFrameHostImpl::Stop() { |
| 2661 Send(new FrameMsg_Stop(routing_id_)); | 2662 Send(new FrameMsg_Stop(routing_id_)); |
| 2662 } | 2663 } |
| 2663 | 2664 |
| 2664 void RenderFrameHostImpl::DispatchBeforeUnload(bool for_navigation, | 2665 void RenderFrameHostImpl::DispatchBeforeUnload(bool for_navigation, |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2803 const base::string16& user_input) { | 2804 const base::string16& user_input) { |
| 2804 FrameHostMsg_RunJavaScriptDialog::WriteReplyParams(reply_msg, success, | 2805 FrameHostMsg_RunJavaScriptDialog::WriteReplyParams(reply_msg, success, |
| 2805 user_input); | 2806 user_input); |
| 2806 Send(reply_msg); | 2807 Send(reply_msg); |
| 2807 } | 2808 } |
| 2808 | 2809 |
| 2809 // PlzNavigate | 2810 // PlzNavigate |
| 2810 void RenderFrameHostImpl::CommitNavigation( | 2811 void RenderFrameHostImpl::CommitNavigation( |
| 2811 ResourceResponse* response, | 2812 ResourceResponse* response, |
| 2812 std::unique_ptr<StreamHandle> body, | 2813 std::unique_ptr<StreamHandle> body, |
| 2814 mojo::ScopedDataPipeConsumerHandle handle, |
| 2813 const CommonNavigationParams& common_params, | 2815 const CommonNavigationParams& common_params, |
| 2814 const RequestNavigationParams& request_params, | 2816 const RequestNavigationParams& request_params, |
| 2815 bool is_view_source) { | 2817 bool is_view_source) { |
| 2816 DCHECK( | 2818 DCHECK( |
| 2817 (response && body.get()) || | 2819 (response && (body.get() || handle.is_valid())) || |
| 2818 common_params.url.SchemeIs(url::kDataScheme) || | 2820 common_params.url.SchemeIs(url::kDataScheme) || |
| 2819 !ShouldMakeNetworkRequestForURL(common_params.url) || | 2821 !ShouldMakeNetworkRequestForURL(common_params.url) || |
| 2820 FrameMsg_Navigate_Type::IsSameDocument(common_params.navigation_type) || | 2822 FrameMsg_Navigate_Type::IsSameDocument(common_params.navigation_type) || |
| 2821 IsRendererDebugURL(common_params.url)); | 2823 IsRendererDebugURL(common_params.url)); |
| 2822 UpdatePermissionsForNavigation(common_params, request_params); | 2824 UpdatePermissionsForNavigation(common_params, request_params); |
| 2823 | 2825 |
| 2824 // Get back to a clean state, in case we start a new navigation without | 2826 // Get back to a clean state, in case we start a new navigation without |
| 2825 // completing an unload handler. | 2827 // completing an unload handler. |
| 2826 ResetWaitingState(); | 2828 ResetWaitingState(); |
| 2827 | 2829 |
| 2828 // The renderer can exit view source mode when any error or cancellation | 2830 // The renderer can exit view source mode when any error or cancellation |
| 2829 // happen. When reusing the same renderer, overwrite to recover the mode. | 2831 // happen. When reusing the same renderer, overwrite to recover the mode. |
| 2830 if (is_view_source && | 2832 if (is_view_source && |
| 2831 this == frame_tree_node_->render_manager()->current_frame_host()) { | 2833 this == frame_tree_node_->render_manager()->current_frame_host()) { |
| 2832 DCHECK(!GetParent()); | 2834 DCHECK(!GetParent()); |
| 2833 render_view_host()->Send(new FrameMsg_EnableViewSourceMode(routing_id_)); | 2835 render_view_host()->Send(new FrameMsg_EnableViewSourceMode(routing_id_)); |
| 2834 } | 2836 } |
| 2835 | 2837 |
| 2836 const GURL body_url = body.get() ? body->GetURL() : GURL(); | 2838 const GURL body_url = body.get() ? body->GetURL() : GURL(); |
| 2837 const ResourceResponseHead head = response ? | 2839 const ResourceResponseHead head = response ? |
| 2838 response->head : ResourceResponseHead(); | 2840 response->head : ResourceResponseHead(); |
| 2839 Send(new FrameMsg_CommitNavigation(routing_id_, head, body_url, common_params, | 2841 const bool network_service_enabled = |
| 2840 request_params)); | 2842 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 2843 switches::kEnableNetworkService); |
| 2844 if (network_service_enabled) { |
| 2845 Send(new FrameMsg_CommitNavigationNetworkService( |
| 2846 routing_id_, head, handle.release(), common_params, request_params)); |
| 2847 } else { |
| 2848 Send(new FrameMsg_CommitNavigation(routing_id_, head, body_url, |
| 2849 common_params, request_params)); |
| 2850 } |
| 2841 | 2851 |
| 2842 // If a network request was made, update the Previews state. | 2852 // If a network request was made, update the Previews state. |
| 2843 if (ShouldMakeNetworkRequestForURL(common_params.url) && | 2853 if (ShouldMakeNetworkRequestForURL(common_params.url) && |
| 2844 !FrameMsg_Navigate_Type::IsSameDocument(common_params.navigation_type)) { | 2854 !FrameMsg_Navigate_Type::IsSameDocument(common_params.navigation_type)) { |
| 2845 last_navigation_previews_state_ = common_params.previews_state; | 2855 last_navigation_previews_state_ = common_params.previews_state; |
| 2846 } | 2856 } |
| 2847 | 2857 |
| 2848 // TODO(clamy): Release the stream handle once the renderer has finished | 2858 // TODO(clamy): Release the stream handle once the renderer has finished |
| 2849 // reading it. | 2859 // reading it. |
| 2850 stream_handle_ = std::move(body); | 2860 stream_handle_ = std::move(body); |
| (...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3662 } | 3672 } |
| 3663 | 3673 |
| 3664 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame( | 3674 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame( |
| 3665 const std::string& interface_name, | 3675 const std::string& interface_name, |
| 3666 mojo::ScopedMessagePipeHandle pipe) { | 3676 mojo::ScopedMessagePipeHandle pipe) { |
| 3667 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe)); | 3677 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe)); |
| 3668 } | 3678 } |
| 3669 #endif | 3679 #endif |
| 3670 | 3680 |
| 3671 } // namespace content | 3681 } // namespace content |
| OLD | NEW |