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

Side by Side Diff: components/data_reduction_proxy/core/common/lofi_decider.h

Issue 2642793005: Create a Lite Page bit for previews and fallback to Lo-Fi (Closed)
Patch Set: remove unused frame_messages.h code Created 3 years, 9 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_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 {
11 class HttpRequestHeaders; 11 class HttpRequestHeaders;
12 class URLRequest; 12 class URLRequest;
13 } 13 }
14 14
15 namespace data_reduction_proxy { 15 namespace data_reduction_proxy {
16 16
17 // Interface to determine if a request should be made for a low fidelity version 17 // Interface to determine if a request should be made for a low fidelity version
18 // of the resource. 18 // of the resource.
19 class LoFiDecider { 19 class LoFiDecider {
20 public: 20 public:
21 virtual ~LoFiDecider() {} 21 virtual ~LoFiDecider() {}
22 22
23 // Returns true when Lo-Fi mode is on for the given |request|. This means the 23 // Returns true when Lo-Fi Previews are on for the given |request|. This means
24 // Lo-Fi header should be added to the given request. 24 // the Lo-Fi header should be added to the given request.
25 virtual bool IsUsingLoFiMode(const net::URLRequest& request) const = 0; 25 virtual bool IsUsingLoFi(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. Previews-related transformation headers are never added if 34 // heavy. Previews-related transformation headers are never added if
35 // |is_previews_disabled| is true. 35 // |is_previews_disabled| is true.
36 virtual void MaybeSetAcceptTransformHeader( 36 virtual void MaybeSetAcceptTransformHeader(
37 const net::URLRequest& request, 37 const net::URLRequest& request,
38 bool is_previews_disabled, 38 bool are_previews_disabled,
39 net::HttpRequestHeaders* headers) const = 0; 39 net::HttpRequestHeaders* headers) const = 0;
40 40
41 // Returns true if |headers| contains the Chrome-Proxy-Accept-Transform 41 // Returns true if |headers| contains the Chrome-Proxy-Accept-Transform
42 // 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")
43 // is present and not conditioned on "if-heavy". 43 // is present and not conditioned on "if-heavy".
44 virtual bool IsSlowPagePreviewRequested( 44 virtual bool IsSlowPagePreviewRequested(
45 const net::HttpRequestHeaders& headers) const = 0; 45 const net::HttpRequestHeaders& headers) const = 0;
46 46
47 // Returns true if |headers| contains the Chrome-Proxy-Accept-Transform 47 // Returns true if |headers| contains the Chrome-Proxy-Accept-Transform
48 // header with the "lite-page" directive. 48 // header with the "lite-page" directive.
(...skipping 12 matching lines...) Expand all
61 61
62 // 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
63 // 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
64 // Enabled or Control field trial, and the network quality was slow. 64 // Enabled or Control field trial, and the network quality was slow.
65 virtual bool ShouldRecordLoFiUMA(const net::URLRequest& request) const = 0; 65 virtual bool ShouldRecordLoFiUMA(const net::URLRequest& request) const = 0;
66 }; 66 };
67 67
68 } // namespace data_reduction_proxy 68 } // namespace data_reduction_proxy
69 69
70 #endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_LOFI_DECIDER_H_ 70 #endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_LOFI_DECIDER_H_
OLDNEW
« no previous file with comments | « components/data_reduction_proxy/core/common/data_reduction_proxy_params.cc ('k') | content/common/frame_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698