// services/network/public/mojom/http_raw_request_response_info.mojom.cc is auto generated by mojom_bindings_generator.py, do not edit

// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-private-field"
#endif

#include "services/network/public/mojom/http_raw_request_response_info.mojom.h"

#include <math.h>
#include <stdint.h>
#include <utility>

#include "base/hash/md5_constexpr.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/common/task_annotator.h"
#include "base/trace_event/trace_conversion_helper.h"
#include "base/trace_event/traced_value.h"
#include "mojo/public/cpp/bindings/lib/generated_code_util.h"
#include "mojo/public/cpp/bindings/lib/message_internal.h"
#include "mojo/public/cpp/bindings/lib/serialization_util.h"
#include "mojo/public/cpp/bindings/lib/unserialized_message_context.h"
#include "mojo/public/cpp/bindings/lib/validate_params.h"
#include "mojo/public/cpp/bindings/lib/validation_context.h"
#include "mojo/public/cpp/bindings/lib/validation_errors.h"
#include "mojo/public/interfaces/bindings/interface_control_messages.mojom.h"

#include "services/network/public/mojom/http_raw_request_response_info.mojom-params-data.h"
#include "services/network/public/mojom/http_raw_request_response_info.mojom-shared-message-ids.h"

#include "services/network/public/mojom/http_raw_request_response_info.mojom-import-headers.h"


#ifndef SERVICES_NETWORK_PUBLIC_MOJOM_HTTP_RAW_REQUEST_RESPONSE_INFO_MOJOM_JUMBO_H_
#define SERVICES_NETWORK_PUBLIC_MOJOM_HTTP_RAW_REQUEST_RESPONSE_INFO_MOJOM_JUMBO_H_
#endif
namespace network {
namespace mojom {
HttpRawRequestResponseInfo::HttpRawRequestResponseInfo()
    : http_status_code(),
      http_status_text(),
      request_headers(),
      response_headers(),
      request_headers_text(),
      response_headers_text() {}

HttpRawRequestResponseInfo::HttpRawRequestResponseInfo(
    int32_t http_status_code_in,
    const std::string& http_status_text_in,
    std::vector<::network::mojom::HttpRawHeaderPairPtr> request_headers_in,
    std::vector<::network::mojom::HttpRawHeaderPairPtr> response_headers_in,
    const std::string& request_headers_text_in,
    const std::string& response_headers_text_in)
    : http_status_code(std::move(http_status_code_in)),
      http_status_text(std::move(http_status_text_in)),
      request_headers(std::move(request_headers_in)),
      response_headers(std::move(response_headers_in)),
      request_headers_text(std::move(request_headers_text_in)),
      response_headers_text(std::move(response_headers_text_in)) {}

HttpRawRequestResponseInfo::~HttpRawRequestResponseInfo() = default;

void HttpRawRequestResponseInfo::AsValueInto(base::trace_event::TracedValue* value) const {
  value->SetInteger("http_status_code", this->http_status_code);
  value->SetString("http_status_text", this->http_status_text);
  value->BeginArray("request_headers");
  for (const auto& item0 : this->request_headers) {
    if (item0.is_null()) {
      value->AppendString("nullptr");
    } else {
      value->BeginDictionary();
      item0->AsValueInto(value);
      value->EndDictionary();
    }
  }
  value->EndArray();
  value->BeginArray("response_headers");
  for (const auto& item0 : this->response_headers) {
    if (item0.is_null()) {
      value->AppendString("nullptr");
    } else {
      value->BeginDictionary();
      item0->AsValueInto(value);
      value->EndDictionary();
    }
  }
  value->EndArray();
  value->SetString("request_headers_text", this->request_headers_text);
  value->SetString("response_headers_text", this->response_headers_text);
}

bool HttpRawRequestResponseInfo::Validate(
    const void* data,
    mojo::internal::ValidationContext* validation_context) {
  return Data_::Validate(data, validation_context);
}
}  // namespace mojom
}  // namespace network

namespace mojo {


// static
bool StructTraits<::network::mojom::HttpRawRequestResponseInfo::DataView, ::network::mojom::HttpRawRequestResponseInfoPtr>::Read(
    ::network::mojom::HttpRawRequestResponseInfo::DataView input,
    ::network::mojom::HttpRawRequestResponseInfoPtr* output) {
  bool success = true;
  ::network::mojom::HttpRawRequestResponseInfoPtr result(::network::mojom::HttpRawRequestResponseInfo::New());
  
      if (success)
        result->http_status_code = input.http_status_code();
      if (success && !input.ReadHttpStatusText(&result->http_status_text))
        success = false;
      if (success && !input.ReadRequestHeaders(&result->request_headers))
        success = false;
      if (success && !input.ReadResponseHeaders(&result->response_headers))
        success = false;
      if (success && !input.ReadRequestHeadersText(&result->request_headers_text))
        success = false;
      if (success && !input.ReadResponseHeadersText(&result->response_headers_text))
        success = false;
  *output = std::move(result);
  return success;
}

}  // namespace mojo

#if defined(__clang__)
#pragma clang diagnostic pop
#endif