OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_NET_CLIENT_HINTS_H_ | |
6 #define CHROME_BROWSER_NET_CLIENT_HINTS_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/memory/weak_ptr.h" | |
mmenke
2013/09/25 17:37:40
nit: include basictypes.h for DISALLOW_COPY_AND_A
bengr
2013/09/25 20:04:12
Done.
| |
11 | |
12 // ClientHints is a repository in Chrome for information used | |
13 // to create the Client-Hints request header. For more information, see: | |
14 // https://github.com/igrigorik/http-client-hints/blob/draft2/draft-grigorik-htt p-client-hints-01.txt | |
15 class ClientHints { | |
16 public: | |
17 static const char* kDevicePixelRatioHeader; | |
18 | |
19 ClientHints(); | |
20 ~ClientHints(); | |
21 | |
22 void Init(); | |
23 | |
24 // Retrieves screen information for use on the IO thread. | |
25 bool RetrieveScreenInfo(); | |
mmenke
2013/09/25 17:37:40
Optional: Suggest "UpdateScreenInfo" to make it c
bengr
2013/09/25 20:04:12
I changed the comment slightly instead. There's al
| |
26 | |
27 // Returns client hints pertaining to screen information. The format is: | |
28 // "dpr=x", where x is pixel ratio. Its value is the same as the value | |
29 // returned by the JavaScript command window.devicePixelRatio. | |
mmenke
2013/09/25 17:37:40
Comment is also incorrect.
Suggest something alon
bengr
2013/09/25 20:04:12
Done.
| |
30 const std::string& GetDevicePixelRatioHeader() const; | |
31 | |
32 private: | |
33 friend class ClientHintsTest; | |
34 | |
35 void UpdateScreenInfo(float device_pixel_ratio_value); | |
36 | |
37 std::string screen_hints_; | |
38 | |
39 base::WeakPtrFactory<ClientHints> weak_ptr_factory_; | |
40 | |
41 DISALLOW_COPY_AND_ASSIGN(ClientHints); | |
42 }; | |
43 | |
44 #endif // CHROME_BROWSER_NET_CLIENT_HINTS_H_ | |
OLD | NEW |