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[]; |
| 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 private: |
| 30 friend class ClientHintsTest; |
| 31 |
| 32 // Retrieves and updates screen information for use on the IO thread. |
| 33 bool RetrieveScreenInfo(); |
| 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 |