1 /* 2 * Copyright (c) 2023-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 I_SECURITY_COMPONENT_SAVE_BUTTON_H 16 #define I_SECURITY_COMPONENT_SAVE_BUTTON_H 17 18 #include <string> 19 #include "nlohmann/json.hpp" 20 #include "sec_comp_base.h" 21 #include "sec_comp_info.h" 22 23 namespace OHOS { 24 namespace Security { 25 namespace SecurityComponent { 26 enum class SaveDesc : int32_t { 27 DOWNLOAD = 0, 28 DOWNLOAD_FILE = 1, 29 SAVE = 2, 30 SAVE_IMAGE = 3, 31 SAVE_FILE = 4, 32 DOWNLOAD_AND_SHARE = 5, 33 RECEIVE = 6, 34 CONTINUE_TO_RECEIVE = 7, 35 SAVE_TO_GALLERY = 8, 36 EXPORT_TO_GALLERY = 9, 37 QUICK_SAVE_TO_GALLERY = 10, 38 RESAVE_TO_GALLERY = 11, 39 MAX_LABEL_TYPE 40 }; 41 42 enum class SaveIcon : int32_t { 43 FILLED_ICON = 0, 44 LINE_ICON = 1, 45 PICTURE_ICON = 2, 46 MAX_ICON_TYPE 47 }; 48 49 class __attribute__((visibility("default"))) SaveButton : public SecCompBase { 50 public: 51 virtual bool IsTextIconTypeValid() override; 52 virtual bool IsCorrespondenceType() override; 53 virtual bool CompareComponentBasicInfo(SecCompBase *other, bool isRectCheck) const override; 54 private: 55 bool ParseStyle(const nlohmann::json& json, const std::string& tag); 56 bool IsSystemAppCalling() const; 57 }; 58 } // namespace SecurityComponent 59 } // namespace Security 60 } // namespace OHOS 61 #endif // I_SECURITY_COMPONENT_SAVE_BUTTON_H 62