• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_ACE_UI_EVENT_OBSERVER_H
17 #define FOUNDATION_ACE_INTERFACE_INNERKITS_ACE_UI_EVENT_OBSERVER_H
18 
19 #include <functional>
20 #include <memory>
21 #include <string>
22 #include <unordered_map>
23 
24 #include "macros.h"
25 
26 namespace OHOS::Ace {
27 using OnInspectorTreeResult = std::function<void(const std::shared_ptr<std::string>)>;
28 
29 enum class InspectorInfoType: int32_t {
30     CONTENT = 0,
31     WINDOW_ID,
32     WEB_LANG,
33 };
34 
35 enum class InspectorPageType: int32_t {
36     FOCUS = 0,
37     FOREGROUND,
38 };
39 
40 struct ACE_FORCE_EXPORT TreeParams {
41     bool isNewVersion = true;
42     bool isVisibleOnly = false;
43     bool isContentOnly = false;
44     bool enableWeb = false;
45     std::string webContentJs;
46     bool isWindowIdOnly = false;
47     bool enableFullAttrs = false;
48     bool enableAllNodes = false;
49     InspectorPageType inspectorType { InspectorPageType::FOCUS };
50     InspectorInfoType infoType { InspectorInfoType::CONTENT };
51     int32_t webId = 0;
52 };
53 
54 class ACE_FORCE_EXPORT UIEventObserver {
55 public:
56     virtual ~UIEventObserver() = default;
57     virtual void NotifyUIEvent(int32_t eventType, const std::unordered_map<std::string, std::string>& eventParams) = 0;
58 };
59 } // namespace OHOS::Ace
60 #endif // FOUNDATION_ACE_INTERFACE_INNERKITS_ACE_UI_EVENT_OBSERVER_H
61