Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / content / public / common / resource_response_info.h
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_headers.h"
19 #include "net/http/http_response_info.h"
20 #include "third_party/WebKit/public/platform/WebServiceWorkerResponseType.h"
21 #include "url/gurl.h"
22
23 namespace content {
24
25 // Note: when modifying this structure, also update ResourceResponse::DeepCopy
26 // in resource_response.cc.
27 struct ResourceResponseInfo {
28   CONTENT_EXPORT ResourceResponseInfo();
29   CONTENT_EXPORT ~ResourceResponseInfo();
30
31   // The time at which the request was made that resulted in this response.
32   // For cached responses, this time could be "far" in the past.
33   base::Time request_time;
34
35   // The time at which the response headers were received.  For cached
36   // responses, this time could be "far" in the past.
37   base::Time response_time;
38
39   // The response headers or NULL if the URL type does not support headers.
40   scoped_refptr<net::HttpResponseHeaders> headers;
41
42   // The mime type of the response.  This may be a derived value.
43   std::string mime_type;
44
45   // The character encoding of the response or none if not applicable to the
46   // response's mime type.  This may be a derived value.
47   std::string charset;
48
49   // An opaque string carrying security information pertaining to this
50   // response.  This may include information about the SSL connection used.
51   std::string security_info;
52
53   // Content length if available. -1 if not available
54   int64 content_length;
55
56   // Length of the encoded data transferred over the network. In case there is
57   // no data, contains -1.
58   int64 encoded_data_length;
59
60   // The appcache this response was loaded from, or kAppCacheNoCacheId.
61   int64 appcache_id;
62
63   // The manifest url of the appcache this response was loaded from.
64   // Note: this value is only populated for main resource requests.
65   GURL appcache_manifest_url;
66
67   // Detailed timing information used by the WebTiming, HAR and Developer
68   // Tools.  Includes socket ID and socket reuse information.
69   net::LoadTimingInfo load_timing;
70
71   // Actual request and response headers, as obtained from the network stack.
72   // Only present if request had LOAD_REPORT_RAW_HEADERS in load_flags, and
73   // requesting renderer had CanReadRowCookies permission.
74   scoped_refptr<ResourceDevToolsInfo> devtools_info;
75
76   // The path to a file that will contain the response body.  It may only
77   // contain a portion of the response body at the time that the ResponseInfo
78   // becomes available.
79   base::FilePath download_file_path;
80
81   // True if the response was delivered using SPDY.
82   bool was_fetched_via_spdy;
83
84   // True if the response was delivered after NPN is negotiated.
85   bool was_npn_negotiated;
86
87   // True if response could use alternate protocol. However, browser will
88   // ignore the alternate protocol when spdy is not enabled on browser side.
89   bool was_alternate_protocol_available;
90
91   // Information about the type of connection used to fetch this response.
92   net::HttpResponseInfo::ConnectionInfo connection_info;
93
94   // True if the response was fetched via an explicit proxy (as opposed to a
95   // transparent proxy). The proxy could be any type of proxy, HTTP or SOCKS.
96   // Note: we cannot tell if a transparent proxy may have been involved. If
97   // true, |proxy_server| contains the name of the proxy server that was used.
98   bool was_fetched_via_proxy;
99   net::HostPortPair proxy_server;
100
101   // NPN protocol negotiated with the server.
102   std::string npn_negotiated_protocol;
103
104   // Remote address of the socket which fetched this resource.
105   net::HostPortPair socket_address;
106
107   // True if the response was fetched by a ServiceWorker.
108   bool was_fetched_via_service_worker;
109
110   // True when the request whoes mode is |CORS| or |CORS-with-forced-preflight|
111   // is sent to a ServiceWorker but FetchEvent.respondWith is not called. So the
112   // renderer have to resend the request with skip service worker flag
113   // considering the CORS preflight logic.
114   bool was_fallback_required_by_service_worker;
115
116   // The original URL of the response which was fetched by the ServiceWorker.
117   // This may be empty if the response was created inside the ServiceWorker.
118   GURL original_url_via_service_worker;
119
120   // The type of the response which was fetched by the ServiceWorker.
121   blink::WebServiceWorkerResponseType response_type_via_service_worker;
122
123   // ServiceWorker Timing Information. These will be set if the response is
124   // provided by the ServiceWorker, or kept empty.
125   base::TimeTicks service_worker_fetch_start;
126   base::TimeTicks service_worker_fetch_ready;
127   base::TimeTicks service_worker_fetch_end;
128 };
129
130 }  // namespace content
131
132 #endif  // CONTENT_PUBLIC_COMMON_RESOURCE_RESPONSE_INFO_H_