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 
16 #ifndef WEB_DOWNLOAD_ITEM_IMPL_H
17 #define WEB_DOWNLOAD_ITEM_IMPL_H
18 
19 #include <string>
20 
21 #include "ffi_remote_data.h"
22 #include "nweb_c_api.h"
23 
24 namespace OHOS::Webview {
25     class __attribute__((visibility("default"))) WebDownloadItemImpl : public OHOS::FFI::FFIData {
26         DECL_TYPE(WebDownloadItemImpl, OHOS::FFI::FFIData)
27     public:
28         explicit WebDownloadItemImpl();
29         WebDownloadItemImpl(NWebDownloadItem *downloadItem);
30         ~WebDownloadItemImpl();
31 
32         long webDownloadId;
33         int currentSpeed;
34         int percentComplete;
35         int64_t totalBytes;
36         int64_t receivedBytes;
37         int lastErrorCode;
38 
39         std::string guid;
40         std::string fullPath;
41         std::string url;
42         std::string etag;
43         std::string originalUrl;
44         std::string suggestedFileName;
45         std::string contentDisposition;
46         std::string mimeType;
47         std::string lastModified;
48 
49         NWebDownloadItemState state = NWebDownloadItemState::MAX_DOWNLOAD_STATE;
50         std::string method;
51         std::string receivedSlices;
52 
53         std::string downloadPath;
54         WebBeforeDownloadCallbackWrapper *before_download_callback;
55         WebDownloadItemCallbackWrapper *download_item_callback;
56 
57         int32_t nwebId;
58     };
59 } // namespace OHOS::Webview
60 
61 #endif // WEB_DOWNLOAD_ITEM_IMPL_H
62