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

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: Renamed helper method from Update* to Get* 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 #include "content/renderer/media/media_stream_dispatcher.h" 125 #include "content/renderer/media/media_stream_dispatcher.h"
126 #include "content/renderer/media/user_media_client_impl.h" 126 #include "content/renderer/media/user_media_client_impl.h"
127 #include "content/renderer/mojo/blink_connector_js_wrapper.h" 127 #include "content/renderer/mojo/blink_connector_js_wrapper.h"
128 #include "content/renderer/mojo/blink_interface_registry_impl.h" 128 #include "content/renderer/mojo/blink_interface_registry_impl.h"
129 #include "content/renderer/mojo/interface_provider_js_wrapper.h" 129 #include "content/renderer/mojo/interface_provider_js_wrapper.h"
130 #include "content/renderer/mojo_bindings_controller.h" 130 #include "content/renderer/mojo_bindings_controller.h"
131 #include "content/renderer/navigation_state_impl.h" 131 #include "content/renderer/navigation_state_impl.h"
132 #include "content/renderer/pepper/pepper_audio_controller.h" 132 #include "content/renderer/pepper/pepper_audio_controller.h"
133 #include "content/renderer/pepper/plugin_instance_throttler_impl.h" 133 #include "content/renderer/pepper/plugin_instance_throttler_impl.h"
134 #include "content/renderer/presentation/presentation_dispatcher.h" 134 #include "content/renderer/presentation/presentation_dispatcher.h"
135 #include "content/renderer/previews_state_helper.h"
135 #include "content/renderer/push_messaging/push_messaging_client.h" 136 #include "content/renderer/push_messaging/push_messaging_client.h"
136 #include "content/renderer/render_frame_proxy.h" 137 #include "content/renderer/render_frame_proxy.h"
137 #include "content/renderer/render_process.h" 138 #include "content/renderer/render_process.h"
138 #include "content/renderer/render_thread_impl.h" 139 #include "content/renderer/render_thread_impl.h"
139 #include "content/renderer/render_view_impl.h" 140 #include "content/renderer/render_view_impl.h"
140 #include "content/renderer/render_widget_fullscreen_pepper.h" 141 #include "content/renderer/render_widget_fullscreen_pepper.h"
141 #include "content/renderer/renderer_blink_platform_impl.h" 142 #include "content/renderer/renderer_blink_platform_impl.h"
142 #include "content/renderer/renderer_webapplicationcachehost_impl.h" 143 #include "content/renderer/renderer_webapplicationcachehost_impl.h"
143 #include "content/renderer/renderer_webcolorchooser_impl.h" 144 #include "content/renderer/renderer_webcolorchooser_impl.h"
144 #include "content/renderer/savable_resources.h" 145 #include "content/renderer/savable_resources.h"
(...skipping 3455 matching lines...) Expand 10 before | Expand all | Expand 10 after
3600 DocumentState::FromDataSource(frame_->DataSource()); 3601 DocumentState::FromDataSource(frame_->DataSource());
3601 NavigationStateImpl* navigation_state = 3602 NavigationStateImpl* navigation_state =
3602 static_cast<NavigationStateImpl*>(document_state->navigation_state()); 3603 static_cast<NavigationStateImpl*>(document_state->navigation_state());
3603 const WebURLResponse& web_url_response = frame_->DataSource()->GetResponse(); 3604 const WebURLResponse& web_url_response = frame_->DataSource()->GetResponse();
3604 WebURLResponseExtraDataImpl* extra_data = 3605 WebURLResponseExtraDataImpl* extra_data =
3605 GetExtraDataFromResponse(web_url_response); 3606 GetExtraDataFromResponse(web_url_response);
3606 // Only update the PreviewsState and effective connection type states for new 3607 // Only update the PreviewsState and effective connection type states for new
3607 // main frame documents. Subframes inherit from the main frame and should not 3608 // main frame documents. Subframes inherit from the main frame and should not
3608 // change at commit time. 3609 // change at commit time.
3609 if (is_main_frame_ && !navigation_state->WasWithinSameDocument()) { 3610 if (is_main_frame_ && !navigation_state->WasWithinSameDocument()) {
3610 previews_state_ = 3611 previews_state_ = PREVIEWS_OFF;
3611 extra_data ? extra_data->previews_state() : PREVIEWS_OFF;
3612
3613 if (extra_data) { 3612 if (extra_data) {
3613 previews_state_ = GetPreviewsStateFromMainFrameResponse(
3614 extra_data->previews_state(), web_url_response);
3614 effective_connection_type_ = 3615 effective_connection_type_ =
3615 EffectiveConnectionTypeToWebEffectiveConnectionType( 3616 EffectiveConnectionTypeToWebEffectiveConnectionType(
3616 extra_data->effective_connection_type()); 3617 extra_data->effective_connection_type());
3617 } 3618 }
3618 } 3619 }
3619 3620
3620 if (proxy_routing_id_ != MSG_ROUTING_NONE) { 3621 if (proxy_routing_id_ != MSG_ROUTING_NONE) {
3621 // If this is a provisional frame associated with a proxy (i.e., a frame 3622 // If this is a provisional frame associated with a proxy (i.e., a frame
3622 // created for a remote-to-local navigation), swap it into the frame tree 3623 // created for a remote-to-local navigation), swap it into the frame tree
3623 // now. 3624 // now.
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
4039 return effective_connection_type_; 4040 return effective_connection_type_;
4040 } 4041 }
4041 4042
4042 bool RenderFrameImpl::ShouldUseClientLoFiForRequest( 4043 bool RenderFrameImpl::ShouldUseClientLoFiForRequest(
4043 const WebURLRequest& request) { 4044 const WebURLRequest& request) {
4044 if (request.GetPreviewsState() != WebURLRequest::kPreviewsUnspecified) 4045 if (request.GetPreviewsState() != WebURLRequest::kPreviewsUnspecified)
4045 return request.GetPreviewsState() & WebURLRequest::kClientLoFiOn; 4046 return request.GetPreviewsState() & WebURLRequest::kClientLoFiOn;
4046 4047
4047 if (!(previews_state_ & CLIENT_LOFI_ON)) 4048 if (!(previews_state_ & CLIENT_LOFI_ON))
4048 return false; 4049 return false;
4049 if (previews_state_ & 4050 if (previews_state_ & (PREVIEWS_OFF | PREVIEWS_NO_TRANSFORM)) {
4050 (SERVER_LITE_PAGE_ON | PREVIEWS_OFF | PREVIEWS_NO_TRANSFORM)) {
4051 return false; 4051 return false;
4052 } 4052 }
4053 4053
4054 // Even if this frame is using Server Lo-Fi, https:// images won't be handled 4054 // Even if this frame is using Server Lo-Fi, https:// images won't be handled
4055 // by Server Lo-Fi since their requests won't be sent to the Data Saver proxy, 4055 // by Server Lo-Fi since their requests won't be sent to the Data Saver proxy,
4056 // so use Client Lo-Fi instead. 4056 // so use Client Lo-Fi instead.
4057 if (previews_state_ & SERVER_LOFI_ON) 4057 if (previews_state_ & SERVER_LOFI_ON)
4058 return request.Url().ProtocolIs("https"); 4058 return request.Url().ProtocolIs("https");
4059 return true; 4059 return true;
4060 } 4060 }
(...skipping 2781 matching lines...) Expand 10 before | Expand all | Expand 10 after
6842 policy(info.default_policy), 6842 policy(info.default_policy),
6843 replaces_current_history_item(info.replaces_current_history_item), 6843 replaces_current_history_item(info.replaces_current_history_item),
6844 history_navigation_in_new_child_frame( 6844 history_navigation_in_new_child_frame(
6845 info.is_history_navigation_in_new_child_frame), 6845 info.is_history_navigation_in_new_child_frame),
6846 client_redirect(info.is_client_redirect), 6846 client_redirect(info.is_client_redirect),
6847 cache_disabled(info.is_cache_disabled), 6847 cache_disabled(info.is_cache_disabled),
6848 form(info.form), 6848 form(info.form),
6849 source_location(info.source_location) {} 6849 source_location(info.source_location) {}
6850 6850
6851 } // namespace content 6851 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/previews_state_helper_unittest.cc ('k') | content/renderer/render_frame_impl_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698