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

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

Issue 24451003: Client Hints (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed nit and use ScopedLocale with posix only Created 7 years, 2 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..c4beb39011fca11a5e22197754dc7d8741660ccd
--- /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/basictypes.h"
+#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/draft2/draft-grigorik-http-client-hints-01.txt
+class ClientHints {
+ public:
+ static const char kDevicePixelRatioHeader[];
+
+ ClientHints();
+ ~ClientHints();
+
+ void Init();
+
+ // Returns the device pixel ratio as a string. Its value is the same as
+ // window.devicePixelRatio in Javascript.
+ const std::string& GetDevicePixelRatioHeader() const;
+
+ private:
+ friend class ClientHintsTest;
+
+ // Retrieves and updates screen information for use on the IO thread.
+ bool RetrieveScreenInfo();
+
+ 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_

Powered by Google App Engine
This is Rietveld 408576698