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

Unified Diff: content/renderer/render_frame_impl.cc

Issue 2484633004: Change Lo-Fi bool to bitmask to support multiple Previews types (Closed)
Patch Set: fix ContentResourceProviderTest Created 3 years, 11 months 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
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/renderer/render_frame_impl_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_frame_impl.cc
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 619f50976cd8c710f045151140c15787d1dc953d..2f7c49410a43d4f46546b52b92bd27ba4f84f365 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -570,8 +570,8 @@ WebURLRequest CreateURLRequestForNavigation(
}
}
- request.setLoFiState(
- static_cast<WebURLRequest::LoFiState>(common_params.lofi_state));
+ request.setPreviewsState(
+ static_cast<WebURLRequest::PreviewsState>(common_params.previews_state));
RequestExtraData* extra_data = new RequestExtraData();
extra_data->set_stream_override(std::move(stream_override));
@@ -639,7 +639,7 @@ CommonNavigationParams MakeCommonNavigationParams(
info.urlRequest.url(), referrer, extra_data->transition_type(),
navigation_type, true, info.replacesCurrentHistoryItem, ui_timestamp,
report_type, GURL(), GURL(),
- static_cast<LoFiState>(info.urlRequest.getLoFiState()),
+ static_cast<PreviewsState>(info.urlRequest.getPreviewsState()),
base::TimeTicks::Now(), info.urlRequest.httpMethod().latin1(),
GetRequestBodyForWebURLRequest(info.urlRequest));
}
@@ -1102,7 +1102,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),
@@ -1218,7 +1218,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();
}
@@ -2252,7 +2252,7 @@ void RenderFrameImpl::OnReload(bool bypass_cache) {
}
void RenderFrameImpl::OnReloadLoFiImages() {
- is_using_lofi_ = false;
+ previews_state_ = PREVIEWS_OFF;
GetWebFrame()->reloadLoFiImages();
}
@@ -2658,8 +2658,8 @@ void RenderFrameImpl::AddMessageToConsole(ConsoleMessageLevel level,
frame_->addMessageToConsole(wcm);
}
-bool RenderFrameImpl::IsUsingLoFi() const {
- return is_using_lofi_;
+PreviewsState RenderFrameImpl::GetPreviewsState() const {
+ return previews_state_;
}
bool RenderFrameImpl::IsPasting() const {
@@ -3577,11 +3577,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(
@@ -4321,13 +4322,15 @@ 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(static_cast<WebURLRequest::PreviewsState>(
+ navigation_state->common_params().previews_state));
} else {
- request.setLoFiState(
- is_using_lofi_ ? WebURLRequest::LoFiOn : WebURLRequest::LoFiOff);
+ request.setPreviewsState(
+ previews_state_ == PREVIEWS_UNSPECIFIED
+ ? WebURLRequest::PreviewsOff
+ : static_cast<WebURLRequest::PreviewsState>(previews_state_));
}
}
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/renderer/render_frame_impl_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698