From dca229ec9a69564985d182a16c9f2068db4d1989 Mon Sep 17 00:00:00 2001 From: yzshen Date: Wed, 27 Jan 2016 17:30:14 -0800 Subject: Mojo C++ bindings: support enum validation. By default, enums are not extensible, which means any unknown value will fail validation. If an enum may grow in the future, it needs to have [Extensible=True] attribute specified. In that case, the user code is responsible for handling unknown values properly. This CL doesn't add corresponding validation for JS or Java. BUG=404186 Review URL: https://codereview.chromium.org/1618963006 Cr-Commit-Position: refs/heads/master@{#371954} --- components/arc/common/ime.mojom | 1 + components/arc/common/net.mojom | 1 + components/arc/common/power.mojom | 1 + 3 files changed, 3 insertions(+) (limited to 'components') diff --git a/components/arc/common/ime.mojom b/components/arc/common/ime.mojom index 9722ddf..e1b314e 100644 --- a/components/arc/common/ime.mojom +++ b/components/arc/common/ime.mojom @@ -5,6 +5,7 @@ module arc; // Represents the type of text input field currently focused. +[Extensible=True] enum TextInputType { NONE, TEXT, diff --git a/components/arc/common/net.mojom b/components/arc/common/net.mojom index 0835c73..01de04e 100644 --- a/components/arc/common/net.mojom +++ b/components/arc/common/net.mojom @@ -4,6 +4,7 @@ module arc; +[Extensible=True] enum NetworkResult { SUCCESS = 0, FAILURE = 1, diff --git a/components/arc/common/power.mojom b/components/arc/common/power.mojom index b1cfbae..22792e2 100644 --- a/components/arc/common/power.mojom +++ b/components/arc/common/power.mojom @@ -6,6 +6,7 @@ module arc; // Enumerates the types of wake lock the ARC instance can request from the // host. +[Extensible=True] enum DisplayWakeLockType { // Does not allow the screen to dim, turn off, or lock; prevents // idle suspend. -- cgit v1.1