Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_DOWNLOADS_DOWNLOADS_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_DOWNLOADS_DOWNLOADS_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_DOWNLOADS_DOWNLOADS_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_DOWNLOADS_DOWNLOADS_API_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 34 | 34 |
| 35 // Functions in the chrome.downloads namespace facilitate | 35 // Functions in the chrome.downloads namespace facilitate |
| 36 // controlling downloads from extensions. See the full API doc at | 36 // controlling downloads from extensions. See the full API doc at |
| 37 // http://goo.gl/6hO1n | 37 // http://goo.gl/6hO1n |
| 38 | 38 |
| 39 namespace download_extension_errors { | 39 namespace download_extension_errors { |
| 40 | 40 |
| 41 // Errors that can be returned through chrome.runtime.lastError.message. | 41 // Errors that can be returned through chrome.runtime.lastError.message. |
| 42 extern const char kEmptyFile[]; | 42 extern const char kEmptyFile[]; |
| 43 extern const char kFileAlreadyDeleted[]; | 43 extern const char kFileAlreadyDeleted[]; |
| 44 extern const char kFileNotRemoved[]; | |
|
asargent_no_longer_on_chrome
2014/01/14 22:36:04
nit: Is this constant (or any of the others here)
benjhayden
2014/01/16 00:13:24
Yes, most of them are used in downloads_api_browse
| |
| 44 extern const char kIconNotFound[]; | 45 extern const char kIconNotFound[]; |
| 45 extern const char kInvalidDangerType[]; | 46 extern const char kInvalidDangerType[]; |
| 46 extern const char kInvalidFilename[]; | 47 extern const char kInvalidFilename[]; |
| 47 extern const char kInvalidFilter[]; | 48 extern const char kInvalidFilter[]; |
| 48 extern const char kInvalidHeader[]; | 49 extern const char kInvalidHeader[]; |
| 49 extern const char kInvalidId[]; | 50 extern const char kInvalidId[]; |
| 50 extern const char kInvalidOrderBy[]; | 51 extern const char kInvalidOrderBy[]; |
| 51 extern const char kInvalidQueryLimit[]; | 52 extern const char kInvalidQueryLimit[]; |
| 52 extern const char kInvalidState[]; | 53 extern const char kInvalidState[]; |
| 53 extern const char kInvalidURL[]; | 54 extern const char kInvalidURL[]; |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 163 DownloadsEraseFunction(); | 164 DownloadsEraseFunction(); |
| 164 virtual bool RunImpl() OVERRIDE; | 165 virtual bool RunImpl() OVERRIDE; |
| 165 | 166 |
| 166 protected: | 167 protected: |
| 167 virtual ~DownloadsEraseFunction(); | 168 virtual ~DownloadsEraseFunction(); |
| 168 | 169 |
| 169 private: | 170 private: |
| 170 DISALLOW_COPY_AND_ASSIGN(DownloadsEraseFunction); | 171 DISALLOW_COPY_AND_ASSIGN(DownloadsEraseFunction); |
| 171 }; | 172 }; |
| 172 | 173 |
| 173 class DownloadsRemoveFileFunction : public ChromeAsyncExtensionFunction, | 174 class DownloadsRemoveFileFunction : public ChromeAsyncExtensionFunction { |
| 174 public content::DownloadItem::Observer { | |
| 175 public: | 175 public: |
| 176 DECLARE_EXTENSION_FUNCTION("downloads.removeFile", DOWNLOADS_REMOVEFILE) | 176 DECLARE_EXTENSION_FUNCTION("downloads.removeFile", DOWNLOADS_REMOVEFILE) |
| 177 DownloadsRemoveFileFunction(); | 177 DownloadsRemoveFileFunction(); |
| 178 virtual bool RunImpl() OVERRIDE; | 178 virtual bool RunImpl() OVERRIDE; |
| 179 | 179 |
| 180 protected: | 180 protected: |
| 181 virtual ~DownloadsRemoveFileFunction(); | 181 virtual ~DownloadsRemoveFileFunction(); |
| 182 | 182 |
| 183 private: | 183 private: |
| 184 virtual void OnDownloadUpdated(content::DownloadItem* item) OVERRIDE; | 184 void Done(bool success); |
| 185 virtual void OnDownloadDestroyed(content::DownloadItem* item) OVERRIDE; | |
| 186 | |
| 187 content::DownloadItem* item_; | |
| 188 | 185 |
| 189 DISALLOW_COPY_AND_ASSIGN(DownloadsRemoveFileFunction); | 186 DISALLOW_COPY_AND_ASSIGN(DownloadsRemoveFileFunction); |
| 190 }; | 187 }; |
| 191 | 188 |
| 192 class DownloadsAcceptDangerFunction : public ChromeAsyncExtensionFunction { | 189 class DownloadsAcceptDangerFunction : public ChromeAsyncExtensionFunction { |
| 193 public: | 190 public: |
| 194 typedef base::Callback<void(DownloadDangerPrompt*)> OnPromptCreatedCallback; | 191 typedef base::Callback<void(DownloadDangerPrompt*)> OnPromptCreatedCallback; |
| 195 static void OnPromptCreatedForTesting( | 192 static void OnPromptCreatedForTesting( |
| 196 OnPromptCreatedCallback* callback) { | 193 OnPromptCreatedCallback* callback) { |
| 197 on_prompt_created_ = callback; | 194 on_prompt_created_ = callback; |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 393 | 390 |
| 394 Profile* profile_; | 391 Profile* profile_; |
| 395 AllDownloadItemNotifier notifier_; | 392 AllDownloadItemNotifier notifier_; |
| 396 std::set<const extensions::Extension*> shelf_disabling_extensions_; | 393 std::set<const extensions::Extension*> shelf_disabling_extensions_; |
| 397 content::NotificationRegistrar registrar_; | 394 content::NotificationRegistrar registrar_; |
| 398 | 395 |
| 399 DISALLOW_COPY_AND_ASSIGN(ExtensionDownloadsEventRouter); | 396 DISALLOW_COPY_AND_ASSIGN(ExtensionDownloadsEventRouter); |
| 400 }; | 397 }; |
| 401 | 398 |
| 402 #endif // CHROME_BROWSER_EXTENSIONS_API_DOWNLOADS_DOWNLOADS_API_H_ | 399 #endif // CHROME_BROWSER_EXTENSIONS_API_DOWNLOADS_DOWNLOADS_API_H_ |
| OLD | NEW |