protobuf_http_request_config.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright 2020 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 REMOTING_BASE_PROTOBUF_HTTP_REQUEST_CONFIG_H_
  5. #define REMOTING_BASE_PROTOBUF_HTTP_REQUEST_CONFIG_H_
  6. #include <memory>
  7. #include <string>
  8. #include "net/traffic_annotation/network_traffic_annotation.h"
  9. namespace google {
  10. namespace protobuf {
  11. class MessageLite;
  12. } // namespace protobuf
  13. } // namespace google
  14. namespace remoting {
  15. // Common configurations for unary and stream protobuf http requests. Caller
  16. // needs to set all fields in this struct unless otherwise documented.
  17. struct ProtobufHttpRequestConfig {
  18. explicit ProtobufHttpRequestConfig(
  19. const net::NetworkTrafficAnnotationTag& traffic_annotation);
  20. ~ProtobufHttpRequestConfig();
  21. // Runs DCHECK's on the fields to make sure all fields have been set up.
  22. void Validate() const;
  23. const net::NetworkTrafficAnnotationTag traffic_annotation;
  24. std::unique_ptr<google::protobuf::MessageLite> request_message;
  25. std::string path;
  26. bool authenticated = true;
  27. // Optional. Only needed when the request requires an API key.
  28. std::string api_key;
  29. };
  30. } // namespace remoting
  31. #endif // REMOTING_BASE_PROTOBUF_HTTP_REQUEST_CONFIG_H_