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

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: Coverging LoFi types 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 880 matching lines...) Expand 10 before | Expand all | Expand 10 after
891 content::PreviewsState previews_state = content::PREVIEWS_UNSPECIFIED; 891 content::PreviewsState previews_state = content::PREVIEWS_UNSPECIFIED;
892 892
893 if (data_reduction_proxy_io_data) { 893 if (data_reduction_proxy_io_data) {
894 if (data_reduction_proxy_io_data->ShouldEnableLoFi(url_request)) 894 if (data_reduction_proxy_io_data->ShouldEnableLoFi(url_request))
895 previews_state |= content::SERVER_LOFI_ON; 895 previews_state |= content::SERVER_LOFI_ON;
896 if (data_reduction_proxy_io_data->ShouldEnableLitePages(url_request)) 896 if (data_reduction_proxy_io_data->ShouldEnableLitePages(url_request))
897 previews_state |= content::SERVER_LITE_PAGE_ON; 897 previews_state |= content::SERVER_LITE_PAGE_ON;
898 898
899 previews::PreviewsIOData* previews_io_data = io_data->previews_io_data(); 899 previews::PreviewsIOData* previews_io_data = io_data->previews_io_data();
900 if (data_reduction_proxy_io_data->IsEnabled() && previews_io_data && 900 if (data_reduction_proxy_io_data->IsEnabled() && previews_io_data &&
901 previews::params::IsClientLoFiEnabled() &&
901 previews_io_data->ShouldAllowPreview( 902 previews_io_data->ShouldAllowPreview(
902 url_request, previews::PreviewsType::CLIENT_LOFI)) { 903 url_request, previews::PreviewsType::LOFI,
904 previews::params::EffectiveConnectionTypeThresholdForLoFi())) {
903 previews_state |= content::CLIENT_LOFI_ON; 905 previews_state |= content::CLIENT_LOFI_ON;
904 } 906 }
905 } 907 }
906 908
907 if (previews_state == content::PREVIEWS_UNSPECIFIED) 909 if (previews_state == content::PREVIEWS_UNSPECIFIED)
908 return content::PREVIEWS_OFF; 910 return content::PREVIEWS_OFF;
909 return previews_state; 911 return previews_state;
910 } 912 }
911 913
912 // static 914 // static
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
954 &ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad, 956 &ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad,
955 base::Unretained(this), url, request_loading_time)); 957 base::Unretained(this), url, request_loading_time));
956 return; 958 return;
957 } 959 }
958 960
959 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ? 961 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ?
960 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow"); 962 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow");
961 rappor::SampleDomainAndRegistryFromGURL( 963 rappor::SampleDomainAndRegistryFromGURL(
962 g_browser_process->rappor_service(), metric_name, url); 964 g_browser_process->rappor_service(), metric_name, url);
963 } 965 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698