OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 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/ | |
15 // draft-grigorik-http-client-hints-00.txt | |
16 class ClientHints { | |
17 public: | |
18 // Contains information about the client device. | |
19 struct ScreenInfo { | |
20 int width; | |
21 int height; | |
22 float pixel_ratio; | |
23 }; | |
Ryan Sleevi
2013/02/26 18:26:16
I just realized you made this declaration public s
bengr
2013/02/26 18:41:16
FetchScreenInfoOnUIThread also needs ScreenInfo.
| |
24 | |
25 ClientHints(); | |
26 ~ClientHints(); | |
27 | |
28 // Retrieves screen information for use on the IO thread. | |
29 bool RetrieveScreenInfo(); | |
30 | |
31 // Returns client hints pertaining to screen information. The format is: | |
32 // "dh=x, dw=y, dpr=z", where x, y, and z are the device screen height, | |
33 // screen width, and pixel ratio, respectively. These values are the | |
34 // same as the values returned by the JavaScript commands: | |
35 // screen.height, screen.width, and window.devicePixelRatio. | |
36 std::string GetScreenInfoHints(); | |
37 | |
38 private: | |
39 friend class ClientHintsTest; | |
40 friend class base::RefCountedThreadSafe<ClientHints>; | |
Ryan Sleevi
2013/02/26 18:26:16
unnecessary
bengr
2013/02/26 18:41:16
Done.
| |
41 | |
42 void UpdateScreenInfo(ScreenInfo* info); | |
43 | |
44 std::string screen_hints_; | |
45 | |
46 base::WeakPtrFactory<ClientHints> weak_ptr_factory_; | |
47 | |
48 DISALLOW_COPY_AND_ASSIGN(ClientHints); | |
49 }; | |
50 | |
51 #endif // CHROME_BROWSER_NET_CLIENT_HINTS_H_ | |
OLD | NEW |