OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This class represents contextual information (cookies, cache, etc.) | 5 // This class represents contextual information (cookies, cache, etc.) |
6 // that's necessary when processing resource requests. | 6 // that's necessary when processing resource requests. |
7 | 7 |
8 #ifndef NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ | 8 #ifndef NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ |
9 #define NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ | 9 #define NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ |
10 | 10 |
11 #include <memory> | 11 #include <memory> |
12 #include <set> | 12 #include <set> |
13 #include <string> | 13 #include <string> |
14 | 14 |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
18 #include "base/threading/non_thread_safe.h" | 18 #include "base/threading/non_thread_safe.h" |
19 #include "base/trace_event/memory_dump_provider.h" | 19 #include "base/trace_event/memory_dump_provider.h" |
20 #include "net/base/net_export.h" | 20 #include "net/base/net_export.h" |
21 #include "net/base/request_priority.h" | 21 #include "net/base/request_priority.h" |
22 #include "net/http/http_network_session.h" | 22 #include "net/http/http_network_session.h" |
23 #include "net/http/http_server_properties.h" | 23 #include "net/http/http_server_properties.h" |
24 #include "net/http/transport_security_state.h" | 24 #include "net/http/transport_security_state.h" |
25 #include "net/ssl/ssl_config_service.h" | 25 #include "net/ssl/ssl_config_service.h" |
| 26 #include "net/traffic_annotation/network_traffic_annotation.h" |
26 #include "net/url_request/url_request.h" | 27 #include "net/url_request/url_request.h" |
27 | 28 |
28 namespace base { | 29 namespace base { |
29 namespace trace_event { | 30 namespace trace_event { |
30 class ProcessMemoryDump; | 31 class ProcessMemoryDump; |
31 } | 32 } |
32 } | 33 } |
33 | 34 |
34 namespace net { | 35 namespace net { |
35 class CertVerifier; | 36 class CertVerifier; |
(...skipping 28 matching lines...) Expand all Loading... |
64 URLRequestContext(); | 65 URLRequestContext(); |
65 ~URLRequestContext() override; | 66 ~URLRequestContext() override; |
66 | 67 |
67 // Copies the state from |other| into this context. | 68 // Copies the state from |other| into this context. |
68 void CopyFrom(const URLRequestContext* other); | 69 void CopyFrom(const URLRequestContext* other); |
69 | 70 |
70 // May return nullptr if this context doesn't have an associated network | 71 // May return nullptr if this context doesn't have an associated network |
71 // session. | 72 // session. |
72 const HttpNetworkSession::Params* GetNetworkSessionParams() const; | 73 const HttpNetworkSession::Params* GetNetworkSessionParams() const; |
73 | 74 |
| 75 // This function should not be used in Chromium, please use the version with |
| 76 // NetworkTrafficAnnotationTag in the future. |
74 std::unique_ptr<URLRequest> CreateRequest( | 77 std::unique_ptr<URLRequest> CreateRequest( |
75 const GURL& url, | 78 const GURL& url, |
76 RequestPriority priority, | 79 RequestPriority priority, |
77 URLRequest::Delegate* delegate) const; | 80 URLRequest::Delegate* delegate) const; |
78 | 81 |
79 NetLog* net_log() const { | 82 // |traffic_annotation| is metadata about the network traffic send via this |
80 return net_log_; | 83 // URLRequest, see net::DefineNetworkTrafficAnnotation. Note that: |
81 } | 84 // - net provides the API for tagging requests with an opaque identifier. |
| 85 // - tools/traffic_annotation/traffic_annotation.proto contains the Chrome |
| 86 // specific .proto describing the verbose annotation format that Chrome's |
| 87 // callsites are expected to follow. |
| 88 // - tools/traffic_annotation/ contains sample and template for annotation and |
| 89 // tools will be added for verification following crbug.com/690323. |
| 90 std::unique_ptr<URLRequest> CreateRequest( |
| 91 const GURL& url, |
| 92 RequestPriority priority, |
| 93 URLRequest::Delegate* delegate, |
| 94 NetworkTrafficAnnotationTag traffic_annotation) const; |
| 95 |
| 96 NetLog* net_log() const { return net_log_; } |
82 | 97 |
83 void set_net_log(NetLog* net_log) { | 98 void set_net_log(NetLog* net_log) { |
84 net_log_ = net_log; | 99 net_log_ = net_log; |
85 } | 100 } |
86 | 101 |
87 HostResolver* host_resolver() const { | 102 HostResolver* host_resolver() const { |
88 return host_resolver_; | 103 return host_resolver_; |
89 } | 104 } |
90 | 105 |
91 void set_host_resolver(HostResolver* host_resolver) { | 106 void set_host_resolver(HostResolver* host_resolver) { |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 // Used in MemoryDumpProvier to annotate memory usage. The name does not need | 317 // Used in MemoryDumpProvier to annotate memory usage. The name does not need |
303 // to be unique. | 318 // to be unique. |
304 std::string name_; | 319 std::string name_; |
305 | 320 |
306 DISALLOW_COPY_AND_ASSIGN(URLRequestContext); | 321 DISALLOW_COPY_AND_ASSIGN(URLRequestContext); |
307 }; | 322 }; |
308 | 323 |
309 } // namespace net | 324 } // namespace net |
310 | 325 |
311 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ | 326 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ |
OLD | NEW |