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 struct BorderRadius { 32 double leftTop; 33 double rightTop; 34 double leftBottom; 35 double rightBottom; 36 }; 37 38 enum SecCompType { 39 UNKNOWN_SC_TYPE = 0, 40 LOCATION_COMPONENT, 41 PASTE_COMPONENT, 42 SAVE_COMPONENT, 43 MAX_SC_TYPE 44 }; 45 46 union SecCompColor { 47 struct { 48 uint8_t blue; 49 uint8_t green; 50 uint8_t red; 51 uint8_t alpha; 52 } argb; 53 uint32_t value; 54 }; 55 56 struct SecCompRect { 57 double x_; 58 double y_; 59 double width_; 60 double height_; 61 }; 62 63 enum class SecCompBackground { 64 UNKNOWN_BG = -2, 65 NO_BG_TYPE = -1, 66 CAPSULE = 0, 67 CIRCLE = 1, 68 NORMAL = 2, 69 MAX_BG_TYPE 70 }; 71 72 enum CrossAxisState { 73 STATE_INVALID = 0, 74 STATE_CROSS, 75 STATE_NO_CROSS, 76 }; 77 78 class SecCompBase { 79 public: 80 SecCompBase() = default; 81 virtual ~SecCompBase() = default; ToJsonStr(void)82 std::string ToJsonStr(void) const 83 { 84 return ""; 85 }; 86 87 // size 88 double fontSize_; 89 double iconSize_; 90 PaddingSize padding_; 91 BorderRadius borderRadius_; 92 double textIconSpace_; 93 94 // color 95 SecCompColor fontColor_; 96 SecCompColor iconColor_; 97 SecCompColor bgColor_; 98 99 // border 100 double borderWidth_; 101 102 // parent effect 103 bool parentEffect_ = false; 104 bool isClipped_ = false; 105 double topClip_; 106 double bottomClip_; 107 double leftClip_; 108 double rightClip_; 109 std::string parentTag_; 110 111 SecCompType type_ = UNKNOWN_SC_TYPE; 112 SecCompRect rect_; 113 SecCompRect windowRect_; 114 bool isValid_ = false; 115 116 int32_t text_; 117 int32_t icon_; 118 SecCompBackground bg_; 119 120 bool hasNonCompatileChange_ = false; 121 double blurRadius_ = 0.0; 122 int32_t windowId_; 123 uint64_t displayId_ = 0; 124 int32_t nodeId_; 125 CrossAxisState crossAxisState_ = CrossAxisState::STATE_INVALID; 126 bool isWearableDevice_ = false; 127 }; 128 } // namespace SecurityComponent 129 } // namespace Security 130 } // namespace OHOS 131 #endif // ACE_MOCK_SECURITY_COMPONENT_BASE_H 132