summaryrefslogtreecommitdiff
path: root/src/org/chromium/support_lib_boundary/WebMessagePayloadBoundaryInterface.java
blob: 4635438c1aa65cdbd2539212d73b246a10720dab (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
34
// 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;
    }
}