• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 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 CONTENT_PUBLIC_COMMON_RESOURCE_RESPONSE_INFO_H_
6 #define CONTENT_PUBLIC_COMMON_RESOURCE_RESPONSE_INFO_H_
7 
8 #include <string>
9 
10 #include "base/basictypes.h"
11 #include "base/files/file_path.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/time/time.h"
14 #include "content/common/content_export.h"
15 #include "content/public/common/resource_devtools_info.h"
16 #include "net/base/host_port_pair.h"
17 #include "net/base/load_timing_info.h"
18 #include "net/http/http_response_info.h"
19 #include "url/gurl.h"
20 
21 namespace content {
22 
23 struct ResourceResponseInfo {
24   CONTENT_EXPORT ResourceResponseInfo();
25   CONTENT_EXPORT ~ResourceResponseInfo();
26 
27   // The time at which the request was made that resulted in this response.
28   // For cached responses, this time could be "far" in the past.
29   base::Time request_time;
30 
31   // The time at which the response headers were received.  For cached
32   // responses, this time could be "far" in the past.
33   base::Time response_time;
34 
35   // The response headers or NULL if the URL type does not support headers.
36   scoped_refptr<net::HttpResponseHeaders> headers;
37 
38   // The mime type of the response.  This may be a derived value.
39   std::string mime_type;
40 
41   // The character encoding of the response or none if not applicable to the
42   // response's mime type.  This may be a derived value.
43   std::string charset;
44 
45   // An opaque string carrying security information pertaining to this
46   // response.  This may include information about the SSL connection used.
47   std::string security_info;
48 
49   // Content length if available. -1 if not available
50   int64 content_length;
51 
52   // Length of the encoded data transferred over the network. In case there is
53   // no data, contains -1.
54   int64 encoded_data_length;
55 
56   // The appcache this response was loaded from, or kAppCacheNoCacheId.
57   int64 appcache_id;
58 
59   // The manifest url of the appcache this response was loaded from.
60   // Note: this value is only populated for main resource requests.
61   GURL appcache_manifest_url;
62 
63   // Detailed timing information used by the WebTiming, HAR and Developer
64   // Tools.  Includes socket ID and socket reuse information.
65   net::LoadTimingInfo load_timing;
66 
67   // Actual request and response headers, as obtained from the network stack.
68   // Only present if request had LOAD_REPORT_RAW_HEADERS in load_flags, and
69   // requesting renderer had CanReadRowCookies permission.
70   scoped_refptr<ResourceDevToolsInfo> devtools_info;
71 
72   // The path to a file that will contain the response body.  It may only
73   // contain a portion of the response body at the time that the ResponseInfo
74   // becomes available.
75   base::FilePath download_file_path;
76 
77   // True if the response was delivered using SPDY.
78   bool was_fetched_via_spdy;
79 
80   // True if the response was delivered after NPN is negotiated.
81   bool was_npn_negotiated;
82 
83   // True if response could use alternate protocol. However, browser will
84   // ignore the alternate protocol when spdy is not enabled on browser side.
85   bool was_alternate_protocol_available;
86 
87   // Information about the type of connection used to fetch this response.
88   net::HttpResponseInfo::ConnectionInfo connection_info;
89 
90   // True if the response was fetched via an explicit proxy (as opposed to a
91   // transparent proxy). The proxy could be any type of proxy, HTTP or SOCKS.
92   // Note: we cannot tell if a transparent proxy may have been involved.
93   bool was_fetched_via_proxy;
94 
95   // NPN protocol negotiated with the server.
96   std::string npn_negotiated_protocol;
97 
98   // Remote address of the socket which fetched this resource.
99   net::HostPortPair socket_address;
100 };
101 
102 }  // namespace content
103 
104 #endif  // CONTENT_PUBLIC_COMMON_RESOURCE_RESPONSE_INFO_H_
105