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

Unified Diff: content/public/common/previews_state.h

Issue 2484633004: Change Lo-Fi bool to bitmask to support multiple Previews types (Closed)
Patch Set: fix ContentResourceProviderTest Created 3 years, 11 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
« no previous file with comments | « content/public/common/BUILD.gn ('k') | content/public/common/resource_response.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/common/previews_state.h
diff --git a/content/public/common/previews_state.h b/content/public/common/previews_state.h
new file mode 100644
index 0000000000000000000000000000000000000000..ea839e379bdb9a64371b8aa550d3d1a65948acb1
--- /dev/null
+++ b/content/public/common/previews_state.h
@@ -0,0 +1,45 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_PUBLIC_COMMON_PREVIEWS_TYPE_H_
+#define CONTENT_PUBLIC_COMMON_PREVIEWS_TYPE_H_
+
+#include "content/common/content_export.h"
+#include "third_party/WebKit/public/platform/WebURLRequest.h"
+
+#define STATIC_ASSERT_PREVIEWS_ENUM(a, b) \
+ static_assert(static_cast<int>(a) == static_cast<int>(b), \
+ "mismatching enums: " #a)
+
+namespace content {
+
+// The Previews state which determines whether to request a Preview version of
+// the resource. Previews are optimizations that change the format and
+// content of web pages to improve data savings and / or performance. This enum
+// determines which Previews types to request.
+enum PreviewsState {
+ PREVIEWS_UNSPECIFIED = 0, // Let the browser process decide whether or
+ // not to request Preview types.
+ SERVER_LOFI_ON = 1 << 0, // Request a Lo-Fi version of the resource
+ // from the server.
+ CLIENT_LOFI_ON = 1 << 1, // Request a Lo-Fi version of the resource
+ // from the client.
+ PREVIEWS_OFF = 1 << 2, // Request a normal (non-Preview) version of
+ // the resource.
+ PREVIEWS_STATE_LAST = PREVIEWS_OFF
+};
+
+// Ensure that content::PreviewsState and blink::WebURLRequest::PreviewsState
+// are kept in sync.
+STATIC_ASSERT_PREVIEWS_ENUM(PREVIEWS_UNSPECIFIED,
+ blink::WebURLRequest::PreviewsUnspecified);
+STATIC_ASSERT_PREVIEWS_ENUM(SERVER_LOFI_ON, blink::WebURLRequest::ServerLoFiOn);
+STATIC_ASSERT_PREVIEWS_ENUM(CLIENT_LOFI_ON, blink::WebURLRequest::ClientLoFiOn);
+STATIC_ASSERT_PREVIEWS_ENUM(PREVIEWS_OFF, blink::WebURLRequest::PreviewsOff);
+STATIC_ASSERT_PREVIEWS_ENUM(PREVIEWS_STATE_LAST,
+ blink::WebURLRequest::PreviewsStateLast);
+
+} // namespace content
+
+#endif // CONTENT_PUBLIC_COMMON_PREVIEWS_TYPE_H_
« no previous file with comments | « content/public/common/BUILD.gn ('k') | content/public/common/resource_response.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698