176fd607bSopenharmony_ci/* 276fd607bSopenharmony_ci * Copyright (C) 2024 Huawei Device Co., Ltd. 376fd607bSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 476fd607bSopenharmony_ci * you may not use this file except in compliance with the License. 576fd607bSopenharmony_ci * You may obtain a copy of the License at 676fd607bSopenharmony_ci * 776fd607bSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 876fd607bSopenharmony_ci * 976fd607bSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1076fd607bSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1176fd607bSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1276fd607bSopenharmony_ci * See the License for the specific language governing permissions and 1376fd607bSopenharmony_ci * limitations under the License. 1476fd607bSopenharmony_ci */ 1576fd607bSopenharmony_ci#ifndef INTERFACES_KITS_JS_MEDIALIBRARY_INCLUDE_CONFIRM_CALLBACK_H 1676fd607bSopenharmony_ci#define INTERFACES_KITS_JS_MEDIALIBRARY_INCLUDE_CONFIRM_CALLBACK_H 1776fd607bSopenharmony_ci 1876fd607bSopenharmony_ci#include <js_native_api.h> 1976fd607bSopenharmony_ci#include <napi/native_api.h> 2076fd607bSopenharmony_ci#include <node_api.h> 2176fd607bSopenharmony_ci#include <string> 2276fd607bSopenharmony_ci#include <vector> 2376fd607bSopenharmony_ci#include <uv.h> 2476fd607bSopenharmony_ci 2576fd607bSopenharmony_ci#include "want.h" 2676fd607bSopenharmony_ci#ifdef HAS_ACE_ENGINE_PART 2776fd607bSopenharmony_ci#include "ui_content.h" 2876fd607bSopenharmony_ci#endif 2976fd607bSopenharmony_ci#include "medialibrary_client_errno.h" 3076fd607bSopenharmony_ci 3176fd607bSopenharmony_cinamespace OHOS { 3276fd607bSopenharmony_cinamespace Media { 3376fd607bSopenharmony_cistruct PhotoCreationConfig { 3476fd607bSopenharmony_ci std::string title; 3576fd607bSopenharmony_ci std::string fileNameExtension; 3676fd607bSopenharmony_ci int32_t photoType; 3776fd607bSopenharmony_ci int32_t subtype; 3876fd607bSopenharmony_ci}; 3976fd607bSopenharmony_ci 4076fd607bSopenharmony_ciclass ConfirmCallback { 4176fd607bSopenharmony_cipublic: 4276fd607bSopenharmony_ci#ifdef HAS_ACE_ENGINE_PART 4376fd607bSopenharmony_ci explicit ConfirmCallback(napi_env env, Ace::UIContent *uiContent); 4476fd607bSopenharmony_ci#else 4576fd607bSopenharmony_ci explicit ConfirmCallback(napi_env env); 4676fd607bSopenharmony_ci#endif 4776fd607bSopenharmony_ci virtual ~ConfirmCallback() = default; 4876fd607bSopenharmony_ci void OnRelease(int32_t releaseCode); 4976fd607bSopenharmony_ci void OnResult(int32_t resultCode, const OHOS::AAFwk::Want &want); 5076fd607bSopenharmony_ci void OnReceive(const OHOS::AAFwk::WantParams &request); 5176fd607bSopenharmony_ci void OnError(int32_t code, const std::string &name, const std::string &message); 5276fd607bSopenharmony_ci void SetSessionId(int32_t sessionId); 5376fd607bSopenharmony_ci void SetUris(const std::vector<std::string> &uris); 5476fd607bSopenharmony_ci void SetFunc(napi_value func); 5576fd607bSopenharmony_ci 5676fd607bSopenharmony_ciprivate: 5776fd607bSopenharmony_ci int32_t sessionId_ = 0; 5876fd607bSopenharmony_ci int32_t resultCode_ = JS_ERR_PERMISSION_DENIED; 5976fd607bSopenharmony_ci napi_env env_ = nullptr; 6076fd607bSopenharmony_ci napi_ref callbackRef = nullptr; 6176fd607bSopenharmony_ci#ifdef HAS_ACE_ENGINE_PART 6276fd607bSopenharmony_ci Ace::UIContent *uiContent = nullptr; 6376fd607bSopenharmony_ci#endif 6476fd607bSopenharmony_ci 6576fd607bSopenharmony_ci void SendMessageBack(const std::vector<std::string> &desFileUris); 6676fd607bSopenharmony_ci void CloseModalUIExtension(); 6776fd607bSopenharmony_ci}; 6876fd607bSopenharmony_ci} 6976fd607bSopenharmony_ci} 7076fd607bSopenharmony_ci#endif 71