Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 CONTENT_PUBLIC_COMMON_PREVIEWS_TYPE_H_ | 5 #ifndef CONTENT_PUBLIC_COMMON_PREVIEWS_TYPE_H_ |
| 6 #define CONTENT_PUBLIC_COMMON_PREVIEWS_TYPE_H_ | 6 #define CONTENT_PUBLIC_COMMON_PREVIEWS_TYPE_H_ |
| 7 | 7 |
| 8 #include "content/common/content_export.h" | 8 #include "content/common/content_export.h" |
| 9 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 9 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
| 10 | 10 |
| 11 #define STATIC_ASSERT_PREVIEWS_ENUM(a, b) \ | 11 #define STATIC_ASSERT_PREVIEWS_ENUM(a, b) \ |
| 12 static_assert(static_cast<int>(a) == static_cast<int>(b), \ | 12 static_assert(static_cast<int>(a) == static_cast<int>(b), \ |
| 13 "mismatching enums: " #a) | 13 "mismatching enums: " #a) |
| 14 | 14 |
| 15 namespace content { | 15 namespace content { |
| 16 | 16 |
| 17 // Chrome Proxy Previews header and directives. | 17 // Chrome Proxy Previews header and directives. |
| 18 const char kChromeProxyContentTransformHeader[] = | 18 const char kChromeProxyContentTransformHeader[] = |
| 19 "chrome-proxy-content-transform"; | 19 "chrome-proxy-content-transform"; |
| 20 const char kChromeProxyEmptyImageDirective[] = "empty-image"; | 20 const char kChromeProxyEmptyImageDirective[] = "empty-image"; |
| 21 const char kChromeProxyLitePageDirective[] = "lite-page"; | 21 const char kChromeProxyLitePageDirective[] = "lite-page"; |
| 22 | 22 |
| 23 typedef int PreviewsState; | 23 typedef int PreviewsState; |
| 24 | 24 |
| 25 // The Previews types which determines whether to request a Preview version of | 25 // The Previews types which determines whether to request a Preview version of |
| 26 // the resource. Previews are optimizations that change the format and | 26 // the resource. Previews are optimizations that change the format and |
| 27 // content of web pages to improve data savings and / or performance. This enum | 27 // content of web pages to improve data savings and / or performance. This enum |
| 28 // determines which Previews types to request. | 28 // determines which Previews types to request. |
| 29 enum PreviewsTypes { | 29 enum PreviewsTypes { |
| 30 PREVIEWS_UNSPECIFIED = 0, // Let the browser process decide whether or | 30 PREVIEWS_UNSPECIFIED = 0, // Let the browser process decide whether or |
| 31 // not to request Preview types. | 31 // not to request Preview types. |
| 32 SERVER_LOFI_ON = 1 << 0, // Request a Lo-Fi version of the resource | 32 SERVER_LOFI_ON = 1 << 0, // Request a Lo-Fi version of the resource |
| 33 // from the server. | 33 // from the server. |
| 34 CLIENT_LOFI_ON = 1 << 1, // Request a Lo-Fi version of the resource | 34 CLIENT_LOFI_ON = 1 << 1, // Request a Lo-Fi version of the resource |
| 35 // from the client. | 35 // from the client. |
| 36 SERVER_LITE_PAGE_ON = 1 << 2, // Request a Lite Page version of the | 36 CLIENT_LOFI_AUTO_RELOAD = 1 << 2, // Request the original version of the |
|
RyanSturm
2017/05/10 18:14:09
tiny nit: these comments don't line up well. Does
sclittle
2017/05/10 19:56:37
git cl format left it this way; I agree it looks k
| |
| 37 // resource from the server. | 37 // resource after a decoding error occurred |
| 38 PREVIEWS_NO_TRANSFORM = 1 << 3, // Explicitly forbid Previews | 38 // when attempting to use Client Lo-Fi. |
| 39 // transformations. | 39 SERVER_LITE_PAGE_ON = 1 << 3, // Request a Lite Page version of the |
| 40 PREVIEWS_OFF = 1 << 4, // Request a normal (non-Preview) version of | 40 // resource from the server. |
| 41 // the resource. Server transformations may | 41 PREVIEWS_NO_TRANSFORM = 1 << 4, // Explicitly forbid Previews |
| 42 // still happen if the page is heavy. | 42 // transformations. |
| 43 PREVIEWS_OFF = 1 << 5, // Request a normal (non-Preview) version of | |
| 44 // the resource. Server transformations may | |
| 45 // still happen if the page is heavy. | |
| 43 PREVIEWS_STATE_LAST = PREVIEWS_OFF | 46 PREVIEWS_STATE_LAST = PREVIEWS_OFF |
| 44 }; | 47 }; |
| 45 | 48 |
| 46 // Ensure that content::PreviewsState and blink::WebURLRequest::PreviewsState | 49 // Ensure that content::PreviewsState and blink::WebURLRequest::PreviewsState |
| 47 // are kept in sync. | 50 // are kept in sync. |
| 48 STATIC_ASSERT_PREVIEWS_ENUM(PREVIEWS_UNSPECIFIED, | 51 STATIC_ASSERT_PREVIEWS_ENUM(PREVIEWS_UNSPECIFIED, |
| 49 blink::WebURLRequest::kPreviewsUnspecified); | 52 blink::WebURLRequest::kPreviewsUnspecified); |
| 50 STATIC_ASSERT_PREVIEWS_ENUM(SERVER_LOFI_ON, | 53 STATIC_ASSERT_PREVIEWS_ENUM(SERVER_LOFI_ON, |
| 51 blink::WebURLRequest::kServerLoFiOn); | 54 blink::WebURLRequest::kServerLoFiOn); |
| 52 STATIC_ASSERT_PREVIEWS_ENUM(CLIENT_LOFI_ON, | 55 STATIC_ASSERT_PREVIEWS_ENUM(CLIENT_LOFI_ON, |
| 53 blink::WebURLRequest::kClientLoFiOn); | 56 blink::WebURLRequest::kClientLoFiOn); |
| 57 STATIC_ASSERT_PREVIEWS_ENUM(CLIENT_LOFI_AUTO_RELOAD, | |
| 58 blink::WebURLRequest::kClientLoFiAutoReload); | |
| 54 STATIC_ASSERT_PREVIEWS_ENUM(SERVER_LITE_PAGE_ON, | 59 STATIC_ASSERT_PREVIEWS_ENUM(SERVER_LITE_PAGE_ON, |
| 55 blink::WebURLRequest::kServerLitePageOn); | 60 blink::WebURLRequest::kServerLitePageOn); |
| 56 STATIC_ASSERT_PREVIEWS_ENUM(PREVIEWS_NO_TRANSFORM, | 61 STATIC_ASSERT_PREVIEWS_ENUM(PREVIEWS_NO_TRANSFORM, |
| 57 blink::WebURLRequest::kPreviewsNoTransform); | 62 blink::WebURLRequest::kPreviewsNoTransform); |
| 58 STATIC_ASSERT_PREVIEWS_ENUM(PREVIEWS_OFF, blink::WebURLRequest::kPreviewsOff); | 63 STATIC_ASSERT_PREVIEWS_ENUM(PREVIEWS_OFF, blink::WebURLRequest::kPreviewsOff); |
| 59 STATIC_ASSERT_PREVIEWS_ENUM(PREVIEWS_STATE_LAST, | 64 STATIC_ASSERT_PREVIEWS_ENUM(PREVIEWS_STATE_LAST, |
| 60 blink::WebURLRequest::kPreviewsStateLast); | 65 blink::WebURLRequest::kPreviewsStateLast); |
| 61 | 66 |
| 62 } // namespace content | 67 } // namespace content |
| 63 | 68 |
| 64 #endif // CONTENT_PUBLIC_COMMON_PREVIEWS_TYPE_H_ | 69 #endif // CONTENT_PUBLIC_COMMON_PREVIEWS_TYPE_H_ |
| OLD | NEW |