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_CORE_BROWSER_LOFI_DECIDER_H_ | 5 #ifndef COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_LOFI_DECIDER_H_ |
6 #define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_LOFI_DECIDER_H_ | 6 #define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_LOFI_DECIDER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 | 9 |
10 namespace net { | 10 namespace net { |
(...skipping 13 matching lines...) Expand all Loading... |
24 // Lo-Fi header should be added to the given request. | 24 // Lo-Fi header should be added to the given request. |
25 virtual bool IsUsingLoFiMode(const net::URLRequest& request) const = 0; | 25 virtual bool IsUsingLoFiMode(const net::URLRequest& request) const = 0; |
26 | 26 |
27 // Adds a previews-specific directive to the Chrome-Proxy-Accept-Transform | 27 // Adds a previews-specific directive to the Chrome-Proxy-Accept-Transform |
28 // header if needed. If a slow page preview is triggered, adds "lite-page" or | 28 // header if needed. If a slow page preview is triggered, adds "lite-page" or |
29 // "empty-image", depending on whether the request is for the main frame | 29 // "empty-image", depending on whether the request is for the main frame |
30 // and lite pages are enabled, or for a subresource and Lo-Fi mode is enabled, | 30 // and lite pages are enabled, or for a subresource and Lo-Fi mode is enabled, |
31 // respectively. If a slow page preview is not triggered, "lite-page;if-heavy" | 31 // respectively. If a slow page preview is not triggered, "lite-page;if-heavy" |
32 // and "empty-image;if-heavy" are added in the respective aforementioned cases | 32 // and "empty-image;if-heavy" are added in the respective aforementioned cases |
33 // to request that the server transform the page if it determines it to be | 33 // to request that the server transform the page if it determines it to be |
34 // heavy. | 34 // heavy. Previews-related transformation headers are never added if |
| 35 // |is_previews_disabled| is true. |
35 virtual void MaybeSetAcceptTransformHeader( | 36 virtual void MaybeSetAcceptTransformHeader( |
36 const net::URLRequest& request, | 37 const net::URLRequest& request, |
| 38 bool is_previews_disabled, |
37 net::HttpRequestHeaders* headers) const = 0; | 39 net::HttpRequestHeaders* headers) const = 0; |
38 | 40 |
39 // Returns true if |headers| contains the Chrome-Proxy-Accept-Transform | 41 // Returns true if |headers| contains the Chrome-Proxy-Accept-Transform |
40 // header and a slow page previews directive ("lite-page" or "empty-image") | 42 // header and a slow page previews directive ("lite-page" or "empty-image") |
41 // is present and not conditioned on "if-heavy". | 43 // is present and not conditioned on "if-heavy". |
42 virtual bool IsSlowPagePreviewRequested( | 44 virtual bool IsSlowPagePreviewRequested( |
43 const net::HttpRequestHeaders& headers) const = 0; | 45 const net::HttpRequestHeaders& headers) const = 0; |
44 | 46 |
45 // Returns true if |headers| contains the Chrome-Proxy-Accept-Transform | 47 // Returns true if |headers| contains the Chrome-Proxy-Accept-Transform |
46 // header with the "lite-page" directive. | 48 // header with the "lite-page" directive. |
(...skipping 12 matching lines...) Expand all Loading... |
59 | 61 |
60 // Returns true if the Lo-Fi specific UMA should be recorded. It is set to | 62 // Returns true if the Lo-Fi specific UMA should be recorded. It is set to |
61 // true if Lo-Fi is enabled for |request|, Chrome session is in Lo-Fi | 63 // true if Lo-Fi is enabled for |request|, Chrome session is in Lo-Fi |
62 // Enabled or Control field trial, and the network quality was slow. | 64 // Enabled or Control field trial, and the network quality was slow. |
63 virtual bool ShouldRecordLoFiUMA(const net::URLRequest& request) const = 0; | 65 virtual bool ShouldRecordLoFiUMA(const net::URLRequest& request) const = 0; |
64 }; | 66 }; |
65 | 67 |
66 } // namespace data_reduction_proxy | 68 } // namespace data_reduction_proxy |
67 | 69 |
68 #endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_LOFI_DECIDER_H_ | 70 #endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_LOFI_DECIDER_H_ |
OLD | NEW |