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

NOINLINE static const char* WebSandboxFlagsToStringHelper(WebSandboxFlags value) {
  // Defined in a helper function to ensure that Clang generates a lookup table.
  switch(value) {
    case WebSandboxFlags::kAll:
      return "kAll";
    case WebSandboxFlags::kNone:
      return "kNone";
    case WebSandboxFlags::kNavigation:
      return "kNavigation";
    case WebSandboxFlags::kPlugins:
      return "kPlugins";
    case WebSandboxFlags::kOrigin:
      return "kOrigin";
    case WebSandboxFlags::kForms:
      return "kForms";
    case WebSandboxFlags::kScripts:
      return "kScripts";
    case WebSandboxFlags::kTopNavigation:
      return "kTopNavigation";
    case WebSandboxFlags::kPopups:
      return "kPopups";
    case WebSandboxFlags::kAutomaticFeatures:
      return "kAutomaticFeatures";
    case WebSandboxFlags::kPointerLock:
      return "kPointerLock";
    case WebSandboxFlags::kDocumentDomain:
      return "kDocumentDomain";
    case WebSandboxFlags::kOrientationLock:
      return "kOrientationLock";
    case WebSandboxFlags::kPropagatesToAuxiliaryBrowsingContexts:
      return "kPropagatesToAuxiliaryBrowsingContexts";
    case WebSandboxFlags::kModals:
      return "kModals";
    case WebSandboxFlags::kPresentationController:
      return "kPresentationController";
    case WebSandboxFlags::kTopNavigationByUserActivation:
      return "kTopNavigationByUserActivation";
    case WebSandboxFlags::kDownloads:
      return "kDownloads";
    case WebSandboxFlags::kStorageAccessByUserActivation:
      return "kStorageAccessByUserActivation";
    case WebSandboxFlags::kTopNavigationToCustomProtocols:
      return "kTopNavigationToCustomProtocols";
    case WebSandboxFlags::kAllowSameSiteNoneCookies:
      return "kAllowSameSiteNoneCookies";
    default:
      return nullptr;
  }
}

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

std::ostream& operator<<(std::ostream& os, WebSandboxFlags value) {
  return os << WebSandboxFlagsToString(value);
}

namespace internal {

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

namespace perfetto {

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

} // namespace perfetto