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

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 2910783002: Adds Lo-Fi fallback support for new Data Reduction Proxy protocol. (Closed)
Patch Set: Added integration test the excercises page-polices fallback Created 3 years, 6 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 unified diff | Download patch
OLDNEW
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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 #include "content/renderer/media/media_stream_dispatcher.h" 124 #include "content/renderer/media/media_stream_dispatcher.h"
125 #include "content/renderer/media/user_media_client_impl.h" 125 #include "content/renderer/media/user_media_client_impl.h"
126 #include "content/renderer/mojo/blink_connector_js_wrapper.h" 126 #include "content/renderer/mojo/blink_connector_js_wrapper.h"
127 #include "content/renderer/mojo/blink_interface_registry_impl.h" 127 #include "content/renderer/mojo/blink_interface_registry_impl.h"
128 #include "content/renderer/mojo/interface_provider_js_wrapper.h" 128 #include "content/renderer/mojo/interface_provider_js_wrapper.h"
129 #include "content/renderer/mojo_bindings_controller.h" 129 #include "content/renderer/mojo_bindings_controller.h"
130 #include "content/renderer/navigation_state_impl.h" 130 #include "content/renderer/navigation_state_impl.h"
131 #include "content/renderer/pepper/pepper_audio_controller.h" 131 #include "content/renderer/pepper/pepper_audio_controller.h"
132 #include "content/renderer/pepper/plugin_instance_throttler_impl.h" 132 #include "content/renderer/pepper/plugin_instance_throttler_impl.h"
133 #include "content/renderer/presentation/presentation_dispatcher.h" 133 #include "content/renderer/presentation/presentation_dispatcher.h"
134 #include "content/renderer/previews_state_helper.h"
134 #include "content/renderer/push_messaging/push_messaging_client.h" 135 #include "content/renderer/push_messaging/push_messaging_client.h"
135 #include "content/renderer/render_frame_proxy.h" 136 #include "content/renderer/render_frame_proxy.h"
136 #include "content/renderer/render_process.h" 137 #include "content/renderer/render_process.h"
137 #include "content/renderer/render_thread_impl.h" 138 #include "content/renderer/render_thread_impl.h"
138 #include "content/renderer/render_view_impl.h" 139 #include "content/renderer/render_view_impl.h"
139 #include "content/renderer/render_widget_fullscreen_pepper.h" 140 #include "content/renderer/render_widget_fullscreen_pepper.h"
140 #include "content/renderer/renderer_blink_platform_impl.h" 141 #include "content/renderer/renderer_blink_platform_impl.h"
141 #include "content/renderer/renderer_webapplicationcachehost_impl.h" 142 #include "content/renderer/renderer_webapplicationcachehost_impl.h"
142 #include "content/renderer/renderer_webcolorchooser_impl.h" 143 #include "content/renderer/renderer_webcolorchooser_impl.h"
143 #include "content/renderer/savable_resources.h" 144 #include "content/renderer/savable_resources.h"
(...skipping 3422 matching lines...) Expand 10 before | Expand all | Expand 10 after
3566 DocumentState::FromDataSource(frame_->DataSource()); 3567 DocumentState::FromDataSource(frame_->DataSource());
3567 NavigationStateImpl* navigation_state = 3568 NavigationStateImpl* navigation_state =
3568 static_cast<NavigationStateImpl*>(document_state->navigation_state()); 3569 static_cast<NavigationStateImpl*>(document_state->navigation_state());
3569 const WebURLResponse& web_url_response = frame_->DataSource()->GetResponse(); 3570 const WebURLResponse& web_url_response = frame_->DataSource()->GetResponse();
3570 WebURLResponseExtraDataImpl* extra_data = 3571 WebURLResponseExtraDataImpl* extra_data =
3571 GetExtraDataFromResponse(web_url_response); 3572 GetExtraDataFromResponse(web_url_response);
3572 // Only update the PreviewsState and effective connection type states for new 3573 // Only update the PreviewsState and effective connection type states for new
3573 // main frame documents. Subframes inherit from the main frame and should not 3574 // main frame documents. Subframes inherit from the main frame and should not
3574 // change at commit time. 3575 // change at commit time.
3575 if (is_main_frame_ && !navigation_state->WasWithinSameDocument()) { 3576 if (is_main_frame_ && !navigation_state->WasWithinSameDocument()) {
3576 previews_state_ = 3577 previews_state_ = PREVIEWS_OFF;
3577 extra_data ? extra_data->previews_state() : PREVIEWS_OFF;
3578
3579 if (extra_data) { 3578 if (extra_data) {
3579 previews_state_ = UpdatePreviewsStateFromMainFrameResponse(
3580 extra_data->previews_state(), web_url_response);
3580 effective_connection_type_ = 3581 effective_connection_type_ =
3581 EffectiveConnectionTypeToWebEffectiveConnectionType( 3582 EffectiveConnectionTypeToWebEffectiveConnectionType(
3582 extra_data->effective_connection_type()); 3583 extra_data->effective_connection_type());
3583 } 3584 }
3584 } 3585 }
3585 3586
3586 if (proxy_routing_id_ != MSG_ROUTING_NONE) { 3587 if (proxy_routing_id_ != MSG_ROUTING_NONE) {
3587 // If this is a provisional frame associated with a proxy (i.e., a frame 3588 // If this is a provisional frame associated with a proxy (i.e., a frame
3588 // created for a remote-to-local navigation), swap it into the frame tree 3589 // created for a remote-to-local navigation), swap it into the frame tree
3589 // now. 3590 // now.
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
3985 return effective_connection_type_; 3986 return effective_connection_type_;
3986 } 3987 }
3987 3988
3988 bool RenderFrameImpl::ShouldUseClientLoFiForRequest( 3989 bool RenderFrameImpl::ShouldUseClientLoFiForRequest(
3989 const WebURLRequest& request) { 3990 const WebURLRequest& request) {
3990 if (request.GetPreviewsState() != WebURLRequest::kPreviewsUnspecified) 3991 if (request.GetPreviewsState() != WebURLRequest::kPreviewsUnspecified)
3991 return request.GetPreviewsState() & WebURLRequest::kClientLoFiOn; 3992 return request.GetPreviewsState() & WebURLRequest::kClientLoFiOn;
3992 3993
3993 if (!(previews_state_ & CLIENT_LOFI_ON)) 3994 if (!(previews_state_ & CLIENT_LOFI_ON))
3994 return false; 3995 return false;
3995 if (previews_state_ & 3996 if (previews_state_ & (PREVIEWS_OFF | PREVIEWS_NO_TRANSFORM)) {
3996 (SERVER_LITE_PAGE_ON | PREVIEWS_OFF | PREVIEWS_NO_TRANSFORM)) {
3997 return false; 3997 return false;
3998 } 3998 }
3999 3999
4000 // Even if this frame is using Server Lo-Fi, https:// images won't be handled 4000 // Even if this frame is using Server Lo-Fi, https:// images won't be handled
4001 // by Server Lo-Fi since their requests won't be sent to the Data Saver proxy, 4001 // by Server Lo-Fi since their requests won't be sent to the Data Saver proxy,
4002 // so use Client Lo-Fi instead. 4002 // so use Client Lo-Fi instead.
4003 if (previews_state_ & SERVER_LOFI_ON) 4003 if (previews_state_ & SERVER_LOFI_ON)
4004 return request.Url().ProtocolIs("https"); 4004 return request.Url().ProtocolIs("https");
4005 return true; 4005 return true;
4006 } 4006 }
(...skipping 2775 matching lines...) Expand 10 before | Expand all | Expand 10 after
6782 policy(info.default_policy), 6782 policy(info.default_policy),
6783 replaces_current_history_item(info.replaces_current_history_item), 6783 replaces_current_history_item(info.replaces_current_history_item),
6784 history_navigation_in_new_child_frame( 6784 history_navigation_in_new_child_frame(
6785 info.is_history_navigation_in_new_child_frame), 6785 info.is_history_navigation_in_new_child_frame),
6786 client_redirect(info.is_client_redirect), 6786 client_redirect(info.is_client_redirect),
6787 cache_disabled(info.is_cache_disabled), 6787 cache_disabled(info.is_cache_disabled),
6788 form(info.form), 6788 form(info.form),
6789 source_location(info.source_location) {} 6789 source_location(info.source_location) {}
6790 6790
6791 } // namespace content 6791 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698