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 DELETE_CALLBACK_H 16 #define DELETE_CALLBACK_H 17 18 #include <string> 19 #include <uv.h> 20 21 #include "want.h" 22 #ifdef HAS_ACE_ENGINE_PART 23 #include "ui_content.h" 24 #endif 25 #include "medialibrary_client_errno.h" 26 27 namespace OHOS { 28 namespace Media { 29 const std::string DELETE_UI_PACKAGE_NAME = "com.ohos.photos"; 30 const std::string DELETE_UI_EXT_ABILITY_NAME = "DeleteUIExtensionAbility"; 31 const std::string DELETE_UI_EXTENSION_TYPE = "ability.want.params.uiExtensionType"; 32 const std::string DELETE_UI_REQUEST_TYPE = "sysDialog/common"; 33 const std::string DELETE_UI_APPNAME = "appName"; 34 const std::string DELETE_UI_URIS = "uris"; 35 const std::string RESULT = "result"; 36 const int32_t DELETE_CODE_SUCCESS = 0; 37 const int32_t DEFAULT_SESSION_ID = 0; 38 39 class DeleteCallback { 40 public: 41 #ifdef HAS_ACE_ENGINE_PART 42 explicit DeleteCallback(Ace::UIContent* uiContent); 43 #else 44 explicit DeleteCallback(); 45 #endif 46 void OnRelease(int32_t releaseCode); 47 void OnResult(int32_t resultCode, const OHOS::AAFwk::Want& result); 48 void OnReceive(const OHOS::AAFwk::WantParams& request); 49 void OnError(int32_t code, const std::string& name, const std::string& message); 50 void SetSessionId(int32_t sessionId); 51 void SetUris(std::vector<std::string> uris); 52 void SetFunc(); 53 54 private: 55 int32_t sessionId_ = DEFAULT_SESSION_ID; 56 int32_t resultCode_ = JS_ERR_PERMISSION_DENIED; 57 std::vector<std::string> uris_; 58 #ifdef HAS_ACE_ENGINE_PART 59 Ace::UIContent* uiContent = nullptr; 60 #endif 61 void SendMessageBack(); 62 void CloseModalUIExtension(); 63 }; 64 } // namespace Media 65 } // namespace OHOS 66 67 #endif