chromium/mojo/public/cpp/bindings/tests/pickled_types_blink.h

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

#ifndef MOJO_PUBLIC_CPP_BINDINGS_TESTS_PICKLED_TYPES_BLINK_H_
#define MOJO_PUBLIC_CPP_BINDINGS_TESTS_PICKLED_TYPES_BLINK_H_

#include <stddef.h>

#include <string>

#include "base/check_op.h"
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_param_traits.h"

namespace base {
class Pickle;
class PickleIterator;
}

namespace mojo {
namespace test {

// Implementation of types with IPC::ParamTraits for consumers in Blink.

enum class PickledEnumBlink {};

// To make things slightly more interesting, this variation of the type doesn't
// support negative values. It'll DCHECK if you try to construct it with any,
// and it will fail deserialization if negative values are decoded.
class PickledStructBlink {};

}  // namespace test
}  // namespace mojo

namespace IPC {

template <>
struct ParamTraits<mojo::test::PickledStructBlink> {};

}  // namespace IPC

IPC_ENUM_TRAITS_MAX_VALUE(mojo::test::PickledEnumBlink,
                          mojo::test::PickledEnumBlink::VALUE_1)

#endif  // MOJO_PUBLIC_CPP_BINDINGS_TESTS_PICKLED_TYPES_BLINK_H_