// services/device/public/mojom/geolocation_client_id.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/device/public/mojom/geolocation_client_id.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/device/public/mojom/geolocation_client_id.mojom-params-data.h"
namespace device {
namespace mojom {

NOINLINE static const char* GeolocationClientIdToStringHelper(GeolocationClientId value) {
  // Defined in a helper function to ensure that Clang generates a lookup table.
  switch(value) {
    case GeolocationClientId::kForTesting:
      return "kForTesting";
    case GeolocationClientId::kGeolocationServiceImpl:
      return "kGeolocationServiceImpl";
    case GeolocationClientId::kGeoLanguageProvider:
      return "kGeoLanguageProvider";
    case GeolocationClientId::kFingerprintDataLoader:
      return "kFingerprintDataLoader";
    case GeolocationClientId::kOmnibox:
      return "kOmnibox";
    default:
      return nullptr;
  }
}

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

std::ostream& operator<<(std::ostream& os, GeolocationClientId value) {
  return os << GeolocationClientIdToString(value);
}

namespace internal {

}  // namespace internal
}  // namespace mojom
}  // namespace device

namespace perfetto {

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

} // namespace perfetto