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/basictypes.h" | |
11 #include "base/memory/weak_ptr.h" | |
12 | |
13 // ClientHints is a repository in Chrome for information used | |
14 // to create the Client-Hints request header. For more information, see: | |
15 // https://github.com/igrigorik/http-client-hints/blob/draft2/draft-grigorik-htt p-client-hints-01.txt | |
16 class ClientHints { | |
17 public: | |
18 static const char* kDevicePixelRatioHeader; | |
Lei Zhang
2013/09/25 20:36:32
Please change this to const char kDevicePixelRatio
bengr
2013/09/25 21:39:45
Done.
| |
19 | |
20 ClientHints(); | |
21 ~ClientHints(); | |
22 | |
23 void Init(); | |
24 | |
25 // Returns the device pixel ratio as a string. Its value is the same as | |
26 // window.devicePixelRatio in Javascript. | |
27 const std::string& GetDevicePixelRatioHeader() const; | |
28 | |
29 protected: | |
30 // Retrieves and updates screen information for use on the IO thread. | |
31 bool RetrieveScreenInfo(); | |
mmenke
2013/09/25 20:07:48
nit: Since nothing inherits from ClientHints, thi
bengr
2013/09/25 21:39:45
Done.
| |
32 | |
33 private: | |
34 friend class ClientHintsTest; | |
35 | |
36 void UpdateScreenInfo(float device_pixel_ratio_value); | |
37 | |
38 std::string screen_hints_; | |
39 | |
40 base::WeakPtrFactory<ClientHints> weak_ptr_factory_; | |
41 | |
42 DISALLOW_COPY_AND_ASSIGN(ClientHints); | |
43 }; | |
44 | |
45 #endif // CHROME_BROWSER_NET_CLIENT_HINTS_H_ | |
OLD | NEW |