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

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

#include "services/network/public/mojom/shared_dictionary_error.mojom-shared.h"
#include <ostream>
#include <utility>
#include "base/strings/stringprintf.h"
#include "mojo/public/cpp/bindings/lib/validate_params.h"
#include "mojo/public/cpp/bindings/lib/validation_errors.h"
#include "mojo/public/cpp/bindings/lib/validation_util.h"
#include "third_party/perfetto/include/perfetto/tracing/traced_value.h"

#include "services/network/public/mojom/shared_dictionary_error.mojom-params-data.h"
namespace network {
namespace mojom {

NOINLINE static const char* SharedDictionaryErrorToStringHelper(SharedDictionaryError value) {
  // Defined in a helper function to ensure that Clang generates a lookup table.
  switch(value) {
    case SharedDictionaryError::kUseErrorDictionaryLoadFailure:
      return "kUseErrorDictionaryLoadFailure";
    case SharedDictionaryError::kUseErrorMatchingDictionaryNotUsed:
      return "kUseErrorMatchingDictionaryNotUsed";
    case SharedDictionaryError::kUseErrorUnexpectedContentDictionaryHeader:
      return "kUseErrorUnexpectedContentDictionaryHeader";
    case SharedDictionaryError::kWriteErrorAlreadyRegistered:
      return "kWriteErrorAlreadyRegistered";
    case SharedDictionaryError::kWriteErrorCossOriginNoCorsRequest:
      return "kWriteErrorCossOriginNoCorsRequest";
    case SharedDictionaryError::kWriteErrorDisallowedBySettings:
      return "kWriteErrorDisallowedBySettings";
    case SharedDictionaryError::kWriteErrorExpiredResponse:
      return "kWriteErrorExpiredResponse";
    case SharedDictionaryError::kWriteErrorFeatureDisabled:
      return "kWriteErrorFeatureDisabled";
    case SharedDictionaryError::kWriteErrorInsufficientResources:
      return "kWriteErrorInsufficientResources";
    case SharedDictionaryError::kWriteErrorInvalidMatchField:
      return "kWriteErrorInvalidMatchField";
    case SharedDictionaryError::kWriteErrorInvalidStructuredHeader:
      return "kWriteErrorInvalidStructuredHeader";
    case SharedDictionaryError::kWriteErrorInvalidTTLField:
      return "kWriteErrorInvalidTTLField";
    case SharedDictionaryError::kWriteErrorNavigationRequest:
      return "kWriteErrorNavigationRequest";
    case SharedDictionaryError::kWriteErrorNoMatchField:
      return "kWriteErrorNoMatchField";
    case SharedDictionaryError::kWriteErrorNonIntegerTTLField:
      return "kWriteErrorNonIntegerTTLField";
    case SharedDictionaryError::kWriteErrorNonListMatchDestField:
      return "kWriteErrorNonListMatchDestField";
    case SharedDictionaryError::kWriteErrorNonSecureContext:
      return "kWriteErrorNonSecureContext";
    case SharedDictionaryError::kWriteErrorNonStringIdField:
      return "kWriteErrorNonStringIdField";
    case SharedDictionaryError::kWriteErrorNonStringInMatchDestList:
      return "kWriteErrorNonStringInMatchDestList";
    case SharedDictionaryError::kWriteErrorInvalidMatchDestList:
      return "kWriteErrorInvalidMatchDestList";
    case SharedDictionaryError::kWriteErrorNonStringMatchField:
      return "kWriteErrorNonStringMatchField";
    case SharedDictionaryError::kWriteErrorNonTokenTypeField:
      return "kWriteErrorNonTokenTypeField";
    case SharedDictionaryError::kWriteErrorRequestAborted:
      return "kWriteErrorRequestAborted";
    case SharedDictionaryError::kWriteErrorShuttingDown:
      return "kWriteErrorShuttingDown";
    case SharedDictionaryError::kWriteErrorTooLongIdField:
      return "kWriteErrorTooLongIdField";
    case SharedDictionaryError::kWriteErrorUnsupportedType:
      return "kWriteErrorUnsupportedType";
    default:
      return nullptr;
  }
}

std::string SharedDictionaryErrorToString(SharedDictionaryError value) {
  const char *str = SharedDictionaryErrorToStringHelper(value);
  if (!str) {
    return base::StringPrintf("Unknown SharedDictionaryError value: %i", static_cast<int32_t>(value));
  }
  return str;
}

std::ostream& operator<<(std::ostream& os, SharedDictionaryError value) {
  return os << SharedDictionaryErrorToString(value);
}

namespace internal {

}  // namespace internal
}  // namespace mojom
}  // namespace network

namespace perfetto {

// static
void TraceFormatTraits<::network::mojom::SharedDictionaryError>::WriteIntoTrace(
   perfetto::TracedValue context, ::network::mojom::SharedDictionaryError value) {
  return std::move(context).WriteString(::network::mojom::SharedDictionaryErrorToString(value));
}

} // namespace perfetto