Chromium Code Reviews| 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/ref_counted.h" | |
| 11 | |
| 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/master/ | |
| 16 // draft-grigorik-http-client-hints-00.txt | |
| 17 | |
|
Ryan Sleevi
2013/02/08 22:12:53
nit: delete blank line
bengr
2013/02/26 01:57:20
Done.
| |
| 18 class ClientHints : public base::RefCountedThreadSafe<ClientHints> { | |
|
Ryan Sleevi
2013/02/08 22:12:53
Why is this RefCounted? If it's for the UI<->IO th
bengr
2013/02/26 01:57:20
Done.
| |
| 19 public: | |
| 20 ClientHints(); | |
| 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 // "sh=xx, sw=yy, dpr=zz", where xx, yy, and zz are the screen height, | |
| 27 // screen width, and device pixel ratio, respectively. These values are the | |
| 28 // same as the values returned by the javascript commands: | |
| 29 // screen.height, screen.width, and window.devicePixelRatio. | |
| 30 std::string GetScreenInfoHints(); | |
| 31 | |
| 32 private: | |
| 33 friend class ClientHintsTest; | |
| 34 friend class base::RefCountedThreadSafe<ClientHints>; | |
| 35 | |
| 36 ~ClientHints(); | |
| 37 void FetchScreenInfoOnUIThread(); | |
| 38 void UpdateScreenInfo(int screen_width, int screen_height, | |
| 39 float device_pixel_ratio); | |
| 40 | |
| 41 std::string screen_hints_; | |
| 42 | |
| 43 DISALLOW_COPY_AND_ASSIGN(ClientHints); | |
| 44 }; | |
| 45 | |
| 46 #endif // CHROME_BROWSER_NET_CLIENT_HINTS_H_ | |
| OLD | NEW |