• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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     SAVE_ALL = 12,
40     MAX_LABEL_TYPE
41 };
42 
43 enum class SaveIcon : int32_t {
44     FILLED_ICON = 0,
45     LINE_ICON = 1,
46     PICTURE_ICON = 2,
47     MAX_ICON_TYPE
48 };
49 
50 class __attribute__((visibility("default"))) SaveButton : public SecCompBase {
51 public:
52     virtual bool IsTextIconTypeValid(std::string& message, bool isClicked) override;
53     virtual bool IsCorrespondenceType() override;
54     virtual bool CompareComponentBasicInfo(SecCompBase *other, bool isRectCheck) const override;
55 private:
56     bool ParseStyle(const nlohmann::json& json, const std::string& tag);
57     bool IsSystemAppCalling() const;
58 };
59 }  // namespace SecurityComponent
60 }  // namespace Security
61 }  // namespace OHOS
62 #endif  // I_SECURITY_COMPONENT_SAVE_BUTTON_H
63