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

Side by Side Diff: Source/core/fetch/ClientHintsPreferences.cpp

Issue 1183233002: Split RW hint into Width and Viewport-Width (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed and added layout tests Created 5 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 unified diff | Download patch
OLDNEW
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 }
OLDNEW
« no previous file with comments | « Source/core/fetch/ClientHintsPreferences.h ('k') | Source/core/fetch/ClientHintsPreferencesTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698