Chromium Code Reviews| Index: chrome/browser/net/client_hints.h |
| diff --git a/chrome/browser/net/client_hints.h b/chrome/browser/net/client_hints.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..cff71658139bd895e035a5908d60199ca739e197 |
| --- /dev/null |
| +++ b/chrome/browser/net/client_hints.h |
| @@ -0,0 +1,51 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_NET_CLIENT_HINTS_H_ |
| +#define CHROME_BROWSER_NET_CLIENT_HINTS_H_ |
| + |
| +#include <string> |
| + |
| +#include "base/memory/weak_ptr.h" |
| + |
| +// ClientHints is a repository in Chrome for information used |
| +// to create the Client-Hints request header. For more information, see: |
| +// https://github.com/igrigorik/http-client-hints/blob/master/ |
| +// draft-grigorik-http-client-hints-00.txt |
| +class ClientHints { |
| + public: |
| + // Contains information about the client device. |
| + struct ScreenInfo { |
| + int width; |
| + int height; |
| + float pixel_ratio; |
| + }; |
|
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.
|
| + |
| + ClientHints(); |
| + ~ClientHints(); |
| + |
| + // Retrieves screen information for use on the IO thread. |
| + bool RetrieveScreenInfo(); |
| + |
| + // Returns client hints pertaining to screen information. The format is: |
| + // "dh=x, dw=y, dpr=z", where x, y, and z are the device screen height, |
| + // screen width, and pixel ratio, respectively. These values are the |
| + // same as the values returned by the JavaScript commands: |
| + // screen.height, screen.width, and window.devicePixelRatio. |
| + std::string GetScreenInfoHints(); |
| + |
| + private: |
| + friend class ClientHintsTest; |
| + friend class base::RefCountedThreadSafe<ClientHints>; |
|
Ryan Sleevi
2013/02/26 18:26:16
unnecessary
bengr
2013/02/26 18:41:16
Done.
|
| + |
| + void UpdateScreenInfo(ScreenInfo* info); |
| + |
| + std::string screen_hints_; |
| + |
| + base::WeakPtrFactory<ClientHints> weak_ptr_factory_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ClientHints); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_NET_CLIENT_HINTS_H_ |