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 2291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2302 source_frame, frame_->GetDocument(), std::move(channels)); | 2302 source_frame, frame_->GetDocument(), std::move(channels)); |
2303 frame_->DispatchMessageEventWithOriginCheck(target_origin, msg_event); | 2303 frame_->DispatchMessageEventWithOriginCheck(target_origin, msg_event); |
2304 } | 2304 } |
2305 | 2305 |
2306 void RenderFrameImpl::OnReload(bool bypass_cache) { | 2306 void RenderFrameImpl::OnReload(bool bypass_cache) { |
2307 frame_->Reload(bypass_cache ? WebFrameLoadType::kReloadBypassingCache | 2307 frame_->Reload(bypass_cache ? WebFrameLoadType::kReloadBypassingCache |
2308 : WebFrameLoadType::kReload); | 2308 : WebFrameLoadType::kReload); |
2309 } | 2309 } |
2310 | 2310 |
2311 void RenderFrameImpl::OnReloadLoFiImages() { | 2311 void RenderFrameImpl::OnReloadLoFiImages() { |
2312 previews_state_ = PREVIEWS_NO_TRANSFORM; | 2312 previews_state_ = PREVIEWS_OFF; |
2313 GetWebFrame()->ReloadLoFiImages(); | 2313 GetWebFrame()->ReloadLoFiImages(); |
2314 } | 2314 } |
2315 | 2315 |
2316 void RenderFrameImpl::OnTextSurroundingSelectionRequest(uint32_t max_length) { | 2316 void RenderFrameImpl::OnTextSurroundingSelectionRequest(uint32_t max_length) { |
2317 blink::WebSurroundingText surroundingText; | 2317 blink::WebSurroundingText surroundingText; |
2318 surroundingText.InitializeFromCurrentSelection(frame_, max_length); | 2318 surroundingText.InitializeFromCurrentSelection(frame_, max_length); |
2319 | 2319 |
2320 if (surroundingText.IsNull()) { | 2320 if (surroundingText.IsNull()) { |
2321 // |surroundingText| might not be correctly initialized, for example if | 2321 // |surroundingText| might not be correctly initialized, for example if |
2322 // |frame_->selectionRange().isNull()|, in other words, if there was no | 2322 // |frame_->selectionRange().isNull()|, in other words, if there was no |
(...skipping 1355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3678 const WebURLResponse& web_url_response = frame_->DataSource()->GetResponse(); | 3678 const WebURLResponse& web_url_response = frame_->DataSource()->GetResponse(); |
3679 WebURLResponseExtraDataImpl* extra_data = | 3679 WebURLResponseExtraDataImpl* extra_data = |
3680 GetExtraDataFromResponse(web_url_response); | 3680 GetExtraDataFromResponse(web_url_response); |
3681 // Only update the PreviewsState and effective connection type states for new | 3681 // Only update the PreviewsState and effective connection type states for new |
3682 // main frame documents. Subframes inherit from the main frame and should not | 3682 // main frame documents. Subframes inherit from the main frame and should not |
3683 // change at commit time. | 3683 // change at commit time. |
3684 if (is_main_frame_ && !navigation_state->WasWithinSameDocument()) { | 3684 if (is_main_frame_ && !navigation_state->WasWithinSameDocument()) { |
3685 previews_state_ = | 3685 previews_state_ = |
3686 extra_data ? extra_data->previews_state() : PREVIEWS_OFF; | 3686 extra_data ? extra_data->previews_state() : PREVIEWS_OFF; |
3687 | 3687 |
3688 // Set lite pages off if a lite page was not loaded for the main frame. | 3688 // Update previews state for subresources. |
3689 if (web_url_response | 3689 // TODO(dougarnett): Add support for alt-transforms directive to |
3690 .HttpHeaderField( | 3690 // clear LoFi bit if not directed by server to use LoFi. |
3691 WebString::FromUTF8(kChromeProxyContentTransformHeader)) | 3691 std::string cpct(web_url_response |
3692 .Utf8() != kChromeProxyLitePageDirective) { | 3692 .HttpHeaderField(WebString::FromUTF8( |
| 3693 kChromeProxyContentTransformHeader)) |
| 3694 .Utf8()); |
| 3695 if (cpct == kChromeProxyLitePageDirective) { |
| 3696 // Received lite page so be sure LoFi is turned off for subresources. |
| 3697 previews_state_ &= ~(SERVER_LOFI_ON); |
| 3698 } else { |
| 3699 // Lite page not received so clear its bit for subresources, if set. |
3693 previews_state_ &= ~(SERVER_LITE_PAGE_ON); | 3700 previews_state_ &= ~(SERVER_LITE_PAGE_ON); |
3694 } | 3701 } |
3695 | 3702 |
3696 if (extra_data) { | 3703 if (extra_data) { |
3697 effective_connection_type_ = | 3704 effective_connection_type_ = |
3698 EffectiveConnectionTypeToWebEffectiveConnectionType( | 3705 EffectiveConnectionTypeToWebEffectiveConnectionType( |
3699 extra_data->effective_connection_type()); | 3706 extra_data->effective_connection_type()); |
3700 } | 3707 } |
3701 } | 3708 } |
3702 | 3709 |
(...skipping 3295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6998 policy(info.default_policy), | 7005 policy(info.default_policy), |
6999 replaces_current_history_item(info.replaces_current_history_item), | 7006 replaces_current_history_item(info.replaces_current_history_item), |
7000 history_navigation_in_new_child_frame( | 7007 history_navigation_in_new_child_frame( |
7001 info.is_history_navigation_in_new_child_frame), | 7008 info.is_history_navigation_in_new_child_frame), |
7002 client_redirect(info.is_client_redirect), | 7009 client_redirect(info.is_client_redirect), |
7003 cache_disabled(info.is_cache_disabled), | 7010 cache_disabled(info.is_cache_disabled), |
7004 form(info.form), | 7011 form(info.form), |
7005 source_location(info.source_location) {} | 7012 source_location(info.source_location) {} |
7006 | 7013 |
7007 } // namespace content | 7014 } // namespace content |
OLD | NEW |