• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2012 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 // The contents of this file must follow a specific format in order to
33 // support the CEF translator tool. See the translator.README.txt file in the
34 // tools directory for more information.
35 //
36 
37 #ifndef CEF_INCLUDE_CEF_DOWNLOAD_ITEM_H_
38 #define CEF_INCLUDE_CEF_DOWNLOAD_ITEM_H_
39 #pragma once
40 
41 #include "include/cef_base.h"
42 
43 ///
44 // Class used to represent a download item.
45 ///
46 /*--cef(source=library)--*/
47 class CefDownloadItem : public virtual CefBaseRefCounted {
48  public:
49   ///
50   // Returns true if this object is valid. Do not call any other methods if this
51   // function returns false.
52   ///
53   /*--cef()--*/
54   virtual bool IsValid() = 0;
55 
56   ///
57   // Returns true if the download is in progress.
58   ///
59   /*--cef()--*/
60   virtual bool IsInProgress() = 0;
61 
62   ///
63   // Returns true if the download is complete.
64   ///
65   /*--cef()--*/
66   virtual bool IsComplete() = 0;
67 
68   ///
69   // Returns true if the download has been canceled or interrupted.
70   ///
71   /*--cef()--*/
72   virtual bool IsCanceled() = 0;
73 
74   ///
75   // Returns a simple speed estimate in bytes/s.
76   ///
77   /*--cef()--*/
78   virtual int64 GetCurrentSpeed() = 0;
79 
80   ///
81   // Returns the rough percent complete or -1 if the receive total size is
82   // unknown.
83   ///
84   /*--cef()--*/
85   virtual int GetPercentComplete() = 0;
86 
87   ///
88   // Returns the total number of bytes.
89   ///
90   /*--cef()--*/
91   virtual int64 GetTotalBytes() = 0;
92 
93   ///
94   // Returns the number of received bytes.
95   ///
96   /*--cef()--*/
97   virtual int64 GetReceivedBytes() = 0;
98 
99   ///
100   // Returns the time that the download started.
101   ///
102   /*--cef()--*/
103   virtual CefTime GetStartTime() = 0;
104 
105   ///
106   // Returns the time that the download ended.
107   ///
108   /*--cef()--*/
109   virtual CefTime GetEndTime() = 0;
110 
111   ///
112   // Returns the full path to the downloaded or downloading file.
113   ///
114   /*--cef()--*/
115   virtual CefString GetFullPath() = 0;
116 
117   ///
118   // Returns the unique identifier for this download.
119   ///
120   /*--cef()--*/
121   virtual uint32 GetId() = 0;
122 
123   ///
124   // Returns the URL.
125   ///
126   /*--cef()--*/
127   virtual CefString GetURL() = 0;
128 
129   ///
130   // Returns the original URL before any redirections.
131   ///
132   /*--cef()--*/
133   virtual CefString GetOriginalUrl() = 0;
134 
135   ///
136   // Returns the suggested file name.
137   ///
138   /*--cef()--*/
139   virtual CefString GetSuggestedFileName() = 0;
140 
141   ///
142   // Returns the content disposition.
143   ///
144   /*--cef()--*/
145   virtual CefString GetContentDisposition() = 0;
146 
147   ///
148   // Returns the mime type.
149   ///
150   /*--cef()--*/
151   virtual CefString GetMimeType() = 0;
152 };
153 
154 #endif  // CEF_INCLUDE_CEF_DOWNLOAD_ITEM_H_
155