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 "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
9 #include "platform/wtf/Allocator.h" | 9 #include "platform/wtf/Allocator.h" |
10 #include "platform/wtf/text/WTFString.h" | 10 #include "platform/wtf/text/WTFString.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 class PLATFORM_EXPORT ClientHintsPreferences { | 14 class PLATFORM_EXPORT ClientHintsPreferences { |
15 DISALLOW_NEW(); | 15 DISALLOW_NEW(); |
16 | 16 |
17 public: | 17 public: |
18 class Context { | 18 class Context { |
19 public: | 19 public: |
| 20 virtual void CountClientHintsDeviceRAM() = 0; |
20 virtual void CountClientHintsDPR() = 0; | 21 virtual void CountClientHintsDPR() = 0; |
21 virtual void CountClientHintsResourceWidth() = 0; | 22 virtual void CountClientHintsResourceWidth() = 0; |
22 virtual void CountClientHintsViewportWidth() = 0; | 23 virtual void CountClientHintsViewportWidth() = 0; |
23 | 24 |
24 protected: | 25 protected: |
25 virtual ~Context() {} | 26 virtual ~Context() {} |
26 }; | 27 }; |
27 | 28 |
28 ClientHintsPreferences(); | 29 ClientHintsPreferences(); |
29 | 30 |
30 void UpdateFrom(const ClientHintsPreferences&); | 31 void UpdateFrom(const ClientHintsPreferences&); |
31 void UpdateFromAcceptClientHintsHeader(const String& header_value, Context*); | 32 void UpdateFromAcceptClientHintsHeader(const String& header_value, Context*); |
32 | 33 |
| 34 bool ShouldSendDeviceRAM() const { return should_send_device_ram_; } |
| 35 void SetShouldSendDeviceRAM(bool should) { should_send_device_ram_ = should; } |
| 36 |
33 bool ShouldSendDPR() const { return should_send_dpr_; } | 37 bool ShouldSendDPR() const { return should_send_dpr_; } |
34 void SetShouldSendDPR(bool should) { should_send_dpr_ = should; } | 38 void SetShouldSendDPR(bool should) { should_send_dpr_ = should; } |
35 | 39 |
36 bool ShouldSendResourceWidth() const { return should_send_resource_width_; } | 40 bool ShouldSendResourceWidth() const { return should_send_resource_width_; } |
37 void SetShouldSendResourceWidth(bool should) { | 41 void SetShouldSendResourceWidth(bool should) { |
38 should_send_resource_width_ = should; | 42 should_send_resource_width_ = should; |
39 } | 43 } |
40 | 44 |
41 bool ShouldSendViewportWidth() const { return should_send_viewport_width_; } | 45 bool ShouldSendViewportWidth() const { return should_send_viewport_width_; } |
42 void SetShouldSendViewportWidth(bool should) { | 46 void SetShouldSendViewportWidth(bool should) { |
43 should_send_viewport_width_ = should; | 47 should_send_viewport_width_ = should; |
44 } | 48 } |
45 | 49 |
46 private: | 50 private: |
| 51 bool should_send_device_ram_; |
47 bool should_send_dpr_; | 52 bool should_send_dpr_; |
48 bool should_send_resource_width_; | 53 bool should_send_resource_width_; |
49 bool should_send_viewport_width_; | 54 bool should_send_viewport_width_; |
50 }; | 55 }; |
51 | 56 |
52 } // namespace blink | 57 } // namespace blink |
53 | 58 |
54 #endif | 59 #endif |
OLD | NEW |