Chromium Code Reviews| 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" | |
| 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/master/draft-grigorik-htt p-client-hints-01.txt | |
| 15 class ClientHints { | |
| 16 public: | |
| 17 ClientHints(); | |
| 18 ~ClientHints(); | |
| 19 | |
| 20 void Init(); | |
| 21 | |
| 22 // Retrieves screen information for use on the IO thread. | |
| 23 bool RetrieveScreenInfo(); | |
| 24 | |
| 25 // Returns client hints pertaining to screen information. The format is: | |
| 26 // "dpr=x", where x is pixel ratio. Its value is the same as the value | |
| 27 // returned by the JavaScript command window.devicePixelRatio | |
|
mmenke
2013/09/25 16:26:19
nit: .
bengr
2013/09/25 17:25:52
Done.
| |
| 28 const std::string& GetString() const; | |
|
mmenke
2013/09/25 16:26:19
If the new ClientHints spec uses multiple fields,
bengr
2013/09/25 17:25:52
Changed to GetDevicePixelRatioHeader.
| |
| 29 | |
| 30 private: | |
| 31 friend class ClientHintsTest; | |
| 32 | |
| 33 void UpdateScreenInfo(const float* device_pixel_ratio_value); | |
| 34 | |
| 35 std::string screen_hints_; | |
| 36 | |
| 37 base::WeakPtrFactory<ClientHints> weak_ptr_factory_; | |
| 38 | |
| 39 DISALLOW_COPY_AND_ASSIGN(ClientHints); | |
| 40 }; | |
| 41 | |
| 42 #endif // CHROME_BROWSER_NET_CLIENT_HINTS_H_ | |
| OLD | NEW |