Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 2484633004: Change Lo-Fi bool to bitmask to support multiple Previews types (Closed)
Patch Set: rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 #include "content/public/browser/stream_handle.h" 82 #include "content/public/browser/stream_handle.h"
83 #include "content/public/browser/user_metrics.h" 83 #include "content/public/browser/user_metrics.h"
84 #include "content/public/common/browser_side_navigation_policy.h" 84 #include "content/public/common/browser_side_navigation_policy.h"
85 #include "content/public/common/content_constants.h" 85 #include "content/public/common/content_constants.h"
86 #include "content/public/common/content_features.h" 86 #include "content/public/common/content_features.h"
87 #include "content/public/common/content_switches.h" 87 #include "content/public/common/content_switches.h"
88 #include "content/public/common/file_chooser_file_info.h" 88 #include "content/public/common/file_chooser_file_info.h"
89 #include "content/public/common/file_chooser_params.h" 89 #include "content/public/common/file_chooser_params.h"
90 #include "content/public/common/form_field_data.h" 90 #include "content/public/common/form_field_data.h"
91 #include "content/public/common/isolated_world_ids.h" 91 #include "content/public/common/isolated_world_ids.h"
92 #include "content/public/common/previews_state.h"
92 #include "content/public/common/service_manager_connection.h" 93 #include "content/public/common/service_manager_connection.h"
93 #include "content/public/common/service_names.mojom.h" 94 #include "content/public/common/service_names.mojom.h"
94 #include "content/public/common/url_constants.h" 95 #include "content/public/common/url_constants.h"
95 #include "content/public/common/url_utils.h" 96 #include "content/public/common/url_utils.h"
96 #include "device/generic_sensor/sensor_provider_impl.h" 97 #include "device/generic_sensor/sensor_provider_impl.h"
97 #include "device/geolocation/geolocation_service_context.h" 98 #include "device/geolocation/geolocation_service_context.h"
98 #include "device/vibration/vibration_manager_impl.h" 99 #include "device/vibration/vibration_manager_impl.h"
99 #include "device/wake_lock/wake_lock_service_context.h" 100 #include "device/wake_lock/wake_lock_service_context.h"
100 #include "media/base/media_switches.h" 101 #include "media/base/media_switches.h"
101 #include "media/media_features.h" 102 #include "media/media_features.h"
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 pending_commit_(false), 328 pending_commit_(false),
328 nav_entry_id_(0), 329 nav_entry_id_(0),
329 accessibility_reset_token_(0), 330 accessibility_reset_token_(0),
330 accessibility_reset_count_(0), 331 accessibility_reset_count_(0),
331 browser_plugin_embedder_ax_tree_id_(AXTreeIDRegistry::kNoAXTreeID), 332 browser_plugin_embedder_ax_tree_id_(AXTreeIDRegistry::kNoAXTreeID),
332 no_create_browser_accessibility_manager_for_testing_(false), 333 no_create_browser_accessibility_manager_for_testing_(false),
333 web_ui_type_(WebUI::kNoWebUI), 334 web_ui_type_(WebUI::kNoWebUI),
334 pending_web_ui_type_(WebUI::kNoWebUI), 335 pending_web_ui_type_(WebUI::kNoWebUI),
335 should_reuse_web_ui_(false), 336 should_reuse_web_ui_(false),
336 has_selection_(false), 337 has_selection_(false),
337 last_navigation_lofi_state_(LOFI_UNSPECIFIED), 338 last_navigation_previews_state_(PREVIEWS_UNSPECIFIED),
338 frame_host_binding_(this), 339 frame_host_binding_(this),
339 waiting_for_init_(renderer_initiated_creation), 340 waiting_for_init_(renderer_initiated_creation),
340 weak_ptr_factory_(this) { 341 weak_ptr_factory_(this) {
341 frame_tree_->AddRenderViewHostRef(render_view_host_); 342 frame_tree_->AddRenderViewHostRef(render_view_host_);
342 GetProcess()->AddRoute(routing_id_, this); 343 GetProcess()->AddRoute(routing_id_, this);
343 g_routing_id_frame_map.Get().insert(std::make_pair( 344 g_routing_id_frame_map.Get().insert(std::make_pair(
344 RenderFrameHostID(GetProcess()->GetID(), routing_id_), 345 RenderFrameHostID(GetProcess()->GetID(), routing_id_),
345 this)); 346 this));
346 site_instance_->AddObserver(this); 347 site_instance_->AddObserver(this);
347 GetSiteInstance()->IncrementActiveFrameCount(); 348 GetSiteInstance()->IncrementActiveFrameCount();
(...skipping 2050 matching lines...) Expand 10 before | Expand all | Expand 10 after
2398 if (!common_params.url.SchemeIs(url::kJavaScriptScheme)) 2399 if (!common_params.url.SchemeIs(url::kJavaScriptScheme))
2399 OnDidStartLoading(true); 2400 OnDidStartLoading(true);
2400 } 2401 }
2401 2402
2402 void RenderFrameHostImpl::NavigateToInterstitialURL(const GURL& data_url) { 2403 void RenderFrameHostImpl::NavigateToInterstitialURL(const GURL& data_url) {
2403 DCHECK(data_url.SchemeIs(url::kDataScheme)); 2404 DCHECK(data_url.SchemeIs(url::kDataScheme));
2404 CommonNavigationParams common_params( 2405 CommonNavigationParams common_params(
2405 data_url, Referrer(), ui::PAGE_TRANSITION_LINK, 2406 data_url, Referrer(), ui::PAGE_TRANSITION_LINK,
2406 FrameMsg_Navigate_Type::NORMAL, NavigationGestureAuto, false, false, 2407 FrameMsg_Navigate_Type::NORMAL, NavigationGestureAuto, false, false,
2407 base::TimeTicks::Now(), FrameMsg_UILoadMetricsReportType::NO_REPORT, 2408 base::TimeTicks::Now(), FrameMsg_UILoadMetricsReportType::NO_REPORT,
2408 GURL(), GURL(), LOFI_OFF, base::TimeTicks::Now(), "GET", nullptr); 2409 GURL(), GURL(), PREVIEWS_OFF, base::TimeTicks::Now(), "GET", nullptr);
2409 if (IsBrowserSideNavigationEnabled()) { 2410 if (IsBrowserSideNavigationEnabled()) {
2410 CommitNavigation(nullptr, nullptr, common_params, RequestNavigationParams(), 2411 CommitNavigation(nullptr, nullptr, common_params, RequestNavigationParams(),
2411 false); 2412 false);
2412 } else { 2413 } else {
2413 Navigate(common_params, StartNavigationParams(), RequestNavigationParams()); 2414 Navigate(common_params, StartNavigationParams(), RequestNavigationParams());
2414 } 2415 }
2415 } 2416 }
2416 2417
2417 void RenderFrameHostImpl::Stop() { 2418 void RenderFrameHostImpl::Stop() {
2418 Send(new FrameMsg_Stop(routing_id_)); 2419 Send(new FrameMsg_Stop(routing_id_));
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
2581 DCHECK(!GetParent()); 2582 DCHECK(!GetParent());
2582 render_view_host()->Send(new FrameMsg_EnableViewSourceMode(routing_id_)); 2583 render_view_host()->Send(new FrameMsg_EnableViewSourceMode(routing_id_));
2583 } 2584 }
2584 2585
2585 const GURL body_url = body.get() ? body->GetURL() : GURL(); 2586 const GURL body_url = body.get() ? body->GetURL() : GURL();
2586 const ResourceResponseHead head = response ? 2587 const ResourceResponseHead head = response ?
2587 response->head : ResourceResponseHead(); 2588 response->head : ResourceResponseHead();
2588 Send(new FrameMsg_CommitNavigation(routing_id_, head, body_url, common_params, 2589 Send(new FrameMsg_CommitNavigation(routing_id_, head, body_url, common_params,
2589 request_params)); 2590 request_params));
2590 2591
2591 // If a network request was made, update the LoFi state. 2592 // If a network request was made, update the Previews state.
2592 if (ShouldMakeNetworkRequestForURL(common_params.url)) 2593 if (ShouldMakeNetworkRequestForURL(common_params.url))
2593 last_navigation_lofi_state_ = common_params.lofi_state; 2594 last_navigation_previews_state_ = common_params.previews_state;
2594 2595
2595 // TODO(clamy): Release the stream handle once the renderer has finished 2596 // TODO(clamy): Release the stream handle once the renderer has finished
2596 // reading it. 2597 // reading it.
2597 stream_handle_ = std::move(body); 2598 stream_handle_ = std::move(body);
2598 2599
2599 // When navigating to a debug url, no commit is expected from the 2600 // When navigating to a debug url, no commit is expected from the
2600 // RenderFrameHost, nor should the throbber start. The NavigationRequest is 2601 // RenderFrameHost, nor should the throbber start. The NavigationRequest is
2601 // also not stored in the FrameTreeNode. Therefore do not reset it, as this 2602 // also not stored in the FrameTreeNode. Therefore do not reset it, as this
2602 // could cancel an existing pending navigation. 2603 // could cancel an existing pending navigation.
2603 if (!IsRendererDebugURL(common_params.url)) { 2604 if (!IsRendererDebugURL(common_params.url)) {
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
3328 // pending_nav_entry_id. If the previous handle was a prematurely aborted 3329 // pending_nav_entry_id. If the previous handle was a prematurely aborted
3329 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. 3330 // navigation loaded via LoadDataWithBaseURL, propagate the entry id.
3330 return NavigationHandleImpl::Create( 3331 return NavigationHandleImpl::Create(
3331 params.url, frame_tree_node_, is_renderer_initiated, 3332 params.url, frame_tree_node_, is_renderer_initiated,
3332 params.was_within_same_page, base::TimeTicks::Now(), 3333 params.was_within_same_page, base::TimeTicks::Now(),
3333 entry_id_for_data_nav, params.gesture, 3334 entry_id_for_data_nav, params.gesture,
3334 false); // started_from_context_menu 3335 false); // started_from_context_menu
3335 } 3336 }
3336 3337
3337 } // namespace content 3338 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698