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

Side by Side Diff: chrome/browser/extensions/extension_downloads_api.h

Issue 7480046: chrome.experimental.downloads stubs (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: " Created 9 years, 4 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 CHROME_BROWSER_EXTENSIONS_EXTENSION_DOWNLOADS_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_DOWNLOADS_API_H_
7 #pragma once
8
9 #include <map>
10 #include <set>
11 #include <string>
12
13 #include "base/memory/singleton.h"
14 #include "chrome/browser/download/download_item.h"
15 #include "chrome/browser/download/download_manager.h"
16 #include "chrome/browser/extensions/extension_function.h"
17
18 namespace base {
19 class DictionaryValue;
20 }
21 class ResourceDispatcherHost;
22 class TabContents;
23 namespace content {
24 class ResourceContext;
25 }
26
27 // Functions in the chrome.experimental.downloads namespace facilitate
28 // controlling downloads from extensions. See the full API doc at
29 // http://goo.gl/6hO1n
30
31 class DownloadsDownloadFunction : public AsyncExtensionFunction {
32 public:
33 DownloadsDownloadFunction()
34 : options_(NULL),
35 save_as_(false),
36 extra_headers_(NULL),
37 dl_man_(NULL),
38 rdh_(NULL),
39 tab_contents_(NULL),
40 resource_context_(NULL),
41 render_process_host_id_(0),
42 render_view_host_routing_id_(0),
43 products_(NULL),
44 dl_id_(-1),
45 dl_error_(0) {
46 }
47 virtual ~DownloadsDownloadFunction() {}
48 DECLARE_EXTENSION_FUNCTION_NAME("experimental.downloads.download");
49
50 virtual bool RunImpl() OVERRIDE;
51
52 private:
53 void BeginDownloadOnIOThread();
Mihai Parparita -not on Chrome 2011/07/28 23:18:29 These functions don't appear to have implementatio
benjhayden 2011/08/01 21:43:51 Done.
54 void OnStarted(int dl_id, int error);
55 void RespondOnUIThread();
56
57 base::DictionaryValue* options_;
Mihai Parparita -not on Chrome 2011/07/28 23:18:29 Do you actually need all the all the arguments as
benjhayden 2011/08/01 21:43:51 Done.
58 std::string url_;
59 std::string filename_;
60 bool save_as_;
61 base::DictionaryValue* extra_headers_;
62 std::string method_;
63 std::string post_body_;
64
65 DownloadManager* dl_man_;
66 ResourceDispatcherHost* rdh_;
67 TabContents* tab_contents_;
68 const content::ResourceContext* resource_context_;
69 int render_process_host_id_;
70 int render_view_host_routing_id_;
71
72 base::DictionaryValue* products_;
73 int dl_id_;
74 int dl_error_;
75
76 DISALLOW_COPY_AND_ASSIGN(DownloadsDownloadFunction);
77 };
78
79 class DownloadsSearchFunction : public SyncExtensionFunction {
80 public:
81 DownloadsSearchFunction() {}
82 virtual ~DownloadsSearchFunction() {}
83 DECLARE_EXTENSION_FUNCTION_NAME("experimental.downloads.search");
84
85 virtual bool RunImpl() OVERRIDE;
86
87 private:
88 DISALLOW_COPY_AND_ASSIGN(DownloadsSearchFunction);
89 };
90
91 class DownloadsPauseFunction : public SyncExtensionFunction {
92 public:
93 DownloadsPauseFunction() {}
94 virtual ~DownloadsPauseFunction() {}
95 DECLARE_EXTENSION_FUNCTION_NAME("experimental.downloads.pause");
96
97 virtual bool RunImpl() OVERRIDE;
98
99 private:
100 DISALLOW_COPY_AND_ASSIGN(DownloadsPauseFunction);
101 };
102
103 class DownloadsResumeFunction : public AsyncExtensionFunction {
104 public:
105 DownloadsResumeFunction() {}
106 virtual ~DownloadsResumeFunction() {}
107 DECLARE_EXTENSION_FUNCTION_NAME("experimental.downloads.resume");
108
109 virtual bool RunImpl() OVERRIDE;
110
111 private:
112 DISALLOW_COPY_AND_ASSIGN(DownloadsResumeFunction);
113 };
114
115 class DownloadsCancelFunction : public AsyncExtensionFunction {
116 public:
117 DownloadsCancelFunction() {}
118 virtual ~DownloadsCancelFunction() {}
119 DECLARE_EXTENSION_FUNCTION_NAME("experimental.downloads.cancel");
120
121 virtual bool RunImpl() OVERRIDE;
122
123 private:
124 DISALLOW_COPY_AND_ASSIGN(DownloadsCancelFunction);
125 };
126
127 class DownloadsEraseFunction : public AsyncExtensionFunction {
128 public:
129 DownloadsEraseFunction() {}
130 virtual ~DownloadsEraseFunction() {}
131 DECLARE_EXTENSION_FUNCTION_NAME("experimental.downloads.erase");
132
133 virtual bool RunImpl() OVERRIDE;
134
135 private:
136 DISALLOW_COPY_AND_ASSIGN(DownloadsEraseFunction);
137 };
138
139 class DownloadsSetDestinationFunction : public AsyncExtensionFunction {
140 public:
141 DownloadsSetDestinationFunction() {}
142 virtual ~DownloadsSetDestinationFunction() {}
143 DECLARE_EXTENSION_FUNCTION_NAME("experimental.downloads.setDestination");
144
145 virtual bool RunImpl() OVERRIDE;
146
147 private:
148 DISALLOW_COPY_AND_ASSIGN(DownloadsSetDestinationFunction);
149 };
150
151 class DownloadsAcceptDangerFunction : public AsyncExtensionFunction {
152 public:
153 DownloadsAcceptDangerFunction() {}
154 virtual ~DownloadsAcceptDangerFunction() {}
155 DECLARE_EXTENSION_FUNCTION_NAME("experimental.downloads.acceptDanger");
156
157 virtual bool RunImpl() OVERRIDE;
158
159 private:
160 DISALLOW_COPY_AND_ASSIGN(DownloadsAcceptDangerFunction);
161 };
162
163 class DownloadsShowFunction : public AsyncExtensionFunction {
164 public:
165 DownloadsShowFunction() {}
166 virtual ~DownloadsShowFunction() {}
167 DECLARE_EXTENSION_FUNCTION_NAME("experimental.downloads.show");
168
169 virtual bool RunImpl() OVERRIDE;
170
171 private:
172 DISALLOW_COPY_AND_ASSIGN(DownloadsShowFunction);
173 };
174
175 class DownloadsDragFunction : public AsyncExtensionFunction {
176 public:
177 DownloadsDragFunction() {}
178 virtual ~DownloadsDragFunction() {}
179 DECLARE_EXTENSION_FUNCTION_NAME("experimental.downloads.drag");
180
181 virtual bool RunImpl() OVERRIDE;
182
183 private:
184 DISALLOW_COPY_AND_ASSIGN(DownloadsDragFunction);
185 };
186 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_DOWNLOADS_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698