| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_INTERFACE_H_ |
| 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_INTERFACE_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <string> |
| 10 |
| 11 #include "base/string16.h" |
| 12 #include "content/browser/download/interrupt_reasons.h" |
| 13 |
| 14 namespace base { |
| 15 class Time; |
| 16 } // namespace base |
| 17 class DownloadId; |
| 18 class DownloadManager; |
| 19 class FilePath; |
| 20 class GURL; |
| 21 |
| 22 class DownloadItemInterface { |
| 23 public: |
| 24 enum DownloadState { |
| 25 // Download is actively progressing. |
| 26 IN_PROGRESS = 0, |
| 27 |
| 28 // Download is completely finished. |
| 29 COMPLETE, |
| 30 |
| 31 // Download has been cancelled. |
| 32 CANCELLED, |
| 33 |
| 34 // This state indicates that the download item is about to be destroyed, |
| 35 // and observers seeing this state should release all references. |
| 36 REMOVING, |
| 37 |
| 38 // This state indicates that the download has been interrupted. |
| 39 INTERRUPTED, |
| 40 |
| 41 // Maximum value. |
| 42 MAX_DOWNLOAD_STATE |
| 43 }; |
| 44 |
| 45 enum SafetyState { |
| 46 SAFE = 0, |
| 47 DANGEROUS, |
| 48 DANGEROUS_BUT_VALIDATED // Dangerous but the user confirmed the download. |
| 49 }; |
| 50 |
| 51 // This enum is used by histograms. Do not change the ordering or remove |
| 52 // items. |
| 53 enum DangerType { |
| 54 NOT_DANGEROUS = 0, |
| 55 |
| 56 // A dangerous file to the system (e.g.: an executable or extension from |
| 57 // places other than gallery). |
| 58 DANGEROUS_FILE, |
| 59 |
| 60 // Safebrowsing service shows this URL leads to malicious file download. |
| 61 DANGEROUS_URL, |
| 62 |
| 63 // Memory space for histograms is determined by the max. |
| 64 // ALWAYS ADD NEW VALUES BEFORE THIS ONE. |
| 65 DANGEROUS_TYPE_MAX |
| 66 }; |
| 67 |
| 68 virtual ~DownloadItemInterface() {} |
| 69 virtual bool MatchesQuery(const string16& query) const = 0; |
| 70 virtual bool IsPartialDownload() const = 0; |
| 71 virtual bool IsInProgress() const = 0; |
| 72 virtual bool IsCancelled() const = 0; |
| 73 virtual bool IsInterrupted() const = 0; |
| 74 virtual bool IsComplete() const = 0; |
| 75 virtual DownloadState state() const = 0; |
| 76 virtual const FilePath& full_path() const = 0; |
| 77 virtual const GURL& GetURL() const = 0; |
| 78 virtual const GURL& original_url() const = 0; |
| 79 virtual const GURL& referrer_url() const = 0; |
| 80 virtual std::string suggested_filename() const = 0; |
| 81 virtual std::string content_disposition() const = 0; |
| 82 virtual std::string mime_type() const = 0; |
| 83 virtual std::string original_mime_type() const = 0; |
| 84 virtual std::string referrer_charset() const = 0; |
| 85 virtual int64 total_bytes() const = 0; |
| 86 virtual int64 received_bytes() const = 0; |
| 87 virtual int32 id() const = 0; |
| 88 virtual DownloadId global_id() const = 0; |
| 89 virtual base::Time start_time() const = 0; |
| 90 virtual int64 db_handle() const = 0; |
| 91 virtual DownloadManager* download_manager() = 0; |
| 92 virtual bool is_paused() const = 0; |
| 93 virtual bool open_when_complete() const = 0; |
| 94 virtual bool file_externally_removed() const = 0; |
| 95 virtual SafetyState safety_state() const = 0; |
| 96 virtual DangerType GetDangerType() const = 0; |
| 97 virtual bool IsDangerous() const = 0; |
| 98 virtual bool auto_opened() const = 0; |
| 99 virtual const FilePath& target_name() const = 0; |
| 100 virtual bool prompt_user_for_save_location() const = 0; |
| 101 virtual bool is_otr() const = 0; |
| 102 virtual const FilePath& suggested_path() const = 0; |
| 103 virtual bool is_temporary() const = 0; |
| 104 virtual bool opened() const = 0; |
| 105 virtual InterruptReason last_reason() const = 0; |
| 106 }; |
| 107 |
| 108 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_INTERFACE_H_ |
| OLD | NEW |