// third_party/blink/public/mojom/manifest/display_mode.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 "third_party/blink/public/mojom/manifest/display_mode.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 "third_party/blink/public/mojom/manifest/display_mode.mojom-params-data.h"
namespace blink {
namespace mojom {

NOINLINE static const char* DisplayModeToStringHelper(DisplayMode value) {
  // Defined in a helper function to ensure that Clang generates a lookup table.
  switch(value) {
    case DisplayMode::kUndefined:
      return "kUndefined";
    case DisplayMode::kBrowser:
      return "kBrowser";
    case DisplayMode::kMinimalUi:
      return "kMinimalUi";
    case DisplayMode::kStandalone:
      return "kStandalone";
    case DisplayMode::kFullscreen:
      return "kFullscreen";
    case DisplayMode::kWindowControlsOverlay:
      return "kWindowControlsOverlay";
    case DisplayMode::kTabbed:
      return "kTabbed";
    case DisplayMode::kUnframed:
      return "kUnframed";
    case DisplayMode::kPictureInPicture:
      return "kPictureInPicture";
    default:
      return nullptr;
  }
}

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

std::ostream& operator<<(std::ostream& os, DisplayMode value) {
  return os << DisplayModeToString(value);
}

namespace internal {

}  // namespace internal
}  // namespace mojom
}  // namespace blink

namespace perfetto {

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

} // namespace perfetto