Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/renderer/render_frame_impl.h" | 5 #include "content/renderer/render_frame_impl.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 2308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2319 source_frame, frame_->GetDocument(), std::move(channels)); | 2319 source_frame, frame_->GetDocument(), std::move(channels)); |
| 2320 frame_->DispatchMessageEventWithOriginCheck(target_origin, msg_event); | 2320 frame_->DispatchMessageEventWithOriginCheck(target_origin, msg_event); |
| 2321 } | 2321 } |
| 2322 | 2322 |
| 2323 void RenderFrameImpl::OnReload(bool bypass_cache) { | 2323 void RenderFrameImpl::OnReload(bool bypass_cache) { |
| 2324 frame_->Reload(bypass_cache ? WebFrameLoadType::kReloadBypassingCache | 2324 frame_->Reload(bypass_cache ? WebFrameLoadType::kReloadBypassingCache |
| 2325 : WebFrameLoadType::kReload); | 2325 : WebFrameLoadType::kReload); |
| 2326 } | 2326 } |
| 2327 | 2327 |
| 2328 void RenderFrameImpl::OnReloadLoFiImages() { | 2328 void RenderFrameImpl::OnReloadLoFiImages() { |
| 2329 previews_state_ = PREVIEWS_NO_TRANSFORM; | 2329 previews_state_ = PREVIEWS_OFF; |
| 2330 GetWebFrame()->ReloadLoFiImages(); | 2330 GetWebFrame()->ReloadLoFiImages(); |
| 2331 } | 2331 } |
| 2332 | 2332 |
| 2333 void RenderFrameImpl::OnTextSurroundingSelectionRequest(uint32_t max_length) { | 2333 void RenderFrameImpl::OnTextSurroundingSelectionRequest(uint32_t max_length) { |
| 2334 blink::WebSurroundingText surroundingText; | 2334 blink::WebSurroundingText surroundingText; |
| 2335 surroundingText.InitializeFromCurrentSelection(frame_, max_length); | 2335 surroundingText.InitializeFromCurrentSelection(frame_, max_length); |
| 2336 | 2336 |
| 2337 if (surroundingText.IsNull()) { | 2337 if (surroundingText.IsNull()) { |
| 2338 // |surroundingText| might not be correctly initialized, for example if | 2338 // |surroundingText| might not be correctly initialized, for example if |
| 2339 // |frame_->selectionRange().isNull()|, in other words, if there was no | 2339 // |frame_->selectionRange().isNull()|, in other words, if there was no |
| (...skipping 1393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3733 const WebURLResponse& web_url_response = frame_->DataSource()->GetResponse(); | 3733 const WebURLResponse& web_url_response = frame_->DataSource()->GetResponse(); |
| 3734 WebURLResponseExtraDataImpl* extra_data = | 3734 WebURLResponseExtraDataImpl* extra_data = |
| 3735 GetExtraDataFromResponse(web_url_response); | 3735 GetExtraDataFromResponse(web_url_response); |
| 3736 // Only update the PreviewsState and effective connection type states for new | 3736 // Only update the PreviewsState and effective connection type states for new |
| 3737 // main frame documents. Subframes inherit from the main frame and should not | 3737 // main frame documents. Subframes inherit from the main frame and should not |
| 3738 // change at commit time. | 3738 // change at commit time. |
| 3739 if (is_main_frame_ && !navigation_state->WasWithinSameDocument()) { | 3739 if (is_main_frame_ && !navigation_state->WasWithinSameDocument()) { |
| 3740 previews_state_ = | 3740 previews_state_ = |
| 3741 extra_data ? extra_data->previews_state() : PREVIEWS_OFF; | 3741 extra_data ? extra_data->previews_state() : PREVIEWS_OFF; |
| 3742 | 3742 |
| 3743 // Set lite pages off if a lite page was not loaded for the main frame. | 3743 // Update previews state for subresources. |
| 3744 if (web_url_response | 3744 // TODO(dougarnett): Add support for alt-transforms directive to |
| 3745 .HttpHeaderField( | 3745 // clear LoFi bit if not directed by server to use LoFi. |
|
bengr
2017/05/01 16:53:14
What is "LoFi bit"?
Also, rename cpct as chrome
| |
| 3746 WebString::FromUTF8(kChromeProxyContentTransformHeader)) | 3746 std::string cpct(web_url_response |
| 3747 .Utf8() != kChromeProxyLitePageDirective) { | 3747 .HttpHeaderField(WebString::FromUTF8( |
| 3748 kChromeProxyContentTransformHeader)) | |
| 3749 .Utf8()); | |
| 3750 if (cpct == kChromeProxyLitePageDirective) { | |
|
bengr
2017/05/01 16:53:14
Why do we have Chrome-specific code in content? Ad
| |
| 3751 // Received lite page so be sure LoFi is turned off for subresources. | |
| 3752 previews_state_ &= ~(SERVER_LOFI_ON); | |
| 3753 } else { | |
| 3754 // Lite page not received so clear its bit for subresources, if set. | |
| 3748 previews_state_ &= ~(SERVER_LITE_PAGE_ON); | 3755 previews_state_ &= ~(SERVER_LITE_PAGE_ON); |
| 3749 } | 3756 } |
| 3750 | 3757 |
| 3751 if (extra_data) { | 3758 if (extra_data) { |
| 3752 effective_connection_type_ = | 3759 effective_connection_type_ = |
| 3753 EffectiveConnectionTypeToWebEffectiveConnectionType( | 3760 EffectiveConnectionTypeToWebEffectiveConnectionType( |
| 3754 extra_data->effective_connection_type()); | 3761 extra_data->effective_connection_type()); |
| 3755 } | 3762 } |
| 3756 } | 3763 } |
| 3757 | 3764 |
| (...skipping 3281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7039 policy(info.default_policy), | 7046 policy(info.default_policy), |
| 7040 replaces_current_history_item(info.replaces_current_history_item), | 7047 replaces_current_history_item(info.replaces_current_history_item), |
| 7041 history_navigation_in_new_child_frame( | 7048 history_navigation_in_new_child_frame( |
| 7042 info.is_history_navigation_in_new_child_frame), | 7049 info.is_history_navigation_in_new_child_frame), |
| 7043 client_redirect(info.is_client_redirect), | 7050 client_redirect(info.is_client_redirect), |
| 7044 cache_disabled(info.is_cache_disabled), | 7051 cache_disabled(info.is_cache_disabled), |
| 7045 form(info.form), | 7052 form(info.form), |
| 7046 source_location(info.source_location) {} | 7053 source_location(info.source_location) {} |
| 7047 | 7054 |
| 7048 } // namespace content | 7055 } // namespace content |
| OLD | NEW |