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

Unified Diff: content/renderer/render_frame_impl.cc

Issue 2484633004: Change Lo-Fi bool to bitmask to support multiple Previews types (Closed)
Patch Set: add back previews_unspecified 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/render_frame_impl.cc
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index f68bb2e5666f71404361907fd889992464b5d5cf..327c68fa3b2dc594b0c8687058b0c933acf18dbf 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -79,6 +79,7 @@
#include "content/public/common/form_field_data.h"
#include "content/public/common/isolated_world_ids.h"
#include "content/public/common/page_state.h"
+#include "content/public/common/previews_state.h"
#include "content/public/common/resource_response.h"
#include "content/public/common/service_manager_connection.h"
#include "content/public/common/url_constants.h"
@@ -567,8 +568,7 @@ WebURLRequest CreateURLRequestForNavigation(
}
}
- request.setLoFiState(
- static_cast<WebURLRequest::LoFiState>(common_params.lofi_state));
+ request.setPreviewsState(common_params.previews_state);
RequestExtraData* extra_data = new RequestExtraData();
extra_data->set_stream_override(std::move(stream_override));
@@ -650,7 +650,7 @@ CommonNavigationParams MakeCommonNavigationParams(
info.urlRequest.url(), referrer, extra_data->transition_type(),
navigation_type, gesture, true, info.replacesCurrentHistoryItem,
ui_timestamp, report_type, GURL(), GURL(),
- static_cast<LoFiState>(info.urlRequest.getLoFiState()),
+ info.urlRequest.getPreviewsState(),
base::TimeTicks::Now(), info.urlRequest.httpMethod().latin1(),
GetRequestBodyForWebURLRequest(info.urlRequest));
}
@@ -1098,7 +1098,7 @@ RenderFrameImpl::RenderFrameImpl(const CreateParams& params)
accessibility_mode_(AccessibilityModeOff),
render_accessibility_(NULL),
media_player_delegate_(NULL),
- is_using_lofi_(false),
+ previews_state_(PREVIEWS_UNSPECIFIED),
effective_connection_type_(
blink::WebEffectiveConnectionType::TypeUnknown),
is_pasting_(false),
@@ -1214,7 +1214,7 @@ void RenderFrameImpl::Initialize() {
RenderFrameImpl* parent_frame = RenderFrameImpl::FromWebFrame(
frame_->parent());
if (parent_frame) {
- is_using_lofi_ = parent_frame->IsUsingLoFi();
+ previews_state_ = parent_frame->GetPreviewsState();
effective_connection_type_ = parent_frame->getEffectiveConnectionType();
}
@@ -2250,7 +2250,7 @@ void RenderFrameImpl::OnReload(bool bypass_cache) {
}
void RenderFrameImpl::OnReloadLoFiImages() {
- is_using_lofi_ = false;
+ previews_state_ = PREVIEWS_OFF;
GetWebFrame()->reloadLoFiImages();
}
@@ -2641,8 +2641,8 @@ void RenderFrameImpl::AddMessageToConsole(ConsoleMessageLevel level,
frame_->addMessageToConsole(wcm);
}
-bool RenderFrameImpl::IsUsingLoFi() const {
- return is_using_lofi_;
+int RenderFrameImpl::GetPreviewsState() const {
+ return previews_state_;
}
bool RenderFrameImpl::IsPasting() const {
@@ -3520,11 +3520,12 @@ void RenderFrameImpl::didCommitProvisionalLoad(
static_cast<NavigationStateImpl*>(document_state->navigation_state());
WebURLResponseExtraDataImpl* extra_data =
GetExtraDataFromResponse(frame->dataSource()->response());
- // Only update the Lo-Fi and effective connection type states for new main
- // frame documents. Subframes inherit from the main frame and should not
+ // Only update the PreviewsState and effective connection type states for new
+ // main frame documents. Subframes inherit from the main frame and should not
// change at commit time.
if (is_main_frame_ && !navigation_state->WasWithinSamePage()) {
- is_using_lofi_ = extra_data && extra_data->is_using_lofi();
+ previews_state_ =
+ extra_data ? extra_data->previews_state() : PREVIEWS_OFF;
if (extra_data) {
effective_connection_type_ =
EffectiveConnectionTypeToWebEffectiveConnectionType(
@@ -4265,13 +4266,13 @@ void RenderFrameImpl::willSendRequest(blink::WebLocalFrame* frame,
request.setExtraData(extra_data);
- if (request.getLoFiState() == WebURLRequest::LoFiUnspecified) {
+ if (request.getPreviewsState() == WebURLRequest::PreviewsUnspecified) {
if (is_main_frame_ && !navigation_state->request_committed()) {
- request.setLoFiState(static_cast<WebURLRequest::LoFiState>(
- navigation_state->common_params().lofi_state));
+ request.setPreviewsState(
+ navigation_state->common_params().previews_state);
} else {
- request.setLoFiState(
- is_using_lofi_ ? WebURLRequest::LoFiOn : WebURLRequest::LoFiOff);
+ request.setPreviewsState(previews_state_ == 0 ? WebURLRequest::PreviewsOff
+ : previews_state_);
}
}

Powered by Google App Engine
This is Rietveld 408576698