1 // Copyright (c) 2018 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 NET_PROXY_RESOLUTION_PROXY_CONFIG_WITH_ANNOTATION_H_
6 #define NET_PROXY_RESOLUTION_PROXY_CONFIG_WITH_ANNOTATION_H_
7 
8 #include "net/base/net_export.h"
9 #include "net/proxy_resolution/proxy_config.h"
10 #include "net/traffic_annotation/network_traffic_annotation.h"
11 
12 namespace net {
13 
14 // ProxyConfigWithAnnotation encapsulates a ProxyConfig with the network traffic
15 // annotation that specifies the source of proxy config.
16 class NET_EXPORT ProxyConfigWithAnnotation {
17  public:
18   // Creates a Direct proxy config.
19   ProxyConfigWithAnnotation();
20 
21   ProxyConfigWithAnnotation(
22       const ProxyConfig& proxy_config,
23       const NetworkTrafficAnnotationTag& traffic_annotation);
24 
CreateDirect()25   static ProxyConfigWithAnnotation CreateDirect() {
26     return ProxyConfigWithAnnotation();
27   }
28 
traffic_annotation()29   NetworkTrafficAnnotationTag traffic_annotation() const {
30     return NetworkTrafficAnnotationTag(traffic_annotation_);
31   }
32 
value()33   const ProxyConfig& value() const { return value_; }
34 
35  private:
36   ProxyConfig value_;
37   MutableNetworkTrafficAnnotationTag traffic_annotation_;
38 };
39 
40 }  // namespace net
41 
42 #endif  // NET_PROXY_RESOLUTION_PROXY_CONFIG_WITH_ANNOTATION_H_
43