1 /* 2 * Copyright (C) 2024 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 #ifndef CONFIRM_CALLBACK_H 16 #define CONFIRM_CALLBACK_H 17 18 #include <string> 19 #include <vector> 20 #include <uv.h> 21 22 #include "cj_ffi/cj_common_ffi.h" 23 #include "want.h" 24 #ifdef HAS_ACE_ENGINE_PART 25 #include "ui_content.h" 26 #endif 27 #include "medialibrary_client_errno.h" 28 #include "photo_accesshelper_impl.h" 29 30 namespace OHOS { 31 namespace Media { 32 class ConfirmCallback { 33 public: 34 #ifdef HAS_ACE_ENGINE_PART 35 explicit ConfirmCallback(Ace::UIContent *uiContent, int64_t funcId); 36 #else 37 explicit ConfirmCallback(int64_t funcId); 38 #endif 39 virtual ~ConfirmCallback() = default; 40 void OnRelease(int32_t releaseCode); 41 void OnResult(int32_t resultCode, const OHOS::AAFwk::Want &want); 42 void OnReceive(const OHOS::AAFwk::WantParams &request); 43 void OnError(int32_t code, const std::string &name, const std::string &message); 44 void SetSessionId(int32_t sessionId); 45 46 private: 47 int32_t sessionId_ = 0; 48 int32_t resultCode_ = JS_ERR_PERMISSION_DENIED; 49 int64_t funcId; 50 RetDataCArrString retDataCArrString; 51 #ifdef HAS_ACE_ENGINE_PART 52 Ace::UIContent *uiContent = nullptr; 53 #endif 54 void SendMessageBack(const std::vector<std::string> &desFileUris); 55 void CloseModalUIExtension(); 56 }; 57 } 58 } 59 #endif