summaryrefslogtreecommitdiff
path: root/src/org/chromium/support_lib_boundary/WebMessagePayloadBoundaryInterface.java
blob: 1b3061f284e5dce2ffb1d6b43c56e2e4dbb6763e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.support_lib_boundary;

import androidx.annotation.IntDef;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

/** Boundary interface for WebMessagePayload. */
public interface WebMessagePayloadBoundaryInterface extends FeatureFlagHolderBoundaryInterface {
    @WebMessagePayloadType
    int getType();

    @Nullable
    String getAsString();

    @NonNull
    byte[] getAsArrayBuffer();

    @Retention(RetentionPolicy.SOURCE)
    @IntDef(
            flag = true,
            value = {WebMessagePayloadType.TYPE_STRING, WebMessagePayloadType.TYPE_ARRAY_BUFFER})
    @interface WebMessagePayloadType {
        int TYPE_STRING = 0;
        int TYPE_ARRAY_BUFFER = 1;
    }
}