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.
5 #ifndef CONTENT_PUBLIC_COMMON_RESOURCE_RESPONSE_INFO_H_
6 #define CONTENT_PUBLIC_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 "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"
23 struct ResourceResponseInfo {
24 CONTENT_EXPORT ResourceResponseInfo();
25 CONTENT_EXPORT ~ResourceResponseInfo();
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;
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;
35 // The response headers or NULL if the URL type does not support headers.
36 scoped_refptr<net::HttpResponseHeaders> headers;
38 // The mime type of the response. This may be a derived value.
39 std::string mime_type;
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.
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;
49 // Content length if available. -1 if not available
52 // Length of the encoded data transferred over the network. In case there is
53 // no data, contains -1.
54 int64 encoded_data_length;
56 // The appcache this response was loaded from, or kAppCacheNoCacheId.
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;
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;
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;
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
75 base::FilePath download_file_path;
77 // True if the response was delivered using SPDY.
78 bool was_fetched_via_spdy;
80 // True if the response was delivered after NPN is negotiated.
81 bool was_npn_negotiated;
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;
87 // Information about the type of connection used to fetch this response.
88 net::HttpResponseInfo::ConnectionInfo connection_info;
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;
95 // NPN protocol negotiated with the server.
96 std::string npn_negotiated_protocol;
98 // Remote address of the socket which fetched this resource.
99 net::HostPortPair socket_address;
101 // True if the response was fetched by a ServiceWorker.
102 bool was_fetched_via_service_worker;
104 // The original URL of the response which was fetched by the ServiceWorker.
105 // This may be empty if the response was created inside the ServiceWorker.
106 GURL original_url_via_service_worker;
108 // ServiceWorker Timing Information. These will be set if the response is
109 // provided by the ServiceWorker, or kept empty.
110 base::TimeTicks service_worker_fetch_start;
111 base::TimeTicks service_worker_fetch_ready;
112 base::TimeTicks service_worker_fetch_end;
115 } // namespace content
117 #endif // CONTENT_PUBLIC_COMMON_RESOURCE_RESPONSE_INFO_H_