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

Side by Side Diff: chrome/browser/net/client_hints.h

Issue 11970002: Added Client-Hints. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Made float literals explicit in tests Created 7 years, 9 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/net/chrome_network_delegate.cc ('k') | chrome/browser/net/client_hints.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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/weak_ptr.h"
11
12 // ClientHints is a repository in Chrome for information used
13 // to create the Client-Hints request header. For more information, see:
14 // https://github.com/igrigorik/http-client-hints/blob/master/
15 // draft-grigorik-http-client-hints-00.txt
16 class ClientHints {
17 public:
18 // Contains information about the client device.
19 struct ScreenInfo {
20 int width;
21 int height;
22 float pixel_ratio;
23 };
24
25 ClientHints();
26 ~ClientHints();
27
28 void Init();
29
30 // Retrieves screen information for use on the IO thread.
31 bool RetrieveScreenInfo();
32
33 // Returns client hints pertaining to screen information. The format is:
34 // "dh=x, dw=y, dpr=z", where x, y, and z are the device screen height,
35 // screen width, and pixel ratio, respectively. These values are the
36 // same as the values returned by the JavaScript commands:
37 // screen.height, screen.width, and window.devicePixelRatio.
38 const std::string& GetScreenInfoHints();
39
40 private:
41 friend class ClientHintsTest;
42
43 void UpdateScreenInfo(ScreenInfo* info);
44
45 std::string screen_hints_;
46
47 base::WeakPtrFactory<ClientHints> weak_ptr_factory_;
48
49 DISALLOW_COPY_AND_ASSIGN(ClientHints);
50 };
51
52 #endif // CHROME_BROWSER_NET_CLIENT_HINTS_H_
OLDNEW
« no previous file with comments | « chrome/browser/net/chrome_network_delegate.cc ('k') | chrome/browser/net/client_hints.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698