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..42e47445dfea97b7149dc49e6bd07d8336a49ca8 |
| --- /dev/null |
| +++ b/chrome/browser/net/client_hints.h |
| @@ -0,0 +1,44 @@ |
| +// Copyright 2013 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" |
|
mmenke
2013/09/25 17:37:40
nit: include basictypes.h for DISALLOW_COPY_AND_A
bengr
2013/09/25 20:04:12
Done.
|
| + |
| +// 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/draft2/draft-grigorik-http-client-hints-01.txt |
| +class ClientHints { |
| + public: |
| + static const char* kDevicePixelRatioHeader; |
| + |
| + ClientHints(); |
| + ~ClientHints(); |
| + |
| + void Init(); |
| + |
| + // Retrieves screen information for use on the IO thread. |
| + bool RetrieveScreenInfo(); |
|
mmenke
2013/09/25 17:37:40
Optional: Suggest "UpdateScreenInfo" to make it c
bengr
2013/09/25 20:04:12
I changed the comment slightly instead. There's al
|
| + |
| + // Returns client hints pertaining to screen information. The format is: |
| + // "dpr=x", where x is pixel ratio. Its value is the same as the value |
| + // returned by the JavaScript command window.devicePixelRatio. |
|
mmenke
2013/09/25 17:37:40
Comment is also incorrect.
Suggest something alon
bengr
2013/09/25 20:04:12
Done.
|
| + const std::string& GetDevicePixelRatioHeader() const; |
| + |
| + private: |
| + friend class ClientHintsTest; |
| + |
| + void UpdateScreenInfo(float device_pixel_ratio_value); |
| + |
| + std::string screen_hints_; |
| + |
| + base::WeakPtrFactory<ClientHints> weak_ptr_factory_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ClientHints); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_NET_CLIENT_HINTS_H_ |