Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2503)

Unified Diff: chrome/browser/net/client_hints.h

Issue 23654014: Updated Client-Hints patch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..64170ad0dc4785e19756970bf84ee58e236cb3f1
--- /dev/null
+++ b/chrome/browser/net/client_hints.h
@@ -0,0 +1,52 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
bengr 2013/09/11 16:32:36 2013, and remove (c).
+// 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
mmenke 2013/09/09 16:55:30 Nit: Put the URL in one line. You'll get a presu
+class ClientHints {
+ public:
+ // Contains information about the client device.
bengr 2013/09/11 16:32:36 I believe the current thinking is that we'll only
+ struct ScreenInfo {
+ int width;
+ int height;
+ float pixel_ratio;
+ };
+
+ ClientHints();
+ ~ClientHints();
+
+ void Init();
+
+ // Retrieves screen information for use on the IO thread.
+ bool RetrieveScreenInfo();
+
+ // Returns client hints pertaining to screen information. The format is:
bengr 2013/09/11 16:32:36 Update comment to reflect that we are only reporti
+ // "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.
bengr 2013/09/11 16:32:36 remove screen.height and screen.width.
+ const std::string& GetScreenInfoHints();
mmenke 2013/09/09 16:55:30 nit: "const std::string& GetScreenInfoHints() con
+
+ private:
+ friend class ClientHintsTest;
+
+ void UpdateScreenInfo(ScreenInfo* info);
bengr 2013/09/11 16:32:36 This can be a float* device_pixel_ratio.
+
+ std::string screen_hints_;
+
+ base::WeakPtrFactory<ClientHints> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(ClientHints);
+};
+
+#endif // CHROME_BROWSER_NET_CLIENT_HINTS_H_

Powered by Google App Engine
This is Rietveld 408576698