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

Side by Side Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_config.h

Issue 2642793005: Create a Lite Page bit for previews and fallback to Lo-Fi (Closed)
Patch Set: 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_CONFIG _H_ 5 #ifndef COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_CONFIG _H_
6 #define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_CONFIG _H_ 6 #define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_CONFIG _H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 // Returns true if the Data Reduction Proxy promo may be shown. This is not 182 // Returns true if the Data Reduction Proxy promo may be shown. This is not
183 // tied to whether the Data Reduction Proxy is enabled. 183 // tied to whether the Data Reduction Proxy is enabled.
184 bool promo_allowed() const; 184 bool promo_allowed() const;
185 185
186 // Sets |lofi_off_| to true. 186 // Sets |lofi_off_| to true.
187 void SetLoFiModeOff(); 187 void SetLoFiModeOff();
188 188
189 // Returns |lofi_off_|. 189 // Returns |lofi_off_|.
190 bool lofi_off() const { return lofi_off_; } 190 bool lofi_off() const { return lofi_off_; }
191 191
192 // Returns true when Lo-Fi mode should be activated. Records metrics for Lo-Fi 192 // Returns true when Lo-Fi Previews should be activated. Records metrics for
193 // state changes. |request| is used to get the network quality estimator from 193 // Lo-Fi state changes. |request| is used to get the network quality estimator
194 // the URLRequestContext. 194 // from the URLRequestContext.
195 bool ShouldEnableLoFiMode(const net::URLRequest& request); 195 bool ShouldEnableLoFi(const net::URLRequest& request);
196
197 // Returns true when Lite Page Previews should be activated. |request| is used
198 // to get the network quality estimator from the URLRequestContext.
199 bool ShouldEnableLitePages(const net::URLRequest& request);
196 200
197 // Returns true if the data saver has been enabled by the user, and the data 201 // Returns true if the data saver has been enabled by the user, and the data
198 // saver proxy is reachable. 202 // saver proxy is reachable.
199 bool enabled_by_user_and_reachable() const; 203 bool enabled_by_user_and_reachable() const;
200 204
201 // Gets the ProxyConfig that would be used ignoring the holdback experiment. 205 // Gets the ProxyConfig that would be used ignoring the holdback experiment.
202 // This should only be used for logging purposes. 206 // This should only be used for logging purposes.
203 net::ProxyConfig ProxyConfigIgnoringHoldback() const; 207 net::ProxyConfig ProxyConfigIgnoringHoldback() const;
204 208
205 protected: 209 protected:
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 // proxies are bypassed, returns the minimum retry delay of the bypassed data 280 // proxies are bypassed, returns the minimum retry delay of the bypassed data
277 // reduction proxies in min_retry_delay (if not NULL). If there are no 281 // reduction proxies in min_retry_delay (if not NULL). If there are no
278 // bypassed data reduction proxies for the request scheme, returns false and 282 // bypassed data reduction proxies for the request scheme, returns false and
279 // does not assign min_retry_delay. 283 // does not assign min_retry_delay.
280 bool AreProxiesBypassed( 284 bool AreProxiesBypassed(
281 const net::ProxyRetryInfoMap& retry_map, 285 const net::ProxyRetryInfoMap& retry_map,
282 const net::ProxyConfig::ProxyRules& proxy_rules, 286 const net::ProxyConfig::ProxyRules& proxy_rules,
283 bool is_https, 287 bool is_https,
284 base::TimeDelta* min_retry_delay) const; 288 base::TimeDelta* min_retry_delay) const;
285 289
286 // Returns true when Lo-Fi mode should be activated. Determines if Lo-Fi mode 290 // Returns true when Lo-Fi Previews should be activated. Determines if Lo-Fi
287 // should be activated by checking the Lo-Fi flags and if the network quality 291 // Previews should be activated by checking the Lo-Fi flags and if the network
288 // is prohibitively slow. |network_quality_estimator| may be NULL. 292 // quality is prohibitively slow. |network_quality_estimator| may be NULL.
289 bool ShouldEnableLoFiModeInternal( 293 bool ShouldEnableLoFiInternal(
294 const net::NetworkQualityEstimator* network_quality_estimator);
295
296 // Returns true when Lite Page Previews should be activated. Determines if
297 // Lite Page Previewsmode should be activated by checking the Lite Page
298 // Previews flags and if the network quality is prohibitively slow.
299 // |network_quality_estimator| may be NULL.
300 bool ShouldEnableLitePagesInternal(
290 const net::NetworkQualityEstimator* network_quality_estimator); 301 const net::NetworkQualityEstimator* network_quality_estimator);
291 302
292 // Returns true if the network quality is at least as poor as the one 303 // Returns true if the network quality is at least as poor as the one
293 // specified in the Auto Lo-Fi field trial parameters. 304 // specified in the Auto Lo-Fi field trial parameters.
294 // |network_quality_estimator| may be NULL. Virtualized for unit testing. 305 // |network_quality_estimator| may be NULL. Virtualized for unit testing.
295 virtual bool IsNetworkQualityProhibitivelySlow( 306 virtual bool IsNetworkQualityProhibitivelySlow(
296 const net::NetworkQualityEstimator* network_quality_estimator); 307 const net::NetworkQualityEstimator* network_quality_estimator);
297 308
298 // Records Lo-Fi accuracy metric. |measuring_duration| should belong to the 309 // Records Lo-Fi accuracy metric. |measuring_duration| should belong to the
299 // vector returned by LofiAccuracyRecordingIntervals(). 310 // vector returned by LofiAccuracyRecordingIntervals().
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 bool is_captive_portal_; 414 bool is_captive_portal_;
404 415
405 base::WeakPtrFactory<DataReductionProxyConfig> weak_factory_; 416 base::WeakPtrFactory<DataReductionProxyConfig> weak_factory_;
406 417
407 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyConfig); 418 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyConfig);
408 }; 419 };
409 420
410 } // namespace data_reduction_proxy 421 } // namespace data_reduction_proxy
411 422
412 #endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_CON FIG_H_ 423 #endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_CON FIG_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698