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 // The Previews state which determines whether to request a Preview version of | 17 typedef int PreviewsState; |
nasko
2017/02/16 18:10:02
Why does that need to stay around?
megjablon
2017/02/17 20:17:52
So that we can use these as a bitmask
nasko
2017/02/28 00:30:46
It was a bitmask before while being an enum, wasn'
megjablon
2017/02/28 00:44:23
Before we were only assigning it one value, but c+
| |
18 | |
19 // The Previews types which determines whether to request a Preview version of | |
18 // the resource. Previews are optimizations that change the format and | 20 // the resource. Previews are optimizations that change the format and |
19 // content of web pages to improve data savings and / or performance. This enum | 21 // content of web pages to improve data savings and / or performance. This enum |
20 // determines which Previews types to request. | 22 // determines which Previews types to request. |
21 enum PreviewsState { | 23 enum PreviewsTypes { |
22 PREVIEWS_UNSPECIFIED = 0, // Let the browser process decide whether or | 24 PREVIEWS_UNSPECIFIED = 0, // Let the browser process decide whether or |
23 // not to request Preview types. | 25 // not to request Preview types. |
24 SERVER_LOFI_ON = 1 << 0, // Request a Lo-Fi version of the resource | 26 SERVER_LOFI_ON = 1 << 0, // Request a Lo-Fi version of the resource |
25 // from the server. | 27 // from the server. |
26 CLIENT_LOFI_ON = 1 << 1, // Request a Lo-Fi version of the resource | 28 CLIENT_LOFI_ON = 1 << 1, // Request a Lo-Fi version of the resource |
27 // from the client. | 29 // from the client. |
28 PREVIEWS_NO_TRANSFORM = 1 << 2, // Explicitly forbid Previews | 30 SERVER_LITE_PAGE_ON = 1 << 2, // Request a Lite Page version of the |
31 // resource from the server. | |
32 PREVIEWS_NO_TRANSFORM = 1 << 3, // Explicitly forbid Previews | |
29 // transformations. | 33 // transformations. |
30 PREVIEWS_OFF = 1 << 3, // Request a normal (non-Preview) version of | 34 PREVIEWS_OFF = 1 << 4, // Request a normal (non-Preview) version of |
31 // the resource. Server transformations may | 35 // the resource. Server transformations may |
32 // still happen if the page is heavy. | 36 // still happen if the page is heavy. |
33 PREVIEWS_STATE_LAST = PREVIEWS_OFF | 37 PREVIEWS_STATE_LAST = PREVIEWS_OFF |
34 }; | 38 }; |
35 | 39 |
36 // Ensure that content::PreviewsState and blink::WebURLRequest::PreviewsState | 40 // Ensure that content::PreviewsState and blink::WebURLRequest::PreviewsState |
37 // are kept in sync. | 41 // are kept in sync. |
38 STATIC_ASSERT_PREVIEWS_ENUM(PREVIEWS_UNSPECIFIED, | 42 STATIC_ASSERT_PREVIEWS_ENUM(PREVIEWS_UNSPECIFIED, |
39 blink::WebURLRequest::PreviewsUnspecified); | 43 blink::WebURLRequest::PreviewsUnspecified); |
40 STATIC_ASSERT_PREVIEWS_ENUM(SERVER_LOFI_ON, blink::WebURLRequest::ServerLoFiOn); | 44 STATIC_ASSERT_PREVIEWS_ENUM(SERVER_LOFI_ON, blink::WebURLRequest::ServerLoFiOn); |
41 STATIC_ASSERT_PREVIEWS_ENUM(CLIENT_LOFI_ON, blink::WebURLRequest::ClientLoFiOn); | 45 STATIC_ASSERT_PREVIEWS_ENUM(CLIENT_LOFI_ON, blink::WebURLRequest::ClientLoFiOn); |
46 STATIC_ASSERT_PREVIEWS_ENUM(SERVER_LITE_PAGE_ON, | |
47 blink::WebURLRequest::ServerLitePageOn); | |
42 STATIC_ASSERT_PREVIEWS_ENUM(PREVIEWS_NO_TRANSFORM, | 48 STATIC_ASSERT_PREVIEWS_ENUM(PREVIEWS_NO_TRANSFORM, |
43 blink::WebURLRequest::PreviewsNoTransform); | 49 blink::WebURLRequest::PreviewsNoTransform); |
44 STATIC_ASSERT_PREVIEWS_ENUM(PREVIEWS_OFF, blink::WebURLRequest::PreviewsOff); | 50 STATIC_ASSERT_PREVIEWS_ENUM(PREVIEWS_OFF, blink::WebURLRequest::PreviewsOff); |
45 STATIC_ASSERT_PREVIEWS_ENUM(PREVIEWS_STATE_LAST, | 51 STATIC_ASSERT_PREVIEWS_ENUM(PREVIEWS_STATE_LAST, |
46 blink::WebURLRequest::PreviewsStateLast); | 52 blink::WebURLRequest::PreviewsStateLast); |
47 | 53 |
48 } // namespace content | 54 } // namespace content |
49 | 55 |
50 #endif // CONTENT_PUBLIC_COMMON_PREVIEWS_TYPE_H_ | 56 #endif // CONTENT_PUBLIC_COMMON_PREVIEWS_TYPE_H_ |
OLD | NEW |