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/file_path.h" | 24 #include "base/file_path.h" |
25 #include "base/string16.h" | 25 #include "base/string16.h" |
26 #include "content/public/browser/download_danger_type.h" | 26 #include "content/public/browser/download_danger_type.h" |
27 #include "content/public/browser/download_interrupt_reasons.h" | 27 #include "content/public/browser/download_interrupt_reasons.h" |
28 #include "content/public/common/page_transition_types.h" | 28 #include "content/public/common/page_transition_types.h" |
29 | 29 |
30 class DownloadFileManager; | |
31 class FilePath; | 30 class FilePath; |
32 class GURL; | 31 class GURL; |
33 struct DownloadCreateInfo; | 32 struct DownloadCreateInfo; |
34 | 33 |
35 namespace base { | 34 namespace base { |
36 class Time; | 35 class Time; |
37 class TimeDelta; | 36 class TimeDelta; |
38 } | 37 } |
39 | 38 |
40 namespace content { | 39 namespace content { |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 // called previously with disposition set to TARGET_DISPOSITION_PROMPT. | 235 // called previously with disposition set to TARGET_DISPOSITION_PROMPT. |
237 // |target_path| is the path that the user selected after being prompted for a | 236 // |target_path| is the path that the user selected after being prompted for a |
238 // target path. | 237 // target path. |
239 virtual void OnTargetPathSelected(const FilePath& target_path) = 0; | 238 virtual void OnTargetPathSelected(const FilePath& target_path) = 0; |
240 | 239 |
241 // Called if a check of the download contents was performed and the results of | 240 // Called if a check of the download contents was performed and the results of |
242 // the test are available. This should only be called after AllDataSaved() is | 241 // the test are available. This should only be called after AllDataSaved() is |
243 // true. | 242 // true. |
244 virtual void OnContentCheckCompleted(DownloadDangerType danger_type) = 0; | 243 virtual void OnContentCheckCompleted(DownloadDangerType danger_type) = 0; |
245 | 244 |
246 virtual void OnIntermediatePathDetermined(DownloadFileManager* file_manager, | 245 virtual void OnIntermediatePathDetermined(const FilePath& path) = 0; |
247 const FilePath& path) = 0; | |
248 | 246 |
249 virtual bool IsPersisted() const = 0; | 247 virtual bool IsPersisted() const = 0; |
250 | 248 |
251 // Accessors | 249 // Accessors |
252 virtual const std::string& GetHash() const = 0; | 250 virtual const std::string& GetHash() const = 0; |
253 virtual DownloadState GetState() const = 0; | 251 virtual DownloadState GetState() const = 0; |
254 virtual const GURL& GetURL() const = 0; | 252 virtual const GURL& GetURL() const = 0; |
255 virtual const std::vector<GURL>& GetUrlChain() const = 0; | 253 virtual const std::vector<GURL>& GetUrlChain() const = 0; |
256 virtual const GURL& GetOriginalUrl() const = 0; | 254 virtual const GURL& GetOriginalUrl() const = 0; |
257 virtual const GURL& GetReferrerUrl() const = 0; | 255 virtual const GURL& GetReferrerUrl() const = 0; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 virtual void SetExternalData(const void* key, ExternalData* data) = 0; | 327 virtual void SetExternalData(const void* key, ExternalData* data) = 0; |
330 | 328 |
331 virtual std::string DebugString(bool verbose) const = 0; | 329 virtual std::string DebugString(bool verbose) const = 0; |
332 | 330 |
333 virtual void MockDownloadOpenForTesting() = 0; | 331 virtual void MockDownloadOpenForTesting() = 0; |
334 }; | 332 }; |
335 | 333 |
336 } // namespace content | 334 } // namespace content |
337 | 335 |
338 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_ | 336 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_ |
OLD | NEW |