| 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 #ifndef ClientHintsPreferences_h | 5 #ifndef ClientHintsPreferences_h |
| 6 #define ClientHintsPreferences_h | 6 #define ClientHintsPreferences_h |
| 7 | 7 |
| 8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "wtf/text/WTFString.h" | 9 #include "wtf/text/WTFString.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 class ResourceFetcher; | 13 class ResourceFetcher; |
| 14 | 14 |
| 15 class ClientHintsPreferences { | 15 class CORE_EXPORT ClientHintsPreferences { |
| 16 public: | 16 public: |
| 17 ClientHintsPreferences() | 17 ClientHintsPreferences(); |
| 18 : m_shouldSendDPR(false) | |
| 19 , m_shouldSendResourceWidth(false) | |
| 20 , m_shouldSendViewportWidth(false) | |
| 21 { | |
| 22 } | |
| 23 | 18 |
| 24 void set(const ClientHintsPreferences& other) | 19 void updateFrom(const ClientHintsPreferences&); |
| 25 { | 20 void updateFromAcceptClientHintsHeader(const String& headerValue, ResourceFe
tcher*); |
| 26 m_shouldSendDPR = other.m_shouldSendDPR; | |
| 27 m_shouldSendResourceWidth = other.m_shouldSendResourceWidth; | |
| 28 m_shouldSendViewportWidth = other.m_shouldSendViewportWidth; | |
| 29 } | |
| 30 | 21 |
| 22 bool shouldSendDPR() const { return m_shouldSendDPR; } |
| 31 void setShouldSendDPR(bool should) { m_shouldSendDPR = should; } | 23 void setShouldSendDPR(bool should) { m_shouldSendDPR = should; } |
| 24 |
| 25 bool shouldSendResourceWidth() const { return m_shouldSendResourceWidth; } |
| 32 void setShouldSendResourceWidth(bool should) { m_shouldSendResourceWidth = s
hould; } | 26 void setShouldSendResourceWidth(bool should) { m_shouldSendResourceWidth = s
hould; } |
| 27 |
| 28 bool shouldSendViewportWidth() const { return m_shouldSendViewportWidth; } |
| 33 void setShouldSendViewportWidth(bool should) { m_shouldSendViewportWidth = s
hould; } | 29 void setShouldSendViewportWidth(bool should) { m_shouldSendViewportWidth = s
hould; } |
| 34 bool shouldSendDPR() const { return m_shouldSendDPR; } | |
| 35 bool shouldSendResourceWidth() const { return m_shouldSendResourceWidth; } | |
| 36 bool shouldSendViewportWidth() const { return m_shouldSendViewportWidth; } | |
| 37 | 30 |
| 38 private: | 31 private: |
| 39 bool m_shouldSendDPR; | 32 bool m_shouldSendDPR; |
| 40 bool m_shouldSendResourceWidth; | 33 bool m_shouldSendResourceWidth; |
| 41 bool m_shouldSendViewportWidth; | 34 bool m_shouldSendViewportWidth; |
| 42 }; | 35 }; |
| 43 | 36 |
| 44 CORE_EXPORT void handleAcceptClientHintsHeader(const String& headerValue, Client
HintsPreferences&, ResourceFetcher*); | |
| 45 } // namespace blink | 37 } // namespace blink |
| 38 |
| 46 #endif | 39 #endif |
| 47 | |
| OLD | NEW |