| // Copyright 2018 The Chromium Authors |
| // 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. |
| [Stable] |
| 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. |
| [Stable] |
| struct DictionaryValue { |
| map<string, Value> storage; |
| }; |
| |
| [Stable] |
| struct ListValue { |
| array<Value> storage; |
| }; |