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

Unified Diff: components/data_reduction_proxy/core/common/data_reduction_proxy_headers.h

Issue 2956703002: Adds Server Previews protocol UMA plus UMA for not accepting previews (Closed)
Patch Set: Fix merge issue for unittest wrt AlwaysOn and PreviewsDecider Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: components/data_reduction_proxy/core/common/data_reduction_proxy_headers.h
diff --git a/components/data_reduction_proxy/core/common/data_reduction_proxy_headers.h b/components/data_reduction_proxy/core/common/data_reduction_proxy_headers.h
index d65f8e2e76fee08c8e460f77ac22feec2fbe0abd..f48ff2d2ba9eb990a24220e57e7fe4adf890b902 100644
--- a/components/data_reduction_proxy/core/common/data_reduction_proxy_headers.h
+++ b/components/data_reduction_proxy/core/common/data_reduction_proxy_headers.h
@@ -11,6 +11,8 @@
#include "base/macros.h"
#include "base/strings/string_piece.h"
#include "base/time/time.h"
+#include "net/http/http_request_headers.h"
+#include "net/http/http_response_headers.h"
#include "net/proxy/proxy_service.h"
class GURL;
@@ -21,6 +23,15 @@ class HttpResponseHeaders;
namespace data_reduction_proxy {
+// Transform directives that may be parsed out of http headers.
+enum TransformDirective {
+ TRANSFORM_NONE,
+ TRANSFORM_LITE_PAGE,
+ TRANSFORM_EMPTY_IMAGE,
+ TRANSFORM_COMPRESSED_VIDEO,
+ TRANSFORM_PAGE_POLICIES_EMPTY_IMAGE,
+};
+
// Values of the UMA DataReductionProxy.BypassType{Primary|Fallback} and
// DataReductionProxy.BlockType{Primary|Fallback} histograms. This enum must
// remain synchronized with the enum of the same name in
@@ -117,6 +128,18 @@ const char* if_heavy_qualifier();
// that an empty image has been provided.
bool IsEmptyImagePreview(const net::HttpResponseHeaders& headers);
+// Retrieves the accepted transform type, if any, from |headers|.
+TransformDirective ParseRequestTransform(
+ const net::HttpRequestHeaders& headers);
+
+// Retrieves the transform directive (whether applied or a page policy), if any,
+// from |headers|.
+// Note if the response headers contains both an applied content transform and
+// a page policies directive, only the applied content transform type will
+// be returned.
+TransformDirective ParseResponseTransform(
+ const net::HttpResponseHeaders& headers);
+
// Returns true if the provided value of the Chrome-Proxy-Content-Transform
// response header that is provided in |content_transform_value| indicates that
// an empty image has been provided.

Powered by Google App Engine
This is Rietveld 408576698