Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1898)

Unified Diff: content/browser/download/download_item_interface.h

Issue 7825035: Implement chrome.experimental.downloads.search() (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: rewrite Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/download/download_item.cc ('k') | content/browser/download/download_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/download/download_item_interface.h
diff --git a/content/browser/download/download_item_interface.h b/content/browser/download/download_item_interface.h
new file mode 100644
index 0000000000000000000000000000000000000000..cbc74b2f06461118b34b1536ac794d52693753fe
--- /dev/null
+++ b/content/browser/download/download_item_interface.h
@@ -0,0 +1,108 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_INTERFACE_H_
+#define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_INTERFACE_H_
+#pragma once
+
+#include <string>
+
+#include "base/string16.h"
+#include "content/browser/download/interrupt_reasons.h"
+
+namespace base {
+class Time;
+} // namespace base
+class DownloadId;
+class DownloadManager;
+class FilePath;
+class GURL;
+
+class DownloadItemInterface {
+ public:
+ enum DownloadState {
+ // Download is actively progressing.
+ IN_PROGRESS = 0,
+
+ // Download is completely finished.
+ COMPLETE,
+
+ // Download has been cancelled.
+ CANCELLED,
+
+ // This state indicates that the download item is about to be destroyed,
+ // and observers seeing this state should release all references.
+ REMOVING,
+
+ // This state indicates that the download has been interrupted.
+ INTERRUPTED,
+
+ // Maximum value.
+ MAX_DOWNLOAD_STATE
+ };
+
+ enum SafetyState {
+ SAFE = 0,
+ DANGEROUS,
+ DANGEROUS_BUT_VALIDATED // Dangerous but the user confirmed the download.
+ };
+
+ // This enum is used by histograms. Do not change the ordering or remove
+ // items.
+ enum DangerType {
+ NOT_DANGEROUS = 0,
+
+ // A dangerous file to the system (e.g.: an executable or extension from
+ // places other than gallery).
+ DANGEROUS_FILE,
+
+ // Safebrowsing service shows this URL leads to malicious file download.
+ DANGEROUS_URL,
+
+ // Memory space for histograms is determined by the max.
+ // ALWAYS ADD NEW VALUES BEFORE THIS ONE.
+ DANGEROUS_TYPE_MAX
+ };
+
+ virtual ~DownloadItemInterface() {}
+ virtual bool MatchesQuery(const string16& query) const = 0;
+ virtual bool IsPartialDownload() const = 0;
+ virtual bool IsInProgress() const = 0;
+ virtual bool IsCancelled() const = 0;
+ virtual bool IsInterrupted() const = 0;
+ virtual bool IsComplete() const = 0;
+ virtual DownloadState state() const = 0;
+ virtual const FilePath& full_path() const = 0;
+ virtual const GURL& GetURL() const = 0;
+ virtual const GURL& original_url() const = 0;
+ virtual const GURL& referrer_url() const = 0;
+ virtual std::string suggested_filename() const = 0;
+ virtual std::string content_disposition() const = 0;
+ virtual std::string mime_type() const = 0;
+ virtual std::string original_mime_type() const = 0;
+ virtual std::string referrer_charset() const = 0;
+ virtual int64 total_bytes() const = 0;
+ virtual int64 received_bytes() const = 0;
+ virtual int32 id() const = 0;
+ virtual DownloadId global_id() const = 0;
+ virtual base::Time start_time() const = 0;
+ virtual int64 db_handle() const = 0;
+ virtual DownloadManager* download_manager() = 0;
+ virtual bool is_paused() const = 0;
+ virtual bool open_when_complete() const = 0;
+ virtual bool file_externally_removed() const = 0;
+ virtual SafetyState safety_state() const = 0;
+ virtual DangerType GetDangerType() const = 0;
+ virtual bool IsDangerous() const = 0;
+ virtual bool auto_opened() const = 0;
+ virtual const FilePath& target_name() const = 0;
+ virtual bool prompt_user_for_save_location() const = 0;
+ virtual bool is_otr() const = 0;
+ virtual const FilePath& suggested_path() const = 0;
+ virtual bool is_temporary() const = 0;
+ virtual bool opened() const = 0;
+ virtual InterruptReason last_reason() const = 0;
+};
+
+#endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_INTERFACE_H_
« no previous file with comments | « content/browser/download/download_item.cc ('k') | content/browser/download/download_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698