| Index: chrome/browser/extensions/extension_downloads.h
|
| diff --git a/chrome/browser/extensions/extension_downloads.h b/chrome/browser/extensions/extension_downloads.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..7ee2ef915e38c37b5bfcec65a7055c4c7fe5a2de
|
| --- /dev/null
|
| +++ b/chrome/browser/extensions/extension_downloads.h
|
| @@ -0,0 +1,182 @@
|
| +// 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 CHROME_BROWSER_EXTENSIONS_EXTENSION_DOWNLOADS_H_
|
| +#define CHROME_BROWSER_EXTENSIONS_EXTENSION_DOWNLOADS_H_
|
| +#pragma once
|
| +
|
| +#include <string>
|
| +#include "chrome/browser/extensions/extension_function.h"
|
| +
|
| +class DictionaryValue;
|
| +class DownloadFileManager;
|
| +class DownloadManager;
|
| +class ResourceDispatcherHost;
|
| +class TabContents;
|
| +namespace content {
|
| +class ResourceContext;
|
| +}
|
| +
|
| +// http://goo.gl/6hO1n
|
| +
|
| +class DownloadsDownloadFunction : public AsyncExtensionFunction {
|
| + public:
|
| + DownloadsDownloadFunction()
|
| + : options_(NULL),
|
| + save_as_(false),
|
| + extra_headers_(NULL),
|
| + dl_man_(NULL),
|
| + dlf_man_(NULL),
|
| + rdh_(NULL),
|
| + tab_contents_(NULL),
|
| + resource_context_(NULL),
|
| + render_process_host_id_(0),
|
| + render_view_host_routing_id_(0),
|
| + products_(NULL),
|
| + dl_id_(-1),
|
| + dl_error_(0) {
|
| + }
|
| + virtual ~DownloadsDownloadFunction() {}
|
| + DECLARE_EXTENSION_FUNCTION_NAME("experimental.downloads.download");
|
| +
|
| + virtual bool RunImpl() OVERRIDE;
|
| +
|
| + private:
|
| + void BeginDownloadOnIOThread();
|
| + void OnResponseStarted(int dl_id);
|
| + void OnUnstartable(int error);
|
| + void RespondOnUIThread();
|
| +
|
| + DictionaryValue* options_;
|
| + std::string url_;
|
| + std::string filename_;
|
| + bool save_as_;
|
| + DictionaryValue* extra_headers_;
|
| + std::string method_;
|
| + std::string post_body_;
|
| +
|
| + DownloadManager* dl_man_;
|
| + DownloadFileManager* dlf_man_;
|
| + ResourceDispatcherHost* rdh_;
|
| + TabContents* tab_contents_;
|
| + const content::ResourceContext* resource_context_;
|
| + int render_process_host_id_;
|
| + int render_view_host_routing_id_;
|
| +
|
| + DictionaryValue* products_;
|
| + int dl_id_;
|
| + int dl_error_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(DownloadsDownloadFunction);
|
| +};
|
| +
|
| +class DownloadsSearchFunction : public AsyncExtensionFunction {
|
| + public:
|
| + DownloadsSearchFunction() {}
|
| + virtual ~DownloadsSearchFunction() {}
|
| + DECLARE_EXTENSION_FUNCTION_NAME("experimental.downloads.query");
|
| +
|
| + virtual bool RunImpl() OVERRIDE;
|
| +
|
| + private:
|
| + DISALLOW_COPY_AND_ASSIGN(DownloadsSearchFunction);
|
| +};
|
| +
|
| +class DownloadsPauseFunction : public AsyncExtensionFunction {
|
| + public:
|
| + DownloadsPauseFunction() {}
|
| + virtual ~DownloadsPauseFunction() {}
|
| + DECLARE_EXTENSION_FUNCTION_NAME("experimental.downloads.pause");
|
| +
|
| + virtual bool RunImpl() OVERRIDE;
|
| +
|
| + private:
|
| + DISALLOW_COPY_AND_ASSIGN(DownloadsPauseFunction);
|
| +};
|
| +
|
| +class DownloadsResumeFunction : public AsyncExtensionFunction {
|
| + public:
|
| + DownloadsResumeFunction() {}
|
| + virtual ~DownloadsResumeFunction() {}
|
| + DECLARE_EXTENSION_FUNCTION_NAME("experimental.downloads.resume");
|
| +
|
| + virtual bool RunImpl() OVERRIDE;
|
| +
|
| + private:
|
| + DISALLOW_COPY_AND_ASSIGN(DownloadsResumeFunction);
|
| +};
|
| +
|
| +class DownloadsCancelFunction : public AsyncExtensionFunction {
|
| + public:
|
| + DownloadsCancelFunction() {}
|
| + virtual ~DownloadsCancelFunction() {}
|
| + DECLARE_EXTENSION_FUNCTION_NAME("experimental.downloads.cancel");
|
| +
|
| + virtual bool RunImpl() OVERRIDE;
|
| +
|
| + private:
|
| + DISALLOW_COPY_AND_ASSIGN(DownloadsCancelFunction);
|
| +};
|
| +
|
| +class DownloadsEraseFunction : public AsyncExtensionFunction {
|
| + public:
|
| + DownloadsEraseFunction() {}
|
| + virtual ~DownloadsEraseFunction() {}
|
| + DECLARE_EXTENSION_FUNCTION_NAME("experimental.downloads.erase");
|
| +
|
| + virtual bool RunImpl() OVERRIDE;
|
| +
|
| + private:
|
| + DISALLOW_COPY_AND_ASSIGN(DownloadsEraseFunction);
|
| +};
|
| +
|
| +class DownloadsSetDestinationFunction : public AsyncExtensionFunction {
|
| + public:
|
| + DownloadsSetDestinationFunction() {}
|
| + virtual ~DownloadsSetDestinationFunction() {}
|
| + DECLARE_EXTENSION_FUNCTION_NAME("experimental.downloads.set_destination");
|
| +
|
| + virtual bool RunImpl() OVERRIDE;
|
| +
|
| + private:
|
| + DISALLOW_COPY_AND_ASSIGN(DownloadsSetDestinationFunction);
|
| +};
|
| +
|
| +class DownloadsAcceptDangerFunction : public AsyncExtensionFunction {
|
| + public:
|
| + DownloadsAcceptDangerFunction() {}
|
| + virtual ~DownloadsAcceptDangerFunction() {}
|
| + DECLARE_EXTENSION_FUNCTION_NAME("experimental.downloads.accept_danger");
|
| +
|
| + virtual bool RunImpl() OVERRIDE;
|
| +
|
| + private:
|
| + DISALLOW_COPY_AND_ASSIGN(DownloadsAcceptDangerFunction);
|
| +};
|
| +
|
| +class DownloadsShowFunction : public AsyncExtensionFunction {
|
| + public:
|
| + DownloadsShowFunction() {}
|
| + virtual ~DownloadsShowFunction() {}
|
| + DECLARE_EXTENSION_FUNCTION_NAME("experimental.downloads.show");
|
| +
|
| + virtual bool RunImpl() OVERRIDE;
|
| +
|
| + private:
|
| + DISALLOW_COPY_AND_ASSIGN(DownloadsShowFunction);
|
| +};
|
| +
|
| +class DownloadsDragFunction : public AsyncExtensionFunction {
|
| + public:
|
| + DownloadsDragFunction() {}
|
| + virtual ~DownloadsDragFunction() {}
|
| + DECLARE_EXTENSION_FUNCTION_NAME("experimental.downloads.drag");
|
| +
|
| + virtual bool RunImpl() OVERRIDE;
|
| +
|
| + private:
|
| + DISALLOW_COPY_AND_ASSIGN(DownloadsDragFunction);
|
| +};
|
| +
|
| +#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_DOWNLOADS_H_
|
|
|