• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved.
2 //
3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are
5 // met:
6 //
7 //    * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer.
9 //    * Redistributions in binary form must reproduce the above
10 // copyright notice, this list of conditions and the following disclaimer
11 // in the documentation and/or other materials provided with the
12 // distribution.
13 //    * Neither the name of Google Inc. nor the name Chromium Embedded
14 // Framework nor the names of its contributors may be used to endorse
15 // or promote products derived from this software without specific prior
16 // written permission.
17 //
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // ---------------------------------------------------------------------------
31 //
32 // This file was generated by the CEF translator tool and should not edited
33 // by hand. See the translator.README.txt file in the tools directory for
34 // more information.
35 //
36 // $hash=b9f0d91dd2fdb3625365ff8b332b08e1f0ea1187$
37 //
38 
39 #ifndef CEF_INCLUDE_CAPI_CEF_DOWNLOAD_ITEM_CAPI_H_
40 #define CEF_INCLUDE_CAPI_CEF_DOWNLOAD_ITEM_CAPI_H_
41 #pragma once
42 
43 #include "include/capi/cef_base_capi.h"
44 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 
49 ///
50 // Structure used to represent a download item.
51 ///
52 typedef struct _cef_download_item_t {
53   ///
54   // Base structure.
55   ///
56   cef_base_ref_counted_t base;
57 
58   ///
59   // Returns true (1) if this object is valid. Do not call any other functions
60   // if this function returns false (0).
61   ///
62   int(CEF_CALLBACK* is_valid)(struct _cef_download_item_t* self);
63 
64   ///
65   // Returns true (1) if the download is in progress.
66   ///
67   int(CEF_CALLBACK* is_in_progress)(struct _cef_download_item_t* self);
68 
69   ///
70   // Returns true (1) if the download is complete.
71   ///
72   int(CEF_CALLBACK* is_complete)(struct _cef_download_item_t* self);
73 
74   ///
75   // Returns true (1) if the download has been canceled or interrupted.
76   ///
77   int(CEF_CALLBACK* is_canceled)(struct _cef_download_item_t* self);
78 
79   ///
80   // Returns a simple speed estimate in bytes/s.
81   ///
82   int64(CEF_CALLBACK* get_current_speed)(struct _cef_download_item_t* self);
83 
84   ///
85   // Returns the rough percent complete or -1 if the receive total size is
86   // unknown.
87   ///
88   int(CEF_CALLBACK* get_percent_complete)(struct _cef_download_item_t* self);
89 
90   ///
91   // Returns the total number of bytes.
92   ///
93   int64(CEF_CALLBACK* get_total_bytes)(struct _cef_download_item_t* self);
94 
95   ///
96   // Returns the number of received bytes.
97   ///
98   int64(CEF_CALLBACK* get_received_bytes)(struct _cef_download_item_t* self);
99 
100   ///
101   // Returns the time that the download started.
102   ///
103   cef_time_t(CEF_CALLBACK* get_start_time)(struct _cef_download_item_t* self);
104 
105   ///
106   // Returns the time that the download ended.
107   ///
108   cef_time_t(CEF_CALLBACK* get_end_time)(struct _cef_download_item_t* self);
109 
110   ///
111   // Returns the full path to the downloaded or downloading file.
112   ///
113   // The resulting string must be freed by calling cef_string_userfree_free().
114   cef_string_userfree_t(CEF_CALLBACK* get_full_path)(
115       struct _cef_download_item_t* self);
116 
117   ///
118   // Returns the unique identifier for this download.
119   ///
120   uint32(CEF_CALLBACK* get_id)(struct _cef_download_item_t* self);
121 
122   ///
123   // Returns the URL.
124   ///
125   // The resulting string must be freed by calling cef_string_userfree_free().
126   cef_string_userfree_t(CEF_CALLBACK* get_url)(
127       struct _cef_download_item_t* self);
128 
129   ///
130   // Returns the original URL before any redirections.
131   ///
132   // The resulting string must be freed by calling cef_string_userfree_free().
133   cef_string_userfree_t(CEF_CALLBACK* get_original_url)(
134       struct _cef_download_item_t* self);
135 
136   ///
137   // Returns the suggested file name.
138   ///
139   // The resulting string must be freed by calling cef_string_userfree_free().
140   cef_string_userfree_t(CEF_CALLBACK* get_suggested_file_name)(
141       struct _cef_download_item_t* self);
142 
143   ///
144   // Returns the content disposition.
145   ///
146   // The resulting string must be freed by calling cef_string_userfree_free().
147   cef_string_userfree_t(CEF_CALLBACK* get_content_disposition)(
148       struct _cef_download_item_t* self);
149 
150   ///
151   // Returns the mime type.
152   ///
153   // The resulting string must be freed by calling cef_string_userfree_free().
154   cef_string_userfree_t(CEF_CALLBACK* get_mime_type)(
155       struct _cef_download_item_t* self);
156 } cef_download_item_t;
157 
158 #ifdef __cplusplus
159 }
160 #endif
161 
162 #endif  // CEF_INCLUDE_CAPI_CEF_DOWNLOAD_ITEM_CAPI_H_
163