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

Side by Side Diff: components/previews/core/previews_io_data.cc

Issue 2667243003: Adding a parameter for previews NQE triggering threshold (Closed)
Patch Set: typo Created 3 years, 10 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 | « components/previews/core/previews_experiments_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "components/previews/core/previews_io_data.h" 5 #include "components/previews/core/previews_io_data.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 net::NetworkQualityEstimator* network_quality_estimator = 106 net::NetworkQualityEstimator* network_quality_estimator =
107 request.context()->network_quality_estimator(); 107 request.context()->network_quality_estimator();
108 if (!network_quality_estimator || 108 if (!network_quality_estimator ||
109 network_quality_estimator->GetEffectiveConnectionType() < 109 network_quality_estimator->GetEffectiveConnectionType() <
110 net::EFFECTIVE_CONNECTION_TYPE_OFFLINE) { 110 net::EFFECTIVE_CONNECTION_TYPE_OFFLINE) {
111 LogPreviewsEligibilityReason( 111 LogPreviewsEligibilityReason(
112 PreviewsEligibilityReason::NETWORK_QUALITY_UNAVAILABLE, type); 112 PreviewsEligibilityReason::NETWORK_QUALITY_UNAVAILABLE, type);
113 return false; 113 return false;
114 } 114 }
115 if (network_quality_estimator->GetEffectiveConnectionType() > 115 if (network_quality_estimator->GetEffectiveConnectionType() >
116 net::EFFECTIVE_CONNECTION_TYPE_SLOW_2G) { 116 params::EffectiveConnectionTypeThreshold()) {
117 LogPreviewsEligibilityReason(PreviewsEligibilityReason::NETWORK_NOT_SLOW, 117 LogPreviewsEligibilityReason(PreviewsEligibilityReason::NETWORK_NOT_SLOW,
118 type); 118 type);
119 return false; 119 return false;
120 } 120 }
121 // LOAD_VALIDATE_CACHE or LOAD_BYPASS_CACHE mean the user reloaded the page. 121 // LOAD_VALIDATE_CACHE or LOAD_BYPASS_CACHE mean the user reloaded the page.
122 // If this is a query for offline previews, reloads should be disallowed. 122 // If this is a query for offline previews, reloads should be disallowed.
123 if (type == PreviewsType::OFFLINE && 123 if (type == PreviewsType::OFFLINE &&
124 request.load_flags() & 124 request.load_flags() &
125 (net::LOAD_VALIDATE_CACHE | net::LOAD_BYPASS_CACHE)) { 125 (net::LOAD_VALIDATE_CACHE | net::LOAD_BYPASS_CACHE)) {
126 LogPreviewsEligibilityReason( 126 LogPreviewsEligibilityReason(
127 PreviewsEligibilityReason::RELOAD_DISALLOWED_FOR_OFFLINE, type); 127 PreviewsEligibilityReason::RELOAD_DISALLOWED_FOR_OFFLINE, type);
128 return false; 128 return false;
129 } 129 }
130 LogPreviewsEligibilityReason(PreviewsEligibilityReason::ALLOWED, type); 130 LogPreviewsEligibilityReason(PreviewsEligibilityReason::ALLOWED, type);
131 return true; 131 return true;
132 } 132 }
133 133
134 } // namespace previews 134 } // namespace previews
OLDNEW
« no previous file with comments | « components/previews/core/previews_experiments_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698