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 : public base::RefCountedThreadSafe<ClientHints> { | |
Ryan Sleevi
2013/02/26 02:21:04
This is still RefCounted, but you said you were go
bengr
2013/02/26 18:19:53
Oops. I meant to get rid of this. Done.
On 2013/0
| |
17 public: | |
18 ClientHints(); | |
19 | |
20 // Retrieves screen information for use on the IO thread. | |
21 bool RetrieveScreenInfo(); | |
22 | |
23 // Returns client hints pertaining to screen information. The format is: | |
24 // "dh=x, dw=y, dpr=z", where x, y, and z are the device screen height, | |
25 // screen width, and pixel ratio, respectively. These values are the | |
26 // same as the values returned by the JavaScript commands: | |
27 // screen.height, screen.width, and window.devicePixelRatio. | |
28 std::string GetScreenInfoHints(); | |
29 | |
30 // Contains information about the client device. | |
31 struct ScreenInfo { | |
32 int width; | |
33 int height; | |
34 float pixel_ratio; | |
35 }; | |
Ryan Sleevi
2013/02/26 02:21:04
Usually we place these declarations first (part of
bengr
2013/02/26 18:19:53
Done.
| |
36 | |
37 private: | |
38 friend class ClientHintsTest; | |
39 friend class base::RefCountedThreadSafe<ClientHints>; | |
40 | |
41 ~ClientHints(); | |
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 |