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