2
|
1 |
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
|
|
2 |
// Use of this source code is governed by a BSD-style license that can be
|
|
3 |
// found in the LICENSE file.
|
|
4 |
|
|
5 |
package org.chromium.sdk.internal.protocol;
|
|
6 |
|
|
7 |
import java.util.EnumSet;
|
|
8 |
import java.util.List;
|
|
9 |
|
|
10 |
import org.chromium.sdk.internal.protocol.data.SomeHandle;
|
|
11 |
import org.chromium.sdk.internal.protocolparser.EnumValueCondition;
|
|
12 |
import org.chromium.sdk.internal.protocolparser.JsonObjectBased;
|
|
13 |
import org.chromium.sdk.internal.protocolparser.JsonOptionalField;
|
|
14 |
import org.chromium.sdk.internal.protocolparser.JsonOverrideField;
|
|
15 |
import org.chromium.sdk.internal.protocolparser.JsonSubtype;
|
|
16 |
import org.chromium.sdk.internal.protocolparser.JsonSubtypeConditionCustom;
|
|
17 |
import org.chromium.sdk.internal.protocolparser.JsonType;
|
|
18 |
import org.json.simple.JSONObject;
|
|
19 |
|
|
20 |
/**
|
|
21 |
* A type for event notification message. Its structure is similar
|
|
22 |
* to {@link SuccessCommandResponse}.
|
|
23 |
*/
|
|
24 |
@JsonType
|
|
25 |
public interface EventNotification extends JsonObjectBased, JsonSubtype<IncomingMessage> {
|
|
26 |
@JsonOverrideField
|
|
27 |
@JsonSubtypeConditionCustom(condition=TypeValueCondition.class)
|
|
28 |
MessageType getType();
|
|
29 |
|
|
30 |
class TypeValueCondition extends EnumValueCondition<MessageType> {
|
|
31 |
public TypeValueCondition() {
|
|
32 |
super(EnumSet.of(MessageType.event));
|
|
33 |
}
|
|
34 |
}
|
|
35 |
|
|
36 |
String getEvent();
|
|
37 |
|
|
38 |
EventNotificationBody getBody();
|
|
39 |
|
|
40 |
// TODO(peter.rybin): does this field really exist?
|
|
41 |
@JsonOptionalField
|
|
42 |
JSONObject getException();
|
|
43 |
|
|
44 |
@JsonOptionalField
|
|
45 |
List<SomeHandle> getRefs();
|
|
46 |
}
|