| 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" |
| 11 #include "base/containers/hash_tables.h" | 11 #include "base/containers/hash_tables.h" |
| 12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
| 13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
| 14 #include "base/metrics/histogram_macros.h" | 14 #include "base/metrics/histogram_macros.h" |
| 15 #include "base/process/kill.h" | 15 #include "base/process/kill.h" |
| 16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
| 18 #include "content/browser/accessibility/accessibility_mode_helper.h" | 18 #include "content/browser/accessibility/accessibility_mode_helper.h" |
| 19 #include "content/browser/accessibility/ax_tree_id_registry.h" | 19 #include "content/browser/accessibility/ax_tree_id_registry.h" |
| 20 #include "content/browser/accessibility/browser_accessibility_manager.h" | 20 #include "content/browser/accessibility/browser_accessibility_manager.h" |
| 21 #include "content/browser/accessibility/browser_accessibility_state_impl.h" | 21 #include "content/browser/accessibility/browser_accessibility_state_impl.h" |
| 22 #include "content/browser/bluetooth/web_bluetooth_service_impl.h" | 22 #include "content/browser/bluetooth/web_bluetooth_service_impl.h" |
| 23 #include "content/browser/child_process_security_policy_impl.h" | 23 #include "content/browser/child_process_security_policy_impl.h" |
| 24 #include "content/browser/devtools/render_frame_devtools_agent_host.h" | 24 #include "content/browser/devtools/render_frame_devtools_agent_host.h" |
| 25 #include "content/browser/download/mhtml_generation_manager.h" | 25 #include "content/browser/download/mhtml_generation_manager.h" |
| 26 #include "content/browser/frame_host/cross_process_frame_connector.h" | 26 #include "content/browser/frame_host/cross_process_frame_connector.h" |
| 27 #include "content/browser/frame_host/debug_urls.h" |
| 27 #include "content/browser/frame_host/frame_tree.h" | 28 #include "content/browser/frame_host/frame_tree.h" |
| 28 #include "content/browser/frame_host/frame_tree_node.h" | 29 #include "content/browser/frame_host/frame_tree_node.h" |
| 29 #include "content/browser/frame_host/navigation_entry_impl.h" | 30 #include "content/browser/frame_host/navigation_entry_impl.h" |
| 30 #include "content/browser/frame_host/navigation_handle_impl.h" | 31 #include "content/browser/frame_host/navigation_handle_impl.h" |
| 31 #include "content/browser/frame_host/navigation_request.h" | 32 #include "content/browser/frame_host/navigation_request.h" |
| 32 #include "content/browser/frame_host/navigator.h" | 33 #include "content/browser/frame_host/navigator.h" |
| 33 #include "content/browser/frame_host/navigator_impl.h" | 34 #include "content/browser/frame_host/navigator_impl.h" |
| 34 #include "content/browser/frame_host/render_frame_host_delegate.h" | 35 #include "content/browser/frame_host/render_frame_host_delegate.h" |
| 35 #include "content/browser/frame_host/render_frame_proxy_host.h" | 36 #include "content/browser/frame_host/render_frame_proxy_host.h" |
| 36 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" | 37 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" |
| (...skipping 2416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2453 | 2454 |
| 2454 // PlzNavigate | 2455 // PlzNavigate |
| 2455 void RenderFrameHostImpl::CommitNavigation( | 2456 void RenderFrameHostImpl::CommitNavigation( |
| 2456 ResourceResponse* response, | 2457 ResourceResponse* response, |
| 2457 std::unique_ptr<StreamHandle> body, | 2458 std::unique_ptr<StreamHandle> body, |
| 2458 const CommonNavigationParams& common_params, | 2459 const CommonNavigationParams& common_params, |
| 2459 const RequestNavigationParams& request_params, | 2460 const RequestNavigationParams& request_params, |
| 2460 bool is_view_source) { | 2461 bool is_view_source) { |
| 2461 DCHECK((response && body.get()) || | 2462 DCHECK((response && body.get()) || |
| 2462 common_params.url.SchemeIs(url::kDataScheme) || | 2463 common_params.url.SchemeIs(url::kDataScheme) || |
| 2463 !ShouldMakeNetworkRequestForURL(common_params.url)); | 2464 !ShouldMakeNetworkRequestForURL(common_params.url) || |
| 2465 IsRendererDebugURL(common_params.url)); |
| 2464 UpdatePermissionsForNavigation(common_params, request_params); | 2466 UpdatePermissionsForNavigation(common_params, request_params); |
| 2465 | 2467 |
| 2466 // Get back to a clean state, in case we start a new navigation without | 2468 // Get back to a clean state, in case we start a new navigation without |
| 2467 // completing an unload handler. | 2469 // completing an unload handler. |
| 2468 ResetWaitingState(); | 2470 ResetWaitingState(); |
| 2469 | 2471 |
| 2470 // The renderer can exit view source mode when any error or cancellation | 2472 // The renderer can exit view source mode when any error or cancellation |
| 2471 // happen. When reusing the same renderer, overwrite to recover the mode. | 2473 // happen. When reusing the same renderer, overwrite to recover the mode. |
| 2472 if (is_view_source && | 2474 if (is_view_source && |
| 2473 this == frame_tree_node_->render_manager()->current_frame_host()) { | 2475 this == frame_tree_node_->render_manager()->current_frame_host()) { |
| 2474 DCHECK(!GetParent()); | 2476 DCHECK(!GetParent()); |
| 2475 render_view_host()->Send(new FrameMsg_EnableViewSourceMode(routing_id_)); | 2477 render_view_host()->Send(new FrameMsg_EnableViewSourceMode(routing_id_)); |
| 2476 } | 2478 } |
| 2477 | 2479 |
| 2478 const GURL body_url = body.get() ? body->GetURL() : GURL(); | 2480 const GURL body_url = body.get() ? body->GetURL() : GURL(); |
| 2479 const ResourceResponseHead head = response ? | 2481 const ResourceResponseHead head = response ? |
| 2480 response->head : ResourceResponseHead(); | 2482 response->head : ResourceResponseHead(); |
| 2481 Send(new FrameMsg_CommitNavigation(routing_id_, head, body_url, common_params, | 2483 Send(new FrameMsg_CommitNavigation(routing_id_, head, body_url, common_params, |
| 2482 request_params)); | 2484 request_params)); |
| 2483 | 2485 |
| 2484 // If a network request was made, update the LoFi state. | 2486 // If a network request was made, update the LoFi state. |
| 2485 if (ShouldMakeNetworkRequestForURL(common_params.url)) | 2487 if (ShouldMakeNetworkRequestForURL(common_params.url)) |
| 2486 last_navigation_lofi_state_ = common_params.lofi_state; | 2488 last_navigation_lofi_state_ = common_params.lofi_state; |
| 2487 | 2489 |
| 2488 // TODO(clamy): Release the stream handle once the renderer has finished | 2490 // TODO(clamy): Release the stream handle once the renderer has finished |
| 2489 // reading it. | 2491 // reading it. |
| 2490 stream_handle_ = std::move(body); | 2492 stream_handle_ = std::move(body); |
| 2491 | 2493 |
| 2492 // When navigating to a Javascript url, no commit is expected from the | 2494 // When navigating to a debug url, no commit is expected from the |
| 2493 // RenderFrameHost, nor should the throbber start. The NavigationRequest is | 2495 // RenderFrameHost, nor should the throbber start. The NavigationRequest is |
| 2494 // also not stored in the FrameTreeNode. Therefore do not reset it, as this | 2496 // also not stored in the FrameTreeNode. Therefore do not reset it, as this |
| 2495 // could cancel an existing pending navigation. | 2497 // could cancel an existing pending navigation. |
| 2496 if (!common_params.url.SchemeIs(url::kJavaScriptScheme)) { | 2498 if (!IsRendererDebugURL(common_params.url)) { |
| 2497 pending_commit_ = true; | 2499 pending_commit_ = true; |
| 2498 is_loading_ = true; | 2500 is_loading_ = true; |
| 2499 } | 2501 } |
| 2500 } | 2502 } |
| 2501 | 2503 |
| 2502 void RenderFrameHostImpl::FailedNavigation( | 2504 void RenderFrameHostImpl::FailedNavigation( |
| 2503 const CommonNavigationParams& common_params, | 2505 const CommonNavigationParams& common_params, |
| 2504 const RequestNavigationParams& request_params, | 2506 const RequestNavigationParams& request_params, |
| 2505 bool has_stale_copy_in_cache, | 2507 bool has_stale_copy_in_cache, |
| 2506 int error_code) { | 2508 int error_code) { |
| (...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3096 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( | 3098 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( |
| 3097 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); | 3099 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); |
| 3098 return web_bluetooth_service_.get(); | 3100 return web_bluetooth_service_.get(); |
| 3099 } | 3101 } |
| 3100 | 3102 |
| 3101 void RenderFrameHostImpl::DeleteWebBluetoothService() { | 3103 void RenderFrameHostImpl::DeleteWebBluetoothService() { |
| 3102 web_bluetooth_service_.reset(); | 3104 web_bluetooth_service_.reset(); |
| 3103 } | 3105 } |
| 3104 | 3106 |
| 3105 } // namespace content | 3107 } // namespace content |
| OLD | NEW |