proxy_config_with_annotation.h 1.3 KB

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