• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 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 ACCESSIBILITY_ELEMENT_OPERATOR_CALLBACK_H
17 #define ACCESSIBILITY_ELEMENT_OPERATOR_CALLBACK_H
18 
19 #include <list>
20 #include "accessibility_element_info.h"
21 
22 namespace OHOS {
23 namespace Accessibility {
24 /*
25 * The class supply the callback to feedback the result from UI to AA.
26 */
27 class AccessibilityElementOperatorCallback {
28 public:
29     /**
30      * @brief Destruct
31      */
32     virtual ~AccessibilityElementOperatorCallback() = default;
33 
34     /**
35      * @brief Set the element information by accessibility id to AA.
36      * @param infos The element information searched by accessibility id.
37      * @param requestId The request id from AA, it is used to match with request and response.
38      */
39     virtual void SetSearchElementInfoByAccessibilityIdResult(const std::list<AccessibilityElementInfo> &infos,
40         const int32_t requestId) = 0;
41 
42     /**
43      * @brief Set the element information by window id to AA.
44      * @param infos The element information searched by window id.
45      * @param requestId The request id from AA, it is used to match with request and response.
46      */
47     virtual void SetSearchDefaultFocusByWindowIdResult(const std::list<AccessibilityElementInfo> &infos,
48         const int32_t requestId) = 0;
49 
50     /**
51      * @brief Set the element information matched with text to AA.
52      * @param infos The element information searched matched with text.
53      * @param requestId The request id from AA, it is used to match with request and response.
54      */
55     virtual void SetSearchElementInfoByTextResult(const std::list<AccessibilityElementInfo> &infos,
56         const int32_t requestId) = 0;
57 
58     /**
59      * @brief Set the element information matched with focus type to AA.
60      * @param info The element information searched matched with focus type.
61      * @param requestId The request id from AA, it is used to match with request and response.
62      */
63     virtual void SetFindFocusedElementInfoResult(const AccessibilityElementInfo &info, const int32_t requestId) = 0;
64 
65     /**
66      * @brief Set the element information by focus direction to AA.
67      * @param info The element information searched by focus direction.
68      * @param requestId The request id from AA, it is used to match with request and response.
69      */
70     virtual void SetFocusMoveSearchResult(const AccessibilityElementInfo &info, const int32_t requestId) = 0;
71 
72     /**
73      * @brief Set the result of action executed to AA.
74      * @param succeeded True: The action is executed successfully; otherwise is false.
75      * @param requestId The request id from AA, it is used to match with request and response.
76      */
77     virtual void SetExecuteActionResult(const bool succeeded, const int32_t requestId) = 0;
78 
79     /**
80      * @brief Set the result of cursor position to AA.
81      * @param cursorPosition The cursorPosition to be returned.
82      * @param requestId The request id from AA, it is used to match with request and response.
83      */
84     virtual void SetCursorPositionResult(const int32_t cursorPosition, const int32_t requestId) = 0;
85 };
86 } // namespace Accessibility
87 } // namespace OHOS
88 #endif // ACCESSIBILITY_ELEMENT_OPERATOR_CALLBACK_H