Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
|
bengr
2013/09/11 16:32:36
2013, and remove (c).
| |
| 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/ | |
| 15 // draft-grigorik-http-client-hints-00.txt | |
|
mmenke
2013/09/09 16:55:30
Nit: Put the URL in one line. You'll get a presu
| |
| 16 class ClientHints { | |
| 17 public: | |
| 18 // Contains information about the client device. | |
|
bengr
2013/09/11 16:32:36
I believe the current thinking is that we'll only
| |
| 19 struct ScreenInfo { | |
| 20 int width; | |
| 21 int height; | |
| 22 float pixel_ratio; | |
| 23 }; | |
| 24 | |
| 25 ClientHints(); | |
| 26 ~ClientHints(); | |
| 27 | |
| 28 void Init(); | |
| 29 | |
| 30 // Retrieves screen information for use on the IO thread. | |
| 31 bool RetrieveScreenInfo(); | |
| 32 | |
| 33 // Returns client hints pertaining to screen information. The format is: | |
|
bengr
2013/09/11 16:32:36
Update comment to reflect that we are only reporti
| |
| 34 // "dh=x, dw=y, dpr=z", where x, y, and z are the device screen height, | |
| 35 // screen width, and pixel ratio, respectively. These values are the | |
| 36 // same as the values returned by the JavaScript commands: | |
| 37 // screen.height, screen.width, and window.devicePixelRatio. | |
|
bengr
2013/09/11 16:32:36
remove screen.height and screen.width.
| |
| 38 const std::string& GetScreenInfoHints(); | |
|
mmenke
2013/09/09 16:55:30
nit: "const std::string& GetScreenInfoHints() con
| |
| 39 | |
| 40 private: | |
| 41 friend class ClientHintsTest; | |
| 42 | |
| 43 void UpdateScreenInfo(ScreenInfo* info); | |
|
bengr
2013/09/11 16:32:36
This can be a float* device_pixel_ratio.
| |
| 44 | |
| 45 std::string screen_hints_; | |
| 46 | |
| 47 base::WeakPtrFactory<ClientHints> weak_ptr_factory_; | |
| 48 | |
| 49 DISALLOW_COPY_AND_ASSIGN(ClientHints); | |
| 50 }; | |
| 51 | |
| 52 #endif // CHROME_BROWSER_NET_CLIENT_HINTS_H_ | |
| OLD | NEW |