| Index: chrome/browser/extensions/api/downloads/downloads_api.h
|
| diff --git a/chrome/browser/extensions/api/downloads/downloads_api.h b/chrome/browser/extensions/api/downloads/downloads_api.h
|
| index 77b77770e72d0b6da5438bffac335cb598f40504..b2a62745f49152341bd0c80630d7bd114f325413 100644
|
| --- a/chrome/browser/extensions/api/downloads/downloads_api.h
|
| +++ b/chrome/browser/extensions/api/downloads/downloads_api.h
|
| @@ -12,6 +12,7 @@
|
| #include "base/strings/string16.h"
|
| #include "base/values.h"
|
| #include "chrome/browser/download/all_download_item_notifier.h"
|
| +#include "chrome/browser/download/download_danger_prompt.h"
|
| #include "chrome/browser/download/download_path_reservation_tracker.h"
|
| #include "chrome/browser/extensions/event_router.h"
|
| #include "chrome/browser/extensions/extension_function.h"
|
| @@ -34,18 +35,27 @@ class ResourceDispatcherHost;
|
| namespace download_extension_errors {
|
|
|
| // Errors that can be returned through chrome.runtime.lastError.message.
|
| -extern const char kGenericError[];
|
| -extern const char kIconNotFoundError[];
|
| -extern const char kInvalidDangerTypeError[];
|
| -extern const char kInvalidFilenameError[];
|
| -extern const char kInvalidFilterError[];
|
| -extern const char kInvalidOperationError[];
|
| -extern const char kInvalidOrderByError[];
|
| +extern const char kEmptyFile[];
|
| +extern const char kFileAlreadyDeleted[];
|
| +extern const char kFileIsDirectory[];
|
| +extern const char kIconNotFound[];
|
| +extern const char kInvalidDangerType[];
|
| +extern const char kInvalidFilename[];
|
| +extern const char kInvalidFilter[];
|
| +extern const char kInvalidHeader[];
|
| +extern const char kInvalidId[];
|
| +extern const char kInvalidOrderBy[];
|
| extern const char kInvalidQueryLimit[];
|
| -extern const char kInvalidStateError[];
|
| -extern const char kInvalidURLError[];
|
| -extern const char kNotImplementedError[];
|
| -extern const char kTooManyListenersError[];
|
| +extern const char kInvalidState[];
|
| +extern const char kInvalidURL[];
|
| +extern const char kInvisibleContext[];
|
| +extern const char kNotComplete[];
|
| +extern const char kNotDangerous[];
|
| +extern const char kNotImplemented[];
|
| +extern const char kNotInProgress[];
|
| +extern const char kNotPermittedURL[];
|
| +extern const char kTooManyListeners[];
|
| +extern const char kUnexpectedDeterminer[];
|
|
|
| } // namespace download_extension_errors
|
|
|
| @@ -60,7 +70,12 @@ class DownloadsDownloadFunction : public AsyncExtensionFunction {
|
| virtual ~DownloadsDownloadFunction();
|
|
|
| private:
|
| - void OnStarted(content::DownloadItem* item, net::Error error);
|
| + void OnStarted(
|
| + const base::FilePath& creator_suggested_filename,
|
| + extensions::api::downloads::FilenameConflictAction
|
| + creator_conflict_action,
|
| + content::DownloadItem* item,
|
| + net::Error error);
|
|
|
| DISALLOW_COPY_AND_ASSIGN(DownloadsDownloadFunction);
|
| };
|
| @@ -130,6 +145,21 @@ class DownloadsEraseFunction : public SyncExtensionFunction {
|
| DISALLOW_COPY_AND_ASSIGN(DownloadsEraseFunction);
|
| };
|
|
|
| +class DownloadsDeleteFileFunction : public AsyncExtensionFunction {
|
| + public:
|
| + DECLARE_EXTENSION_FUNCTION("downloads.deleteFile", DOWNLOADS_DELETEFILE)
|
| + DownloadsDeleteFileFunction();
|
| + virtual bool RunImpl() OVERRIDE;
|
| +
|
| + protected:
|
| + virtual ~DownloadsDeleteFileFunction();
|
| +
|
| + private:
|
| + void DeleteOnFileThread(const base::FilePath& path);
|
| + void RespondOnUIThread();
|
| + DISALLOW_COPY_AND_ASSIGN(DownloadsDeleteFileFunction);
|
| +};
|
| +
|
| class DownloadsAcceptDangerFunction : public AsyncExtensionFunction {
|
| public:
|
| DECLARE_EXTENSION_FUNCTION("downloads.acceptDanger", DOWNLOADS_ACCEPTDANGER)
|
| @@ -138,7 +168,8 @@ class DownloadsAcceptDangerFunction : public AsyncExtensionFunction {
|
|
|
| protected:
|
| virtual ~DownloadsAcceptDangerFunction();
|
| - void DangerPromptCallback(bool accept, int download_id);
|
| + void DangerPromptCallback(int download_id,
|
| + DownloadDangerPrompt::Action action);
|
|
|
| private:
|
| DISALLOW_COPY_AND_ASSIGN(DownloadsAcceptDangerFunction);
|
| @@ -183,6 +214,20 @@ class DownloadsDragFunction : public AsyncExtensionFunction {
|
| DISALLOW_COPY_AND_ASSIGN(DownloadsDragFunction);
|
| };
|
|
|
| +class DownloadsSetShelfVisibleFunction : public SyncExtensionFunction {
|
| + public:
|
| + DECLARE_EXTENSION_FUNCTION("downloads.setShelfVisible",
|
| + DOWNLOADS_SETSHELFVISIBLE)
|
| + DownloadsSetShelfVisibleFunction();
|
| + virtual bool RunImpl() OVERRIDE;
|
| +
|
| + protected:
|
| + virtual ~DownloadsSetShelfVisibleFunction();
|
| +
|
| + private:
|
| + DISALLOW_COPY_AND_ASSIGN(DownloadsSetShelfVisibleFunction);
|
| +};
|
| +
|
| class DownloadsGetFileIconFunction : public AsyncExtensionFunction {
|
| public:
|
| DECLARE_EXTENSION_FUNCTION("downloads.getFileIcon", DOWNLOADS_GETFILEICON)
|
|
|