naiveproxy/mojo/public/mojom/base/values.mojom
2018-08-14 22:19:20 +00:00

39 lines
1.2 KiB
Plaintext

// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module mojo_base.mojom;
// Value represents a value that can be serialized to/from JSON.
//
// One notable caveat is that Value supports arbitrary binary data, which JSON
// does not support natively.
union Value {
// Null type placeholder. This field is never used.
uint8 null_value;
// Primitive types.
bool bool_value;
int32 int_value;
double double_value;
// Unicode string.
string string_value;
// Binary blob with arbitrary bytes. Not supported for JSON.
array<uint8> binary_value;
// Basic container support for lists and maps.
DictionaryValue dictionary_value;
ListValue list_value;
};
// Interfaces that only want to handle a value of dictionary or list type
// should use base.mojom.DictionaryValue or base.mojom.ListValue in the method
// declaration. Though both of these types are mapped to base::Value in C++,
// the generated deserialization will guarantee that the method is only invoked
// with a base::Value of the correct subtype.
struct DictionaryValue {
map<string, Value> storage;
};
struct ListValue {
array<Value> storage;
};