1 // Copyright 2013 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.
5 #ifndef WEBKIT_COMMON_RESOURCE_RESPONSE_INFO_H_
6 #define WEBKIT_COMMON_RESOURCE_RESPONSE_INFO_H_
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 "net/base/host_port_pair.h"
15 #include "net/base/load_timing_info.h"
16 #include "net/http/http_response_info.h"
18 #include "webkit/common/resource_devtools_info.h"
20 namespace webkit_glue
{
22 struct ResourceResponseInfo
{
23 WEBKIT_COMMON_EXPORT
ResourceResponseInfo();
24 WEBKIT_COMMON_EXPORT
~ResourceResponseInfo();
26 // The time at which the request was made that resulted in this response.
27 // For cached responses, this time could be "far" in the past.
28 base::Time request_time
;
30 // The time at which the response headers were received. For cached
31 // responses, this time could be "far" in the past.
32 base::Time response_time
;
34 // The response headers or NULL if the URL type does not support headers.
35 scoped_refptr
<net::HttpResponseHeaders
> headers
;
37 // The mime type of the response. This may be a derived value.
38 std::string mime_type
;
40 // The character encoding of the response or none if not applicable to the
41 // response's mime type. This may be a derived value.
44 // An opaque string carrying security information pertaining to this
45 // response. This may include information about the SSL connection used.
46 std::string security_info
;
48 // Content length if available. -1 if not available
51 // Length of the encoded data transferred over the network. In case there is
52 // no data, contains -1.
53 int64 encoded_data_length
;
55 // The appcache this response was loaded from, or kNoCacheId.
58 // The manifest url of the appcache this response was loaded from.
59 // Note: this value is only populated for main resource requests.
60 GURL appcache_manifest_url
;
62 // Detailed timing information used by the WebTiming, HAR and Developer
63 // Tools. Includes socket ID and socket reuse information.
64 net::LoadTimingInfo load_timing
;
66 // Actual request and response headers, as obtained from the network stack.
67 // Only present if request had LOAD_REPORT_RAW_HEADERS in load_flags, and
68 // requesting renderer had CanReadRowCookies permission.
69 scoped_refptr
<ResourceDevToolsInfo
> devtools_info
;
71 // The path to a file that will contain the response body. It may only
72 // contain a portion of the response body at the time that the ResponseInfo
74 base::FilePath download_file_path
;
76 // True if the response was delivered using SPDY.
77 bool was_fetched_via_spdy
;
79 // True if the response was delivered after NPN is negotiated.
80 bool was_npn_negotiated
;
82 // True if response could use alternate protocol. However, browser will
83 // ignore the alternate protocol when spdy is not enabled on browser side.
84 bool was_alternate_protocol_available
;
86 // Information about the type of connection used to fetch this response.
87 net::HttpResponseInfo::ConnectionInfo connection_info
;
89 // True if the response was fetched via an explicit proxy (as opposed to a
90 // transparent proxy). The proxy could be any type of proxy, HTTP or SOCKS.
91 // Note: we cannot tell if a transparent proxy may have been involved.
92 bool was_fetched_via_proxy
;
94 // NPN protocol negotiated with the server.
95 std::string npn_negotiated_protocol
;
97 // Remote address of the socket which fetched this resource.
98 net::HostPortPair socket_address
;
101 } // namespace webkit_glue
103 #endif // WEBKIT_COMMON_RESOURCE_RESPONSE_INFO_H_