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 2539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2550 // PlzNavigate | 2550 // PlzNavigate |
2551 void RenderFrameHostImpl::CommitNavigation( | 2551 void RenderFrameHostImpl::CommitNavigation( |
2552 ResourceResponse* response, | 2552 ResourceResponse* response, |
2553 std::unique_ptr<StreamHandle> body, | 2553 std::unique_ptr<StreamHandle> body, |
2554 const CommonNavigationParams& common_params, | 2554 const CommonNavigationParams& common_params, |
2555 const RequestNavigationParams& request_params, | 2555 const RequestNavigationParams& request_params, |
2556 bool is_view_source) { | 2556 bool is_view_source) { |
2557 DCHECK((response && body.get()) || | 2557 DCHECK((response && body.get()) || |
2558 common_params.url.SchemeIs(url::kDataScheme) || | 2558 common_params.url.SchemeIs(url::kDataScheme) || |
2559 !ShouldMakeNetworkRequestForURL(common_params.url) || | 2559 !ShouldMakeNetworkRequestForURL(common_params.url) || |
2560 request_params.is_same_document_navigation || | |
2560 IsRendererDebugURL(common_params.url)); | 2561 IsRendererDebugURL(common_params.url)); |
2561 UpdatePermissionsForNavigation(common_params, request_params); | 2562 UpdatePermissionsForNavigation(common_params, request_params); |
2562 | 2563 |
2563 // Get back to a clean state, in case we start a new navigation without | 2564 // Get back to a clean state, in case we start a new navigation without |
2564 // completing an unload handler. | 2565 // completing an unload handler. |
2565 ResetWaitingState(); | 2566 ResetWaitingState(); |
2566 | 2567 |
2567 // The renderer can exit view source mode when any error or cancellation | 2568 // The renderer can exit view source mode when any error or cancellation |
2568 // happen. When reusing the same renderer, overwrite to recover the mode. | 2569 // happen. When reusing the same renderer, overwrite to recover the mode. |
2569 if (is_view_source && | 2570 if (is_view_source && |
2570 this == frame_tree_node_->render_manager()->current_frame_host()) { | 2571 this == frame_tree_node_->render_manager()->current_frame_host()) { |
2571 DCHECK(!GetParent()); | 2572 DCHECK(!GetParent()); |
2572 render_view_host()->Send(new FrameMsg_EnableViewSourceMode(routing_id_)); | 2573 render_view_host()->Send(new FrameMsg_EnableViewSourceMode(routing_id_)); |
2573 } | 2574 } |
2574 | 2575 |
2575 const GURL body_url = body.get() ? body->GetURL() : GURL(); | 2576 const GURL body_url = body.get() ? body->GetURL() : GURL(); |
2576 const ResourceResponseHead head = response ? | 2577 const ResourceResponseHead head = response ? |
2577 response->head : ResourceResponseHead(); | 2578 response->head : ResourceResponseHead(); |
2578 Send(new FrameMsg_CommitNavigation(routing_id_, head, body_url, common_params, | 2579 Send(new FrameMsg_CommitNavigation(routing_id_, head, body_url, common_params, |
2579 request_params)); | 2580 request_params)); |
2580 | 2581 |
2581 // If a network request was made, update the LoFi state. | 2582 // If a network request was made, update the LoFi state. |
2582 if (ShouldMakeNetworkRequestForURL(common_params.url)) | 2583 if (ShouldMakeNetworkRequestForURL(common_params.url) && |
2584 !request_params.is_same_document_navigation) | |
clamy
2016/12/20 15:16:22
Please add curly braces since the if condition spa
arthursonzogni
2016/12/21 10:12:42
Done.
| |
2583 last_navigation_lofi_state_ = common_params.lofi_state; | 2585 last_navigation_lofi_state_ = common_params.lofi_state; |
2584 | 2586 |
2585 // TODO(clamy): Release the stream handle once the renderer has finished | 2587 // TODO(clamy): Release the stream handle once the renderer has finished |
2586 // reading it. | 2588 // reading it. |
2587 stream_handle_ = std::move(body); | 2589 stream_handle_ = std::move(body); |
2588 | 2590 |
2589 // When navigating to a debug url, no commit is expected from the | 2591 // When navigating to a debug url, no commit is expected from the |
2590 // RenderFrameHost, nor should the throbber start. The NavigationRequest is | 2592 // RenderFrameHost, nor should the throbber start. The NavigationRequest is |
2591 // also not stored in the FrameTreeNode. Therefore do not reset it, as this | 2593 // also not stored in the FrameTreeNode. Therefore do not reset it, as this |
2592 // could cancel an existing pending navigation. | 2594 // could cancel an existing pending navigation. |
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3316 // There is no pending NavigationEntry in these cases, so pass 0 as the | 3318 // There is no pending NavigationEntry in these cases, so pass 0 as the |
3317 // pending_nav_entry_id. If the previous handle was a prematurely aborted | 3319 // pending_nav_entry_id. If the previous handle was a prematurely aborted |
3318 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. | 3320 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. |
3319 return NavigationHandleImpl::Create( | 3321 return NavigationHandleImpl::Create( |
3320 params.url, frame_tree_node_, is_renderer_initiated, | 3322 params.url, frame_tree_node_, is_renderer_initiated, |
3321 params.was_within_same_page, base::TimeTicks::Now(), | 3323 params.was_within_same_page, base::TimeTicks::Now(), |
3322 entry_id_for_data_nav, false); // started_from_context_menu | 3324 entry_id_for_data_nav, false); // started_from_context_menu |
3323 } | 3325 } |
3324 | 3326 |
3325 } // namespace content | 3327 } // namespace content |
OLD | NEW |