// components/ntp_tiles/tile_source.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 "components/ntp_tiles/tile_source.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 "components/ntp_tiles/tile_source.mojom-params-data.h"
namespace ntp_tiles {
namespace mojom {

NOINLINE static const char* TileSourceToStringHelper(TileSource value) {
  // Defined in a helper function to ensure that Clang generates a lookup table.
  switch(value) {
    case TileSource::TOP_SITES:
      return "TOP_SITES";
    case TileSource::POPULAR:
      return "POPULAR";
    case TileSource::POPULAR_BAKED_IN:
      return "POPULAR_BAKED_IN";
    case TileSource::CUSTOM_LINKS:
      return "CUSTOM_LINKS";
    case TileSource::ALLOWLIST:
      return "ALLOWLIST";
    case TileSource::HOMEPAGE:
      return "HOMEPAGE";
    case TileSource::ENTERPRISE_SHORTCUTS:
      return "ENTERPRISE_SHORTCUTS";
    default:
      return nullptr;
  }
}

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

std::ostream& operator<<(std::ostream& os, TileSource value) {
  return os << TileSourceToString(value);
}

namespace internal {

}  // namespace internal
}  // namespace mojom
}  // namespace ntp_tiles

namespace perfetto {

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

} // namespace perfetto