1 /* 2 * Copyright (c) 2021 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 FOUNDATION_APPEXECFWK_SERVICES_FORMMGR_INCLUDE_FORMMGR_FORM_HOST_CALLBACK_H 17 #define FOUNDATION_APPEXECFWK_SERVICES_FORMMGR_INCLUDE_FORMMGR_FORM_HOST_CALLBACK_H 18 19 #include <vector> 20 21 #include "form_js_info.h" 22 #include "form_record.h" 23 #include "ipc_types.h" 24 #include "iremote_object.h" 25 26 namespace OHOS { 27 namespace AppExecFwk { 28 /** 29 * @class FormHostCallback 30 * FormHost callback is used to call form host service. 31 */ 32 class FormHostCallback { 33 public: 34 FormHostCallback() = default; 35 virtual ~FormHostCallback() = default; 36 /** 37 * @brief Request to give back a Form. 38 * @param formId The Id of the forms to create. 39 * @param record Form info. 40 * @param callerToken Caller ability token. 41 * @return Returns ERR_OK on success, others on failure. 42 */ 43 void OnAcquired(const int64_t formId, const FormRecord &record, const sptr<IRemoteObject> &callerToken); 44 45 /** 46 * @brief Form is updated. 47 * @param formId The Id of the form to update. 48 * @param record Form info. 49 * @param callerToken Caller ability token. 50 * @return Returns ERR_OK on success, others on failure. 51 */ 52 void OnUpdate(const int64_t formId, const FormRecord &record, const sptr<IRemoteObject> &callerToken); 53 54 /** 55 * @brief Form provider is uninstalled. 56 * @param formIds The Id list of the forms. 57 * @param callerToken Caller ability token. 58 * @return Returns ERR_OK on success, others on failure. 59 */ 60 void OnUninstall(std::vector<int64_t> &formIds, const sptr<IRemoteObject> &callerToken); 61 }; 62 } // namespace AppExecFwk 63 } // namespace OHOS 64 65 #endif // FOUNDATION_APPEXECFWK_SERVICES_FORMMGR_INCLUDE_FORMMGR_FORM_HOST_CALLBACK_H 66