1885b47fbSopenharmony_ci/* 2885b47fbSopenharmony_ci * Copyright (C) 2022 Huawei Device Co., Ltd. 3885b47fbSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4885b47fbSopenharmony_ci * you may not use this file except in compliance with the License. 5885b47fbSopenharmony_ci * You may obtain a copy of the License at 6885b47fbSopenharmony_ci * 7885b47fbSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8885b47fbSopenharmony_ci * 9885b47fbSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10885b47fbSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11885b47fbSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12885b47fbSopenharmony_ci * See the License for the specific language governing permissions and 13885b47fbSopenharmony_ci * limitations under the License. 14885b47fbSopenharmony_ci */ 15885b47fbSopenharmony_ci 16885b47fbSopenharmony_ci#ifndef ACCESSIBILITY_WINDOW_CONNECTION_H 17885b47fbSopenharmony_ci#define ACCESSIBILITY_WINDOW_CONNECTION_H 18885b47fbSopenharmony_ci 19885b47fbSopenharmony_ci#include "i_accessibility_element_operator.h" 20885b47fbSopenharmony_ci#include "hilog_wrapper.h" 21885b47fbSopenharmony_ci 22885b47fbSopenharmony_cinamespace OHOS { 23885b47fbSopenharmony_cinamespace Accessibility { 24885b47fbSopenharmony_ciclass AccessibilityWindowConnection : public RefBase { 25885b47fbSopenharmony_cipublic: 26885b47fbSopenharmony_ci AccessibilityWindowConnection(const int32_t windowId, const sptr<IAccessibilityElementOperator> &connection, 27885b47fbSopenharmony_ci const int32_t accountId); 28885b47fbSopenharmony_ci AccessibilityWindowConnection(const int32_t windowId, const int32_t treeId, 29885b47fbSopenharmony_ci const sptr<IAccessibilityElementOperator> &connection, const int32_t accountId); 30885b47fbSopenharmony_ci ~AccessibilityWindowConnection(); 31885b47fbSopenharmony_ci 32885b47fbSopenharmony_ci inline sptr<IAccessibilityElementOperator> GetProxy() 33885b47fbSopenharmony_ci { 34885b47fbSopenharmony_ci return proxy_; 35885b47fbSopenharmony_ci } 36885b47fbSopenharmony_ci 37885b47fbSopenharmony_ci sptr<IAccessibilityElementOperator> GetCardProxy(const int32_t treeId); 38885b47fbSopenharmony_ci 39885b47fbSopenharmony_ci RetError SetCardProxy(const int32_t treeId, sptr<IAccessibilityElementOperator> operation); 40885b47fbSopenharmony_ci 41885b47fbSopenharmony_ci uint32_t GetTokenIdMap(const int32_t treeId); 42885b47fbSopenharmony_ci 43885b47fbSopenharmony_ci RetError SetTokenIdMap(const int32_t treeId, const uint32_t tokenId); 44885b47fbSopenharmony_ci 45885b47fbSopenharmony_ci void GetAllTreeId(std::vector<int32_t> &treeIds); 46885b47fbSopenharmony_ci 47885b47fbSopenharmony_ci RetError GetRootParentId(int32_t treeId, int64_t &elementId); 48885b47fbSopenharmony_ci 49885b47fbSopenharmony_ci RetError SetRootParentId(const int32_t treeId, const int64_t elementId); 50885b47fbSopenharmony_ci 51885b47fbSopenharmony_ci void EraseProxy(const int32_t treeId); 52885b47fbSopenharmony_ci 53885b47fbSopenharmony_ciprivate: 54885b47fbSopenharmony_ci int32_t windowId_; 55885b47fbSopenharmony_ci int32_t accountId_; 56885b47fbSopenharmony_ci int32_t treeId_ = 0; 57885b47fbSopenharmony_ci std::map<int32_t, sptr<IAccessibilityElementOperator>> cardProxy_; 58885b47fbSopenharmony_ci sptr<IAccessibilityElementOperator> proxy_; 59885b47fbSopenharmony_ci std::map<int32_t, uint32_t> tokenIdMap_; 60885b47fbSopenharmony_ci std::map<int32_t, int64_t> treeIdParentId_; 61885b47fbSopenharmony_ci}; 62885b47fbSopenharmony_ci} // namespace Accessibility 63885b47fbSopenharmony_ci} // namespace OHOS 64885b47fbSopenharmony_ci#endif // ACCESSIBILITY_WINDOW_CONNECTION_H