Re-subimission of https://codereview.chromium.org/1041213003/
[chromium-blink-merge.git] / content / child / weburlresponse_extradata_impl.h
blob719b0693c4c05d9e124ec2cf272f3e0df13e1c09
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_CHILD_WEBURLRESPONSE_EXTRADATA_IMPL_H_
6 #define CONTENT_CHILD_WEBURLRESPONSE_EXTRADATA_IMPL_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "content/common/content_export.h"
13 #include "net/http/http_response_info.h"
14 #include "third_party/WebKit/public/platform/WebURLResponse.h"
16 namespace content {
18 class CONTENT_EXPORT WebURLResponseExtraDataImpl :
19 public NON_EXPORTED_BASE(blink::WebURLResponse::ExtraData) {
20 public:
21 explicit WebURLResponseExtraDataImpl(
22 const std::string& npn_negotiated_protocol);
23 virtual ~WebURLResponseExtraDataImpl();
25 const std::string& npn_negotiated_protocol() const {
26 return npn_negotiated_protocol_;
29 // Flag whether this request was loaded via an explicit proxy
30 // (HTTP, SOCKS, etc).
31 bool was_fetched_via_proxy() const {
32 return was_fetched_via_proxy_;
34 void set_was_fetched_via_proxy(bool was_fetched_via_proxy) {
35 was_fetched_via_proxy_ = was_fetched_via_proxy;
38 // The proxy server used if this request was loaded via an explicit proxy
39 // (HTTP, SOCKS, etc).
40 net::HostPortPair proxy_server() const {
41 return proxy_server_;
43 void set_proxy_server(net::HostPortPair proxy_server) {
44 proxy_server_ = proxy_server;
47 /// Flag whether this request was loaded via the SPDY protocol or not.
48 // SPDY is an experimental web protocol, see http://dev.chromium.org/spdy
49 bool was_fetched_via_spdy() const {
50 return was_fetched_via_spdy_;
52 void set_was_fetched_via_spdy(bool was_fetched_via_spdy) {
53 was_fetched_via_spdy_ = was_fetched_via_spdy;
56 // Information about the type of connection used to fetch this response.
57 net::HttpResponseInfo::ConnectionInfo connection_info() const {
58 return connection_info_;
60 void set_connection_info(
61 net::HttpResponseInfo::ConnectionInfo connection_info) {
62 connection_info_ = connection_info;
65 // Flag whether this request was loaded after the
66 // TLS/Next-Protocol-Negotiation was used.
67 // This is related to SPDY.
68 bool was_npn_negotiated() const {
69 return was_npn_negotiated_;
71 void set_was_npn_negotiated(bool was_npn_negotiated) {
72 was_npn_negotiated_ = was_npn_negotiated;
75 // Flag whether this request was made when "Alternate-Protocol: xxx"
76 // is present in server's response.
77 bool was_alternate_protocol_available() const {
78 return was_alternate_protocol_available_;
80 void set_was_alternate_protocol_available(
81 bool was_alternate_protocol_available) {
82 was_alternate_protocol_available_ = was_alternate_protocol_available;
85 bool is_ftp_directory_listing() const { return is_ftp_directory_listing_; }
86 void set_is_ftp_directory_listing(bool is_ftp_directory_listing) {
87 is_ftp_directory_listing_ = is_ftp_directory_listing;
90 private:
91 std::string npn_negotiated_protocol_;
92 bool is_ftp_directory_listing_;
93 bool was_fetched_via_proxy_;
94 net::HostPortPair proxy_server_;
95 bool was_fetched_via_spdy_;
96 bool was_npn_negotiated_;
97 net::HttpResponseInfo::ConnectionInfo connection_info_;
98 bool was_alternate_protocol_available_;
100 DISALLOW_COPY_AND_ASSIGN(WebURLResponseExtraDataImpl);
103 } // namespace content
105 #endif // CONTENT_CHILD_WEBURLRESPONSE_EXTRADATA_IMPL_H_