Index: content/renderer/render_frame_impl.cc |
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc |
index 5007f28f5c19f40d05bae2cdb26a00a3940ca5de..dfc9788e5c9a5d49df6d750bf9523eeb77a75dd7 100644 |
--- a/content/renderer/render_frame_impl.cc |
+++ b/content/renderer/render_frame_impl.cc |
@@ -569,8 +569,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)); |
@@ -652,7 +652,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()), |
+ static_cast<PreviewsState>(info.urlRequest.getPreviewsState()), |
base::TimeTicks::Now(), info.urlRequest.httpMethod().latin1(), |
GetRequestBodyForWebURLRequest(info.urlRequest)); |
} |
@@ -1115,7 +1115,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), |
@@ -1231,7 +1231,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(); |
} |
@@ -2251,7 +2251,7 @@ void RenderFrameImpl::OnReload(bool bypass_cache) { |
} |
void RenderFrameImpl::OnReloadLoFiImages() { |
- is_using_lofi_ = false; |
+ previews_state_ = PREVIEWS_OFF; |
GetWebFrame()->reloadLoFiImages(); |
} |
@@ -2642,8 +2642,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 { |
@@ -3531,11 +3531,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( |
@@ -4271,13 +4272,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_)); |
} |
} |
@@ -5511,6 +5514,19 @@ STATIC_ASSERT_ENUM(STOP_FIND_ACTION_KEEP_SELECTION, |
STATIC_ASSERT_ENUM(STOP_FIND_ACTION_ACTIVATE_SELECTION, |
WebLocalFrame::StopFindActionActivateSelection); |
+// Ensure that content::PreviewsState and blink::WebURLRequest::PreviewsState |
+// are kept in sync. |
nasko
2016/12/14 00:16:42
This doesn't seem to fit right here, as it splits
megjablon
2016/12/14 01:10:32
moved to previews_state.h
|
+STATIC_ASSERT_ENUM(PREVIEWS_UNSPECIFIED, |
+ WebURLRequest::PreviewsUnspecified); |
+STATIC_ASSERT_ENUM(SERVER_LOFI_ON, |
+ WebURLRequest::ServerLoFiOn); |
+STATIC_ASSERT_ENUM(CLIENT_LOFI_ON, |
+ WebURLRequest::ClientLoFiOn); |
+STATIC_ASSERT_ENUM(PREVIEWS_OFF, |
+ WebURLRequest::PreviewsOff); |
+STATIC_ASSERT_ENUM(PREVIEWS_STATE_LAST, |
+ WebURLRequest::PreviewsStateLast); |
+ |
void RenderFrameImpl::OnStopFinding(StopFindAction action) { |
blink::WebPlugin* plugin = GetWebPluginForFind(); |
if (plugin) { |