OLD | NEW |
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 #include "config.h" | 5 #include "config.h" |
6 #include "core/fetch/ClientHintsPreferences.h" | 6 #include "core/fetch/ClientHintsPreferences.h" |
7 | 7 |
8 #include "platform/RuntimeEnabledFeatures.h" | 8 #include "platform/RuntimeEnabledFeatures.h" |
9 #include "platform/network/HTTPParsers.h" | 9 #include "platform/network/HTTPParsers.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 void handleAcceptClientHintsHeader(const String& headerValue, ClientHintsPrefere
nces& preferences) | 13 void handleAcceptClientHintsHeader(const String& headerValue, ClientHintsPrefere
nces& preferences) |
14 { | 14 { |
15 if (RuntimeEnabledFeatures::clientHintsEnabled()) { | 15 if (!RuntimeEnabledFeatures::clientHintsEnabled() || headerValue.isEmpty()) |
16 CommaDelimitedHeaderSet acceptCH; | 16 return; |
17 parseCommaDelimitedHeader(headerValue, acceptCH); | 17 CommaDelimitedHeaderSet acceptCH; |
18 if (acceptCH.contains("dpr")) | 18 parseCommaDelimitedHeader(headerValue, acceptCH); |
19 preferences.setShouldSendDPR(true); | 19 if (acceptCH.contains("dpr")) |
20 if (acceptCH.contains("rw")) | 20 preferences.setShouldSendDPR(true); |
21 preferences.setShouldSendRW(true); | 21 |
22 } | 22 if (acceptCH.contains("width")) |
| 23 preferences.setShouldSendResourceWidth(true); |
| 24 |
| 25 if (acceptCH.contains("viewport-width")) |
| 26 preferences.setShouldSendViewportWidth(true); |
23 } | 27 } |
24 | 28 |
25 } | 29 } |
OLD | NEW |