* Copyright (c) Huawei Device Co., Ltd. 2026-2026. All rights reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OHOS_OBJECT_EDITOR_COMMON_H
#define OHOS_OBJECT_EDITOR_COMMON_H
#include "content_embed_common.h"
namespace OHOS {
namespace ObjectEditor {
inline constexpr char OBJECT_EDITOR[] = "OBJECT_EDITOR";
enum class ExtensionStopReason {
UNKNOWN = 0,
SA_CLEAN_IDLE = 1,
PROXY_STOP = 2,
EXTENSION_TERMINATED = 3,
EXTENSION_EXCEPTION_EXIT = 4
};
inline ContentEmbed_ErrorCode ValidateErrorCode(int32_t value,
ContentEmbed_ErrorCode defaultValue = CE_ERR_EXTENSION_ERROR)
{
if (value == CE_ERR_OK || value == CE_PERMISSION_DENIED ||
value == CE_ERR_PARAM_INVALID || value == CE_ERR_DEVICE_NOT_SUPPORTED ||
(value >= CE_ERR_NULL_POINTER && value <= CE_ERR_EXTENSION_NOT_SUPPORT)) {
return static_cast<ContentEmbed_ErrorCode>(value);
}
return defaultValue;
}
}
}
#endif