1 /* 2 * Copyright (c) 2024 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 #ifndef ACE_MOCK_SECURITY_COMPONENT_BASE_H 16 #define ACE_MOCK_SECURITY_COMPONENT_BASE_H 17 18 #include <cstdint> 19 #include <string> 20 21 namespace OHOS { 22 namespace Security { 23 namespace SecurityComponent { 24 struct PaddingSize { 25 double top; 26 double right; 27 double bottom; 28 double left; 29 }; 30 31 enum SecCompType { 32 UNKNOWN_SC_TYPE = 0, 33 LOCATION_COMPONENT, 34 PASTE_COMPONENT, 35 SAVE_COMPONENT, 36 MAX_SC_TYPE 37 }; 38 39 union SecCompColor { 40 struct { 41 uint8_t blue; 42 uint8_t green; 43 uint8_t red; 44 uint8_t alpha; 45 } argb; 46 uint32_t value; 47 }; 48 49 struct SecCompRect { 50 double x_; 51 double y_; 52 double width_; 53 double height_; 54 }; 55 56 enum class SecCompBackground { 57 UNKNOWN_BG = -2, 58 NO_BG_TYPE = -1, 59 CAPSULE = 0, 60 CIRCLE = 1, 61 NORMAL = 2, 62 MAX_BG_TYPE 63 }; 64 65 class SecCompBase { 66 public: 67 SecCompBase() = default; 68 virtual ~SecCompBase() = default; ToJsonStr(void)69 std::string ToJsonStr(void) const 70 { 71 return ""; 72 }; 73 74 // size 75 double fontSize_; 76 double iconSize_; 77 PaddingSize padding_; 78 double textIconSpace_; 79 80 // color 81 SecCompColor fontColor_; 82 SecCompColor iconColor_; 83 SecCompColor bgColor_; 84 85 // border 86 double borderWidth_; 87 88 // parent effect 89 bool parentEffect_ = false; 90 bool isClipped_ = false; 91 double topClip_; 92 double bottomClip_; 93 double leftClip_; 94 double rightClip_; 95 std::string parentTag_; 96 97 SecCompType type_ = UNKNOWN_SC_TYPE; 98 SecCompRect rect_; 99 SecCompRect windowRect_; 100 bool isValid_ = false; 101 102 int32_t text_; 103 int32_t icon_; 104 SecCompBackground bg_; 105 106 int32_t windowId_; 107 int32_t nodeId_; 108 }; 109 } // namespace SecurityComponent 110 } // namespace Security 111 } // namespace OHOS 112 #endif // ACE_MOCK_SECURITY_COMPONENT_BASE_H 113