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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 #include "content/public/browser/stream_handle.h" | 81 #include "content/public/browser/stream_handle.h" |
82 #include "content/public/browser/user_metrics.h" | 82 #include "content/public/browser/user_metrics.h" |
83 #include "content/public/common/browser_side_navigation_policy.h" | 83 #include "content/public/common/browser_side_navigation_policy.h" |
84 #include "content/public/common/content_constants.h" | 84 #include "content/public/common/content_constants.h" |
85 #include "content/public/common/content_features.h" | 85 #include "content/public/common/content_features.h" |
86 #include "content/public/common/content_switches.h" | 86 #include "content/public/common/content_switches.h" |
87 #include "content/public/common/file_chooser_file_info.h" | 87 #include "content/public/common/file_chooser_file_info.h" |
88 #include "content/public/common/file_chooser_params.h" | 88 #include "content/public/common/file_chooser_params.h" |
89 #include "content/public/common/form_field_data.h" | 89 #include "content/public/common/form_field_data.h" |
90 #include "content/public/common/isolated_world_ids.h" | 90 #include "content/public/common/isolated_world_ids.h" |
| 91 #include "content/public/common/previews_state.h" |
91 #include "content/public/common/service_manager_connection.h" | 92 #include "content/public/common/service_manager_connection.h" |
92 #include "content/public/common/service_names.mojom.h" | 93 #include "content/public/common/service_names.mojom.h" |
93 #include "content/public/common/url_constants.h" | 94 #include "content/public/common/url_constants.h" |
94 #include "content/public/common/url_utils.h" | 95 #include "content/public/common/url_utils.h" |
95 #include "device/generic_sensor/sensor_provider_impl.h" | 96 #include "device/generic_sensor/sensor_provider_impl.h" |
96 #include "device/geolocation/geolocation_service_context.h" | 97 #include "device/geolocation/geolocation_service_context.h" |
97 #include "device/vibration/vibration_manager_impl.h" | 98 #include "device/vibration/vibration_manager_impl.h" |
98 #include "device/wake_lock/wake_lock_service_context.h" | 99 #include "device/wake_lock/wake_lock_service_context.h" |
99 #include "media/base/media_switches.h" | 100 #include "media/base/media_switches.h" |
100 #include "media/media_features.h" | 101 #include "media/media_features.h" |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 pending_commit_(false), | 331 pending_commit_(false), |
331 nav_entry_id_(0), | 332 nav_entry_id_(0), |
332 accessibility_reset_token_(0), | 333 accessibility_reset_token_(0), |
333 accessibility_reset_count_(0), | 334 accessibility_reset_count_(0), |
334 browser_plugin_embedder_ax_tree_id_(AXTreeIDRegistry::kNoAXTreeID), | 335 browser_plugin_embedder_ax_tree_id_(AXTreeIDRegistry::kNoAXTreeID), |
335 no_create_browser_accessibility_manager_for_testing_(false), | 336 no_create_browser_accessibility_manager_for_testing_(false), |
336 web_ui_type_(WebUI::kNoWebUI), | 337 web_ui_type_(WebUI::kNoWebUI), |
337 pending_web_ui_type_(WebUI::kNoWebUI), | 338 pending_web_ui_type_(WebUI::kNoWebUI), |
338 should_reuse_web_ui_(false), | 339 should_reuse_web_ui_(false), |
339 has_selection_(false), | 340 has_selection_(false), |
340 last_navigation_lofi_state_(LOFI_UNSPECIFIED), | 341 last_navigation_previews_state_(PREVIEWS_UNSPECIFIED), |
341 frame_host_binding_(this), | 342 frame_host_binding_(this), |
342 waiting_for_init_(renderer_initiated_creation), | 343 waiting_for_init_(renderer_initiated_creation), |
343 weak_ptr_factory_(this) { | 344 weak_ptr_factory_(this) { |
344 frame_tree_->AddRenderViewHostRef(render_view_host_); | 345 frame_tree_->AddRenderViewHostRef(render_view_host_); |
345 GetProcess()->AddRoute(routing_id_, this); | 346 GetProcess()->AddRoute(routing_id_, this); |
346 g_routing_id_frame_map.Get().insert(std::make_pair( | 347 g_routing_id_frame_map.Get().insert(std::make_pair( |
347 RenderFrameHostID(GetProcess()->GetID(), routing_id_), | 348 RenderFrameHostID(GetProcess()->GetID(), routing_id_), |
348 this)); | 349 this)); |
349 site_instance_->AddObserver(this); | 350 site_instance_->AddObserver(this); |
350 GetSiteInstance()->IncrementActiveFrameCount(); | 351 GetSiteInstance()->IncrementActiveFrameCount(); |
(...skipping 2076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2427 if (!common_params.url.SchemeIs(url::kJavaScriptScheme)) | 2428 if (!common_params.url.SchemeIs(url::kJavaScriptScheme)) |
2428 OnDidStartLoading(true); | 2429 OnDidStartLoading(true); |
2429 } | 2430 } |
2430 | 2431 |
2431 void RenderFrameHostImpl::NavigateToInterstitialURL(const GURL& data_url) { | 2432 void RenderFrameHostImpl::NavigateToInterstitialURL(const GURL& data_url) { |
2432 DCHECK(data_url.SchemeIs(url::kDataScheme)); | 2433 DCHECK(data_url.SchemeIs(url::kDataScheme)); |
2433 CommonNavigationParams common_params( | 2434 CommonNavigationParams common_params( |
2434 data_url, Referrer(), ui::PAGE_TRANSITION_LINK, | 2435 data_url, Referrer(), ui::PAGE_TRANSITION_LINK, |
2435 FrameMsg_Navigate_Type::NORMAL, NavigationGestureAuto, false, false, | 2436 FrameMsg_Navigate_Type::NORMAL, NavigationGestureAuto, false, false, |
2436 base::TimeTicks::Now(), FrameMsg_UILoadMetricsReportType::NO_REPORT, | 2437 base::TimeTicks::Now(), FrameMsg_UILoadMetricsReportType::NO_REPORT, |
2437 GURL(), GURL(), LOFI_OFF, base::TimeTicks::Now(), "GET", nullptr); | 2438 GURL(), GURL(), PREVIEWS_OFF, base::TimeTicks::Now(), "GET", nullptr); |
2438 if (IsBrowserSideNavigationEnabled()) { | 2439 if (IsBrowserSideNavigationEnabled()) { |
2439 CommitNavigation(nullptr, nullptr, common_params, RequestNavigationParams(), | 2440 CommitNavigation(nullptr, nullptr, common_params, RequestNavigationParams(), |
2440 false); | 2441 false); |
2441 } else { | 2442 } else { |
2442 Navigate(common_params, StartNavigationParams(), RequestNavigationParams()); | 2443 Navigate(common_params, StartNavigationParams(), RequestNavigationParams()); |
2443 } | 2444 } |
2444 } | 2445 } |
2445 | 2446 |
2446 void RenderFrameHostImpl::Stop() { | 2447 void RenderFrameHostImpl::Stop() { |
2447 Send(new FrameMsg_Stop(routing_id_)); | 2448 Send(new FrameMsg_Stop(routing_id_)); |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2610 DCHECK(!GetParent()); | 2611 DCHECK(!GetParent()); |
2611 render_view_host()->Send(new FrameMsg_EnableViewSourceMode(routing_id_)); | 2612 render_view_host()->Send(new FrameMsg_EnableViewSourceMode(routing_id_)); |
2612 } | 2613 } |
2613 | 2614 |
2614 const GURL body_url = body.get() ? body->GetURL() : GURL(); | 2615 const GURL body_url = body.get() ? body->GetURL() : GURL(); |
2615 const ResourceResponseHead head = response ? | 2616 const ResourceResponseHead head = response ? |
2616 response->head : ResourceResponseHead(); | 2617 response->head : ResourceResponseHead(); |
2617 Send(new FrameMsg_CommitNavigation(routing_id_, head, body_url, common_params, | 2618 Send(new FrameMsg_CommitNavigation(routing_id_, head, body_url, common_params, |
2618 request_params)); | 2619 request_params)); |
2619 | 2620 |
2620 // If a network request was made, update the LoFi state. | 2621 // If a network request was made, update the Previews state. |
2621 if (ShouldMakeNetworkRequestForURL(common_params.url)) | 2622 if (ShouldMakeNetworkRequestForURL(common_params.url)) |
2622 last_navigation_lofi_state_ = common_params.lofi_state; | 2623 last_navigation_previews_state_ = common_params.previews_state; |
2623 | 2624 |
2624 // TODO(clamy): Release the stream handle once the renderer has finished | 2625 // TODO(clamy): Release the stream handle once the renderer has finished |
2625 // reading it. | 2626 // reading it. |
2626 stream_handle_ = std::move(body); | 2627 stream_handle_ = std::move(body); |
2627 | 2628 |
2628 // When navigating to a debug url, no commit is expected from the | 2629 // When navigating to a debug url, no commit is expected from the |
2629 // RenderFrameHost, nor should the throbber start. The NavigationRequest is | 2630 // RenderFrameHost, nor should the throbber start. The NavigationRequest is |
2630 // also not stored in the FrameTreeNode. Therefore do not reset it, as this | 2631 // also not stored in the FrameTreeNode. Therefore do not reset it, as this |
2631 // could cancel an existing pending navigation. | 2632 // could cancel an existing pending navigation. |
2632 if (!IsRendererDebugURL(common_params.url)) { | 2633 if (!IsRendererDebugURL(common_params.url)) { |
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3341 // pending_nav_entry_id. If the previous handle was a prematurely aborted | 3342 // pending_nav_entry_id. If the previous handle was a prematurely aborted |
3342 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. | 3343 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. |
3343 return NavigationHandleImpl::Create( | 3344 return NavigationHandleImpl::Create( |
3344 params.url, frame_tree_node_, is_renderer_initiated, | 3345 params.url, frame_tree_node_, is_renderer_initiated, |
3345 params.was_within_same_page, params.is_srcdoc, base::TimeTicks::Now(), | 3346 params.was_within_same_page, params.is_srcdoc, base::TimeTicks::Now(), |
3346 entry_id_for_data_nav, params.gesture, | 3347 entry_id_for_data_nav, params.gesture, |
3347 false); // started_from_context_menu | 3348 false); // started_from_context_menu |
3348 } | 3349 } |
3349 | 3350 |
3350 } // namespace content | 3351 } // namespace content |
OLD | NEW |