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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 2043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2054 | 2054 |
2055 void RenderFrameHostImpl::NavigateToInterstitialURL(const GURL& data_url) { | 2055 void RenderFrameHostImpl::NavigateToInterstitialURL(const GURL& data_url) { |
2056 DCHECK(data_url.SchemeIs(url::kDataScheme)); | 2056 DCHECK(data_url.SchemeIs(url::kDataScheme)); |
2057 CommonNavigationParams common_params( | 2057 CommonNavigationParams common_params( |
2058 data_url, Referrer(), ui::PAGE_TRANSITION_LINK, | 2058 data_url, Referrer(), ui::PAGE_TRANSITION_LINK, |
2059 FrameMsg_Navigate_Type::NORMAL, false, false, base::TimeTicks::Now(), | 2059 FrameMsg_Navigate_Type::NORMAL, false, false, base::TimeTicks::Now(), |
2060 FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL(), LOFI_OFF, | 2060 FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL(), LOFI_OFF, |
2061 base::TimeTicks::Now(), "GET"); | 2061 base::TimeTicks::Now(), "GET"); |
2062 if (IsBrowserSideNavigationEnabled()) { | 2062 if (IsBrowserSideNavigationEnabled()) { |
2063 CommitNavigation(nullptr, nullptr, common_params, RequestNavigationParams(), | 2063 CommitNavigation(nullptr, nullptr, common_params, RequestNavigationParams(), |
2064 false); | 2064 false, nullptr); |
2065 } else { | 2065 } else { |
2066 Navigate(common_params, StartNavigationParams(), RequestNavigationParams()); | 2066 Navigate(common_params, StartNavigationParams(), RequestNavigationParams()); |
2067 } | 2067 } |
2068 } | 2068 } |
2069 | 2069 |
2070 void RenderFrameHostImpl::OpenURL(const FrameHostMsg_OpenURL_Params& params, | 2070 void RenderFrameHostImpl::OpenURL(const FrameHostMsg_OpenURL_Params& params, |
2071 SiteInstance* source_site_instance) { | 2071 SiteInstance* source_site_instance) { |
2072 GURL validated_url(params.url); | 2072 GURL validated_url(params.url); |
2073 GetProcess()->FilterURL(false, &validated_url); | 2073 GetProcess()->FilterURL(false, &validated_url); |
2074 | 2074 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2185 render_view_host_->GetWidget()); | 2185 render_view_host_->GetWidget()); |
2186 } | 2186 } |
2187 } | 2187 } |
2188 | 2188 |
2189 // PlzNavigate | 2189 // PlzNavigate |
2190 void RenderFrameHostImpl::CommitNavigation( | 2190 void RenderFrameHostImpl::CommitNavigation( |
2191 ResourceResponse* response, | 2191 ResourceResponse* response, |
2192 std::unique_ptr<StreamHandle> body, | 2192 std::unique_ptr<StreamHandle> body, |
2193 const CommonNavigationParams& common_params, | 2193 const CommonNavigationParams& common_params, |
2194 const RequestNavigationParams& request_params, | 2194 const RequestNavigationParams& request_params, |
2195 bool is_view_source) { | 2195 bool is_view_source, |
| 2196 scoped_refptr<ResourceRequestBody> post_data) { |
2196 DCHECK((response && body.get()) || | 2197 DCHECK((response && body.get()) || |
2197 !ShouldMakeNetworkRequestForURL(common_params.url)); | 2198 !ShouldMakeNetworkRequestForURL(common_params.url)); |
2198 UpdatePermissionsForNavigation(common_params, request_params); | 2199 UpdatePermissionsForNavigation(common_params, request_params); |
2199 | 2200 |
2200 // Get back to a clean state, in case we start a new navigation without | 2201 // Get back to a clean state, in case we start a new navigation without |
2201 // completing an unload handler. | 2202 // completing an unload handler. |
2202 ResetWaitingState(); | 2203 ResetWaitingState(); |
2203 | 2204 |
2204 // The renderer can exit view source mode when any error or cancellation | 2205 // The renderer can exit view source mode when any error or cancellation |
2205 // happen. When reusing the same renderer, overwrite to recover the mode. | 2206 // happen. When reusing the same renderer, overwrite to recover the mode. |
2206 if (is_view_source && | 2207 if (is_view_source && |
2207 this == frame_tree_node_->render_manager()->current_frame_host()) { | 2208 this == frame_tree_node_->render_manager()->current_frame_host()) { |
2208 DCHECK(!GetParent()); | 2209 DCHECK(!GetParent()); |
2209 render_view_host()->Send(new FrameMsg_EnableViewSourceMode(routing_id_)); | 2210 render_view_host()->Send(new FrameMsg_EnableViewSourceMode(routing_id_)); |
2210 } | 2211 } |
2211 | 2212 |
2212 const GURL body_url = body.get() ? body->GetURL() : GURL(); | 2213 const GURL body_url = body.get() ? body->GetURL() : GURL(); |
2213 const ResourceResponseHead head = response ? | 2214 const ResourceResponseHead head = response ? |
2214 response->head : ResourceResponseHead(); | 2215 response->head : ResourceResponseHead(); |
2215 Send(new FrameMsg_CommitNavigation(routing_id_, head, body_url, common_params, | 2216 Send(new FrameMsg_CommitNavigation(routing_id_, head, body_url, common_params, |
2216 request_params)); | 2217 request_params, post_data)); |
2217 | 2218 |
2218 // If a network request was made, update the LoFi state. | 2219 // If a network request was made, update the LoFi state. |
2219 if (ShouldMakeNetworkRequestForURL(common_params.url)) | 2220 if (ShouldMakeNetworkRequestForURL(common_params.url)) |
2220 last_navigation_lofi_state_ = common_params.lofi_state; | 2221 last_navigation_lofi_state_ = common_params.lofi_state; |
2221 | 2222 |
2222 // TODO(clamy): Release the stream handle once the renderer has finished | 2223 // TODO(clamy): Release the stream handle once the renderer has finished |
2223 // reading it. | 2224 // reading it. |
2224 stream_handle_ = std::move(body); | 2225 stream_handle_ = std::move(body); |
2225 | 2226 |
2226 // When navigating to a Javascript url, no commit is expected from the | 2227 // When navigating to a Javascript url, no commit is expected from the |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2763 // handler after it's destroyed so it can't run after the RFHI is destroyed. | 2764 // handler after it's destroyed so it can't run after the RFHI is destroyed. |
2764 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( | 2765 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( |
2765 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); | 2766 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); |
2766 } | 2767 } |
2767 | 2768 |
2768 void RenderFrameHostImpl::DeleteWebBluetoothService() { | 2769 void RenderFrameHostImpl::DeleteWebBluetoothService() { |
2769 web_bluetooth_service_.reset(); | 2770 web_bluetooth_service_.reset(); |
2770 } | 2771 } |
2771 | 2772 |
2772 } // namespace content | 2773 } // namespace content |
OLD | NEW |