Chromium Code Reviews| Index: content/renderer/render_frame_impl.cc |
| diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc |
| index b42860a347326f73bf1a8c8600251accf5273585..1e98587b940538f7134b27eb57eac68f62459da1 100644 |
| --- a/content/renderer/render_frame_impl.cc |
| +++ b/content/renderer/render_frame_impl.cc |
| @@ -743,6 +743,7 @@ RenderFrameImpl::RenderFrameImpl(const CreateParams& params) |
| manifest_manager_(NULL), |
| accessibility_mode_(AccessibilityModeOff), |
| renderer_accessibility_(NULL), |
| + lofi_state_(LOFI_DEFAULT), |
| weak_factory_(this) { |
| std::pair<RoutingIDFrameMap::iterator, bool> result = |
| g_routing_id_frame_map.Get().insert(std::make_pair(routing_id_, this)); |
| @@ -812,9 +813,10 @@ void RenderFrameImpl::SetWebFrame(blink::WebLocalFrame* web_frame) { |
| frame_ = web_frame; |
| } |
| -void RenderFrameImpl::Initialize() { |
| +void RenderFrameImpl::Initialize(LoFiState lofi_state) { |
| is_subframe_ = !!frame_->parent(); |
| is_local_root_ = !frame_->parent() || frame_->parent()->isWebRemoteFrame(); |
| + lofi_state_ = lofi_state; |
| #if defined(ENABLE_PLUGINS) |
| new PepperBrowserConnection(this); |
| @@ -2012,6 +2014,10 @@ void RenderFrameImpl::AddMessageToConsole(ConsoleMessageLevel level, |
| devtools_agent_->AddMessageToConsole(level, message); |
| } |
| +bool RenderFrameImpl::IsLoFiOn() { |
| + return lofi_state_ == LOFI_ON; |
| +} |
| + |
| // blink::WebFrameClient implementation ---------------------------------------- |
| blink::WebPlugin* RenderFrameImpl::createPlugin( |
| @@ -2231,7 +2237,7 @@ blink::WebFrame* RenderFrameImpl::createChildFrame( |
| // Add the frame to the frame tree and initialize it. |
| parent->appendChild(web_frame); |
| - child_render_frame->Initialize(); |
| + child_render_frame->Initialize(lofi_state_); |
| return web_frame; |
| } |
| @@ -2703,6 +2709,9 @@ void RenderFrameImpl::didCommitProvisionalLoad( |
| DocumentState::FromDataSource(frame->dataSource()); |
| NavigationStateImpl* navigation_state = |
| static_cast<NavigationStateImpl*>(document_state->navigation_state()); |
| + WebURLResponseExtraDataImpl* extra_data = GetExtraDataFromResponse( |
| + frame->dataSource()->response()); |
| + lofi_state_ = extra_data && extra_data->is_lofi() ? LOFI_ON : LOFI_OFF; |
| if (proxy_routing_id_ != MSG_ROUTING_NONE) { |
| RenderFrameProxy* proxy = |
| @@ -3357,6 +3366,12 @@ void RenderFrameImpl::willSendRequest( |
| navigation_state->start_params().transferred_request_request_id); |
| extra_data->set_service_worker_provider_id(provider_id); |
| extra_data->set_stream_override(stream_override.Pass()); |
| + // TODO(megjablon): Set the navigation params for single image loads to |
| + // LOFI_OFF and remove the dependency on ReloadBypassingCache. |
| + if (request.cachePolicy() == WebURLRequest::ReloadBypassingCache) |
| + extra_data->set_lofi_state(LOFI_OFF); |
| + else |
| + extra_data->set_lofi_state(lofi_state_); |
| request.setExtraData(extra_data); |
| // TODO(creis): Update prefetching to work with out-of-process iframes. |
| @@ -4483,6 +4498,8 @@ void RenderFrameImpl::NavigateInternal( |
| GetContentClient()->SetActiveURL(common_params.url); |
| + lofi_state_ = request_params.lofi_state; |
|
davidben
2015/09/21 17:58:15
This still hasn't been resolved. lofi_state_ must
davidben
2015/09/21 18:09:01
To clarify, this isn't a "layering; we'll fix this
megjablon
2015/09/22 20:35:52
For renderer initiated navigations, we don't need
davidben
2015/09/22 22:20:50
I think we were talking about different things. Th
megjablon
2015/09/23 01:39:04
This sounds good. I'm working on implementing this
megjablon
2015/09/23 23:15:24
I took a stab at this. PTAL!
|
| + |
| // If this frame isn't in the same process as the main frame, it may naively |
| // assume that this is the first navigation in the iframe, but this may not |
| // actually be the case. Inform the frame's state machine if this frame has |