OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // Each download is represented by a DownloadItem, and all DownloadItems | 5 // Each download is represented by a DownloadItem, and all DownloadItems |
6 // are owned by the DownloadManager which maintains a global list of all | 6 // are owned by the DownloadManager which maintains a global list of all |
7 // downloads. DownloadItems are created when a user initiates a download, | 7 // downloads. DownloadItems are created when a user initiates a download, |
8 // and exist for the duration of the browser life time. | 8 // and exist for the duration of the browser life time. |
9 // | 9 // |
10 // Download observers: | 10 // Download observers: |
11 // DownloadItem::Observer: | 11 // DownloadItem::Observer: |
12 // - allows observers to receive notifications about one download from start | 12 // - allows observers to receive notifications about one download from start |
13 // to completion | 13 // to completion |
14 // Use AddObserver() / RemoveObserver() on the appropriate download object to | 14 // Use AddObserver() / RemoveObserver() on the appropriate download object to |
15 // receive state updates. | 15 // receive state updates. |
16 | 16 |
17 #ifndef CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_ | 17 #ifndef CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_ |
18 #define CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_ | 18 #define CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_ |
19 | 19 |
20 #include <map> | 20 #include <map> |
21 #include <string> | 21 #include <string> |
22 #include <vector> | 22 #include <vector> |
23 | 23 |
24 #include "base/callback_forward.h" | 24 #include "base/callback_forward.h" |
25 #include "base/files/file_path.h" | 25 #include "base/files/file_path.h" |
26 #include "base/strings/string16.h" | 26 #include "base/strings/string16.h" |
27 #include "base/supports_user_data.h" | 27 #include "base/supports_user_data.h" |
28 #include "content/public/browser/download_danger_type.h" | 28 #include "content/public/browser/download_danger_type.h" |
29 #include "content/public/browser/download_interrupt_reasons.h" | 29 #include "content/public/browser/download_interrupt_reasons.h" |
30 #include "content/public/common/page_transition_types.h" | 30 #include "ui/base/page_transition_types.h" |
31 | 31 |
32 class GURL; | 32 class GURL; |
33 | 33 |
34 namespace base { | 34 namespace base { |
35 class FilePath; | 35 class FilePath; |
36 class Time; | 36 class Time; |
37 class TimeDelta; | 37 class TimeDelta; |
38 } | 38 } |
39 | 39 |
40 namespace content { | 40 namespace content { |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 virtual const GURL& GetOriginalUrl() const = 0; | 182 virtual const GURL& GetOriginalUrl() const = 0; |
183 virtual const GURL& GetReferrerUrl() const = 0; | 183 virtual const GURL& GetReferrerUrl() const = 0; |
184 virtual const GURL& GetTabUrl() const = 0; | 184 virtual const GURL& GetTabUrl() const = 0; |
185 virtual const GURL& GetTabReferrerUrl() const = 0; | 185 virtual const GURL& GetTabReferrerUrl() const = 0; |
186 virtual std::string GetSuggestedFilename() const = 0; | 186 virtual std::string GetSuggestedFilename() const = 0; |
187 virtual std::string GetContentDisposition() const = 0; | 187 virtual std::string GetContentDisposition() const = 0; |
188 virtual std::string GetMimeType() const = 0; | 188 virtual std::string GetMimeType() const = 0; |
189 virtual std::string GetOriginalMimeType() const = 0; | 189 virtual std::string GetOriginalMimeType() const = 0; |
190 virtual std::string GetRemoteAddress() const = 0; | 190 virtual std::string GetRemoteAddress() const = 0; |
191 virtual bool HasUserGesture() const = 0; | 191 virtual bool HasUserGesture() const = 0; |
192 virtual PageTransition GetTransitionType() const = 0; | 192 virtual ui::PageTransition GetTransitionType() const = 0; |
193 virtual const std::string& GetLastModifiedTime() const = 0; | 193 virtual const std::string& GetLastModifiedTime() const = 0; |
194 virtual const std::string& GetETag() const = 0; | 194 virtual const std::string& GetETag() const = 0; |
195 virtual bool IsSavePackageDownload() const = 0; | 195 virtual bool IsSavePackageDownload() const = 0; |
196 | 196 |
197 // Destination State accessors -------------------------------------------- | 197 // Destination State accessors -------------------------------------------- |
198 | 198 |
199 // Full path to the downloaded or downloading file. This is the path to the | 199 // Full path to the downloaded or downloading file. This is the path to the |
200 // physical file, if one exists. It should be considered a hint; changes to | 200 // physical file, if one exists. It should be considered a hint; changes to |
201 // this value and renames of the file on disk are not atomic with each other. | 201 // this value and renames of the file on disk are not atomic with each other. |
202 // May be empty if the in-progress path hasn't been determined yet or if the | 202 // May be empty if the in-progress path hasn't been determined yet or if the |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 // return |name|. Has no effect on the final target filename. | 329 // return |name|. Has no effect on the final target filename. |
330 virtual void SetDisplayName(const base::FilePath& name) = 0; | 330 virtual void SetDisplayName(const base::FilePath& name) = 0; |
331 | 331 |
332 // Debug/testing ------------------------------------------------------------- | 332 // Debug/testing ------------------------------------------------------------- |
333 virtual std::string DebugString(bool verbose) const = 0; | 333 virtual std::string DebugString(bool verbose) const = 0; |
334 }; | 334 }; |
335 | 335 |
336 } // namespace content | 336 } // namespace content |
337 | 337 |
338 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_ | 338 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_ |
OLD | NEW |