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 enum CrossAxisState { 66 STATE_INVALID = 0, 67 STATE_CROSS, 68 STATE_NO_CROSS, 69 }; 70 71 class SecCompBase { 72 public: 73 SecCompBase() = default; 74 virtual ~SecCompBase() = default; ToJsonStr(void)75 std::string ToJsonStr(void) const 76 { 77 return ""; 78 }; 79 80 // size 81 double fontSize_; 82 double iconSize_; 83 PaddingSize padding_; 84 double textIconSpace_; 85 86 // color 87 SecCompColor fontColor_; 88 SecCompColor iconColor_; 89 SecCompColor bgColor_; 90 91 // border 92 double borderWidth_; 93 94 // parent effect 95 bool parentEffect_ = false; 96 bool isClipped_ = false; 97 double topClip_; 98 double bottomClip_; 99 double leftClip_; 100 double rightClip_; 101 std::string parentTag_; 102 103 SecCompType type_ = UNKNOWN_SC_TYPE; 104 SecCompRect rect_; 105 SecCompRect windowRect_; 106 bool isValid_ = false; 107 108 int32_t text_; 109 int32_t icon_; 110 SecCompBackground bg_; 111 112 int32_t windowId_; 113 uint64_t displayId_ = 0; 114 int32_t nodeId_; 115 CrossAxisState crossAxisState_ = CrossAxisState::STATE_INVALID; 116 }; 117 } // namespace SecurityComponent 118 } // namespace Security 119 } // namespace OHOS 120 #endif // ACE_MOCK_SECURITY_COMPONENT_BASE_H 121