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