| OLD | NEW |
| 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_CONTENT_BROWSER_CONTENT_LOFI_DECIDER_H_ | 5 #ifndef COMPONENTS_DATA_REDUCTION_PROXY_CONTENT_BROWSER_CONTENT_LOFI_DECIDER_H_ |
| 6 #define COMPONENTS_DATA_REDUCTION_PROXY_CONTENT_BROWSER_CONTENT_LOFI_DECIDER_H_ | 6 #define COMPONENTS_DATA_REDUCTION_PROXY_CONTENT_BROWSER_CONTENT_LOFI_DECIDER_H_ |
| 7 | 7 |
| 8 #include "components/data_reduction_proxy/core/common/lofi_decider.h" | 8 #include "components/data_reduction_proxy/core/common/lofi_decider.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 | 10 |
| 11 namespace net { | 11 namespace net { |
| 12 class HttpRequestHeaders; | 12 class HttpRequestHeaders; |
| 13 class URLRequest; | 13 class URLRequest; |
| 14 } | 14 } |
| 15 | 15 |
| 16 namespace data_reduction_proxy { | 16 namespace data_reduction_proxy { |
| 17 | 17 |
| 18 // Class responsible for deciding whether a request should be requested with low | 18 // Class responsible for deciding whether a request should be requested with low |
| 19 // fidelity (Lo-Fi) or not. Relies on the Lo-Fi mode state stored in the | 19 // fidelity (Lo-Fi) or not. Relies on the Lo-Fi mode state stored in the |
| 20 // request's content::ResourceRequestInfo, which must be fetched using | 20 // request's content::ResourceRequestInfo, which must be fetched using |
| 21 // content::ResourceRequestInfo::ForRequest. Lo-Fi mode will not be enabled for | 21 // content::ResourceRequestInfo::ForRequest. Lo-Fi mode will not be enabled for |
| 22 // requests that don't have a ResourceRequestInfo, such as background requests. | 22 // requests that don't have a ResourceRequestInfo, such as background requests. |
| 23 // Owned by DataReductionProxyIOData and should be called on the IO thread. | 23 // Owned by DataReductionProxyIOData and should be called on the IO thread. |
| 24 class ContentLoFiDecider : public LoFiDecider { | 24 class ContentLoFiDecider : public LoFiDecider { |
| 25 public: | 25 public: |
| 26 ContentLoFiDecider(); | 26 ContentLoFiDecider(); |
| 27 ~ContentLoFiDecider() override; | 27 ~ContentLoFiDecider() override; |
| 28 | 28 |
| 29 // LoFiDecider implementation: | 29 // LoFiDecider implementation: |
| 30 bool IsUsingLoFiMode(const net::URLRequest& request) const override; | 30 bool IsUsingLoFi(const net::URLRequest& request) const override; |
| 31 void MaybeSetAcceptTransformHeader( | 31 void MaybeSetAcceptTransformHeader( |
| 32 const net::URLRequest& request, | 32 const net::URLRequest& request, |
| 33 bool is_previews_disabled, | 33 bool are_previews_disabled, |
| 34 net::HttpRequestHeaders* headers) const override; | 34 net::HttpRequestHeaders* headers) const override; |
| 35 bool IsSlowPagePreviewRequested( | 35 bool IsSlowPagePreviewRequested( |
| 36 const net::HttpRequestHeaders& headers) const override; | 36 const net::HttpRequestHeaders& headers) const override; |
| 37 bool IsLitePagePreviewRequested( | 37 bool IsLitePagePreviewRequested( |
| 38 const net::HttpRequestHeaders& headers) const override; | 38 const net::HttpRequestHeaders& headers) const override; |
| 39 void RemoveAcceptTransformHeader( | 39 void RemoveAcceptTransformHeader( |
| 40 net::HttpRequestHeaders* headers) const override; | 40 net::HttpRequestHeaders* headers) const override; |
| 41 void MaybeSetIgnorePreviewsBlacklistDirective( | 41 void MaybeSetIgnorePreviewsBlacklistDirective( |
| 42 net::HttpRequestHeaders* headers) const override; | 42 net::HttpRequestHeaders* headers) const override; |
| 43 bool ShouldRecordLoFiUMA(const net::URLRequest& request) const override; | 43 bool ShouldRecordLoFiUMA(const net::URLRequest& request) const override; |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 DISALLOW_COPY_AND_ASSIGN(ContentLoFiDecider); | 46 DISALLOW_COPY_AND_ASSIGN(ContentLoFiDecider); |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 } // namespace data_reduction_proxy | 49 } // namespace data_reduction_proxy |
| 50 | 50 |
| 51 #endif // COMPONENTS_DATA_REDUCTION_PROXY_CONTENT_BROWSER_CONTENT_LOFI_DECIDER_
H_ | 51 #endif // COMPONENTS_DATA_REDUCTION_PROXY_CONTENT_BROWSER_CONTENT_LOFI_DECIDER_
H_ |
| OLD | NEW |