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 OHOS_ROSEN_ACCESSIBILITY_CONNECTION_H 17 #define OHOS_ROSEN_ACCESSIBILITY_CONNECTION_H 18 19 #include <refbase.h> 20 #include <map> 21 #include <vector> 22 23 #include "window_node.h" 24 #include "window_root.h" 25 #include "window_node_container.h" 26 #include "wm_common.h" 27 28 namespace OHOS::Rosen { 29 class AccessibilityConnection : public RefBase { 30 public: AccessibilityConnection(sptr<WindowRoot> & root)31 explicit AccessibilityConnection(sptr<WindowRoot>& root) : windowRoot_(root) {} 32 ~AccessibilityConnection() = default; 33 void NotifyAccessibilityWindowInfo(const sptr<WindowNode>& node, WindowUpdateType type); 34 void NotifyAccessibilityWindowInfo(DisplayId displayId, const std::vector<sptr<WindowNode>>& nodes, 35 WindowUpdateType type); 36 void NotifyAccessibilityWindowInfo(DisplayId displayId, WindowUpdateType type); 37 void GetAccessibilityWindowInfo(std::vector<sptr<AccessibilityWindowInfo>>& infos) const; 38 39 private: 40 sptr<WindowRoot> windowRoot_; 41 std::map<sptr<WindowNodeContainer>, uint32_t> focusedWindowMap_; 42 void NotifyAccessibilityWindowInfo(const std::vector<sptr<WindowNode>>& nodes, uint32_t focusedWindow, 43 WindowUpdateType type) const; 44 void FillAccessibilityWindowInfo(const std::vector<sptr<WindowNode>>& nodes, uint32_t focusedWindow, 45 std::vector<sptr<AccessibilityWindowInfo>>& windowInfo) const; 46 void UpdateFocusChangeEvent(const sptr<WindowNodeContainer>& container); 47 }; 48 } 49 #endif // OHOS_ROSEN_ACCESSIBILITY_CONTROLLER_H 50