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

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

Issue 2760063002: Add support to previews/ for Server LoFi and LitePages (Closed)
Patch Set: comment fix 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
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 884 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 if (data_reduction_proxy_io_data->ShouldEnableLoFi(url_request)) 895 if (data_reduction_proxy_io_data->ShouldEnableLoFi(url_request))
896 previews_state |= content::SERVER_LOFI_ON; 896 previews_state |= content::SERVER_LOFI_ON;
897 if (data_reduction_proxy_io_data->ShouldEnableLitePages(url_request)) 897 if (data_reduction_proxy_io_data->ShouldEnableLitePages(url_request))
898 previews_state |= content::SERVER_LITE_PAGE_ON; 898 previews_state |= content::SERVER_LITE_PAGE_ON;
899 899
900 previews::PreviewsIOData* previews_io_data = io_data->previews_io_data(); 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 901 // 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. 902 // the session, and the user is eligible for previews.
903 if (data_reduction_proxy_io_data->IsEnabled() && 903 if (data_reduction_proxy_io_data->IsEnabled() &&
904 !data_reduction_proxy_io_data->config()->lofi_off() && 904 !data_reduction_proxy_io_data->config()->lofi_off() &&
905 previews_io_data && 905 previews_io_data && previews::params::IsClientLoFiEnabled() &&
906 previews_io_data->ShouldAllowPreview( 906 previews_io_data->ShouldAllowPreviewAtECT(
907 url_request, previews::PreviewsType::CLIENT_LOFI)) { 907 url_request, previews::PreviewsType::LOFI,
908 previews::params::
909 EffectiveConnectionTypeThresholdForClientLoFi())) {
908 previews_state |= content::CLIENT_LOFI_ON; 910 previews_state |= content::CLIENT_LOFI_ON;
909 } 911 }
910 } 912 }
911 913
912 if (previews_state == content::PREVIEWS_UNSPECIFIED) 914 if (previews_state == content::PREVIEWS_UNSPECIFIED)
913 return content::PREVIEWS_OFF; 915 return content::PREVIEWS_OFF;
914 return previews_state; 916 return previews_state;
915 } 917 }
916 918
917 // static 919 // static
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
959 &ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad, 961 &ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad,
960 base::Unretained(this), url, request_loading_time)); 962 base::Unretained(this), url, request_loading_time));
961 return; 963 return;
962 } 964 }
963 965
964 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ? 966 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ?
965 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow"); 967 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow");
966 rappor::SampleDomainAndRegistryFromGURL( 968 rappor::SampleDomainAndRegistryFromGURL(
967 g_browser_process->rappor_service(), metric_name, url); 969 g_browser_process->rappor_service(), metric_name, url);
968 } 970 }
OLDNEW
« no previous file with comments | « chrome/browser/android/offline_pages/offline_page_request_job_unittest.cc ('k') | chrome/browser/previews/previews_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698