1 /* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef VALUE_CALLBACK_H 17 #define VALUE_CALLBACK_H 18 19 #include <string> 20 21 #include "nweb_export.h" 22 23 namespace OHOS::NWeb { 24 25 class NWebMessage; 26 class NWebWebStorageOrigin; 27 28 class OHOS_NWEB_EXPORT NWebBoolValueCallback { 29 public: 30 virtual ~NWebBoolValueCallback() = default; 31 32 virtual void OnReceiveValue(bool value) = 0; 33 }; 34 35 class OHOS_NWEB_EXPORT NWebLongValueCallback { 36 public: 37 virtual ~NWebLongValueCallback() = default; 38 39 virtual void OnReceiveValue(long value) = 0; 40 }; 41 42 class OHOS_NWEB_EXPORT NWebStringValueCallback { 43 public: 44 virtual ~NWebStringValueCallback() = default; 45 46 virtual void OnReceiveValue(const std::string& value) = 0; 47 }; 48 49 class OHOS_NWEB_EXPORT NWebStringVectorValueCallback { 50 public: 51 virtual ~NWebStringVectorValueCallback() = default; 52 53 virtual void OnReceiveValue(const std::vector<std::string>& value) = 0; 54 }; 55 56 class OHOS_NWEB_EXPORT NWebMessageValueCallback { 57 public: 58 virtual ~NWebMessageValueCallback() = default; 59 60 virtual void OnReceiveValue(std::shared_ptr<NWebMessage> value) = 0; 61 }; 62 63 class OHOS_NWEB_EXPORT NWebWebStorageOriginVectorValueCallback { 64 public: 65 virtual ~NWebWebStorageOriginVectorValueCallback() = default; 66 67 virtual void OnReceiveValue(const std::vector<std::shared_ptr<NWebWebStorageOrigin>>& value) = 0; 68 }; 69 70 class OHOS_NWEB_EXPORT NWebArrayBufferValueCallback { 71 public: 72 virtual ~NWebArrayBufferValueCallback() = default; 73 74 virtual void OnReceiveValue(const char* value, const long size) = 0; 75 }; 76 } // namespace OHOS::NWeb 77 78 #endif // NWebValueCallback