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

Side by Side Diff: chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc

Issue 2864333003: Use the Previews Black List for server previews (Closed)
Patch Set: megjablon nits Created 3 years, 7 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
« no previous file with comments | « no previous file | chrome/browser/previews/previews_infobar_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/loader/chrome_resource_dispatcher_host_delegate.h" 5 #include "chrome/browser/loader/chrome_resource_dispatcher_host_delegate.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 884
885 content::PreviewsState ChromeResourceDispatcherHostDelegate::GetPreviewsState( 885 content::PreviewsState ChromeResourceDispatcherHostDelegate::GetPreviewsState(
886 const net::URLRequest& url_request, 886 const net::URLRequest& url_request,
887 content::ResourceContext* resource_context) { 887 content::ResourceContext* resource_context) {
888 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); 888 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context);
889 data_reduction_proxy::DataReductionProxyIOData* data_reduction_proxy_io_data = 889 data_reduction_proxy::DataReductionProxyIOData* data_reduction_proxy_io_data =
890 io_data->data_reduction_proxy_io_data(); 890 io_data->data_reduction_proxy_io_data();
891 891
892 content::PreviewsState previews_state = content::PREVIEWS_UNSPECIFIED; 892 content::PreviewsState previews_state = content::PREVIEWS_UNSPECIFIED;
893 893
894 if (data_reduction_proxy_io_data) { 894 previews::PreviewsIOData* previews_io_data = io_data->previews_io_data();
895 if (data_reduction_proxy_io_data->ShouldEnableLoFi(url_request)) 895 if (data_reduction_proxy_io_data && previews_io_data) {
896 if (data_reduction_proxy_io_data->ShouldEnableLoFi(url_request,
897 previews_io_data))
896 previews_state |= content::SERVER_LOFI_ON; 898 previews_state |= content::SERVER_LOFI_ON;
mmenke 2017/05/10 22:32:47 nit: Add braces
RyanSturm 2017/05/10 22:35:43 Done.
897 if (data_reduction_proxy_io_data->ShouldEnableLitePages(url_request)) 899 if (data_reduction_proxy_io_data->ShouldEnableLitePages(url_request,
900 previews_io_data))
898 previews_state |= content::SERVER_LITE_PAGE_ON; 901 previews_state |= content::SERVER_LITE_PAGE_ON;
mmenke 2017/05/10 22:32:47 +braces
RyanSturm 2017/05/10 22:35:43 Done.
899 902
900 previews::PreviewsIOData* previews_io_data = io_data->previews_io_data();
901 // Check that data saver is enabled, the user isn't opted out of LoFi for 903 // Check that data saver is enabled, the user isn't opted out of LoFi for
902 // the session, and the user is eligible for previews. 904 // the session, and the user is eligible for previews.
903 if (data_reduction_proxy_io_data->IsEnabled() && 905 if (data_reduction_proxy_io_data->IsEnabled() &&
904 !data_reduction_proxy_io_data->config()->lofi_off() && 906 !data_reduction_proxy_io_data->config()->lofi_off() &&
905 previews_io_data && previews::params::IsClientLoFiEnabled() && 907 previews::params::IsClientLoFiEnabled() &&
906 previews_io_data->ShouldAllowPreviewAtECT( 908 previews_io_data->ShouldAllowPreviewAtECT(
907 url_request, previews::PreviewsType::LOFI, 909 url_request, previews::PreviewsType::LOFI,
908 previews::params:: 910 previews::params::
909 EffectiveConnectionTypeThresholdForClientLoFi())) { 911 EffectiveConnectionTypeThresholdForClientLoFi())) {
910 previews_state |= content::CLIENT_LOFI_ON; 912 previews_state |= content::CLIENT_LOFI_ON;
911 } 913 }
912 } 914 }
913 915
914 if (previews_state == content::PREVIEWS_UNSPECIFIED) 916 if (previews_state == content::PREVIEWS_UNSPECIFIED)
915 return content::PREVIEWS_OFF; 917 return content::PREVIEWS_OFF;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 &ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad, 963 &ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad,
962 base::Unretained(this), url, request_loading_time)); 964 base::Unretained(this), url, request_loading_time));
963 return; 965 return;
964 } 966 }
965 967
966 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ? 968 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ?
967 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow"); 969 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow");
968 rappor::SampleDomainAndRegistryFromGURL( 970 rappor::SampleDomainAndRegistryFromGURL(
969 g_browser_process->rappor_service(), metric_name, url); 971 g_browser_process->rappor_service(), metric_name, url);
970 } 972 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/previews/previews_infobar_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698