1 /*
2  * Copyright (c) 2023 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_ACE_INTERFACE_INNERKITS_FORM_RENDERER_DELEGATE_PROXY_H
17 #define FOUNDATION_ACE_INTERFACE_INNERKITS_FORM_RENDERER_DELEGATE_PROXY_H
18 
19 #include "form_renderer_delegate_interface.h"
20 #include "iremote_proxy.h"
21 
22 #include "base/utils/macros.h"
23 
24 namespace OHOS {
25 namespace Ace {
26 /**
27  * @class FormRendererDelegateProxy
28  * FormRendererDelegateProxy is used to access form renderer delegate.
29  */
30 class ACE_EXPORT FormRendererDelegateProxy : public IRemoteProxy<IFormRendererDelegate> {
31 public:
32     explicit FormRendererDelegateProxy(const sptr<IRemoteObject>& impl);
33     ~FormRendererDelegateProxy() override = default;
34 
35     int32_t OnSurfaceCreate(const std::shared_ptr<Rosen::RSSurfaceNode>& surfaceNode,
36         const OHOS::AppExecFwk::FormJsInfo& formJsInfo, const AAFwk::Want& want) override;
37 
38     int32_t OnSurfaceReuse(
39         uint64_t surfaceId, const OHOS::AppExecFwk::FormJsInfo& formJsInfo, const AAFwk::Want& want) override;
40 
41     int32_t OnSurfaceDetach(uint64_t surfaceId) override;
42 
43     int32_t OnSurfaceRelease(uint64_t surfaceId) override;
44 
45     int32_t OnActionEvent(const std::string& action) override;
46 
47     int32_t OnError(const std::string& code, const std::string& msg) override;
48 
49     int32_t OnSurfaceChange(float width, float height, float borderWidth = 0.0) override;
50 
51     int32_t OnFormLinkInfoUpdate(const std::vector<std::string>& formLinkInfos) override;
52 
53     int32_t OnGetRectRelativeToWindow(int32_t &top, int32_t &left) override;
54 private:
55     static bool WriteInterfaceToken(MessageParcel& data);
56 
57     static inline BrokerDelegator<FormRendererDelegateProxy> delegator_;
58 };
59 } // namespace Ace
60 } // namespace OHOS
61 #endif // FOUNDATION_ACE_INTERFACE_INNERKITS_FORM_RENDERER_DELEGATE_PROXY_H
62