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_ACE_FRAMEWORKS_BRIDGE_CARD_FRONTEND_CARD_FRONTEND_DELEGATE_H
17 #define FOUNDATION_ACE_FRAMEWORKS_BRIDGE_CARD_FRONTEND_CARD_FRONTEND_DELEGATE_H
18 
19 #include "frameworks/base/memory/ace_type.h"
20 #include "frameworks/base/utils/noncopyable.h"
21 #include "frameworks/bridge/common/accessibility/accessibility_node_manager.h"
22 #include "frameworks/bridge/js_frontend/js_ace_page.h"
23 
24 namespace OHOS::Ace::Framework {
25 // This is the primary class by which the CardFrontend delegates
26 class CardFrontendDelegate : public AceType {
27     DECLARE_ACE_TYPE(CardFrontendDelegate, AceType);
28 
29 public:
30     CardFrontendDelegate();
31     ~CardFrontendDelegate() override;
32     void FireCardEvent(const EventMarker& eventMarker, const std::string& params = "");
33     RefPtr<JsAcePage>& CreatePage(int32_t pageId, const std::string& url);
34     RefPtr<JsAcePage>& CreatePage(int32_t pageId, const std::string& url, const WeakPtr<StageElement>& container);
35     RefPtr<JsAcePage>& GetPage();
36 
GetJsAccessibilityManager()37     RefPtr<AccessibilityNodeManager> GetJsAccessibilityManager() const
38     {
39         return jsAccessibilityManager_;
40     }
41 
42 private:
43     RefPtr<JsAcePage> page_;
44     RefPtr<AccessibilityNodeManager> jsAccessibilityManager_;
45 
46     ACE_DISALLOW_COPY_AND_MOVE(CardFrontendDelegate);
47 };
48 } // namespace OHOS::Ace::Framework
49 
50 #endif // FOUNDATION_ACE_FRAMEWORKS_BRIDGE_CARD_FRONTEND_CARD_FRONTEND_DELEGATE_H
51