| 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[]; |
| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 DownloadsEraseFunction(); | 163 DownloadsEraseFunction(); |
| 163 virtual bool RunImpl() OVERRIDE; | 164 virtual bool RunImpl() OVERRIDE; |
| 164 | 165 |
| 165 protected: | 166 protected: |
| 166 virtual ~DownloadsEraseFunction(); | 167 virtual ~DownloadsEraseFunction(); |
| 167 | 168 |
| 168 private: | 169 private: |
| 169 DISALLOW_COPY_AND_ASSIGN(DownloadsEraseFunction); | 170 DISALLOW_COPY_AND_ASSIGN(DownloadsEraseFunction); |
| 170 }; | 171 }; |
| 171 | 172 |
| 172 class DownloadsRemoveFileFunction : public ChromeAsyncExtensionFunction, | 173 class DownloadsRemoveFileFunction : public ChromeAsyncExtensionFunction { |
| 173 public content::DownloadItem::Observer { | |
| 174 public: | 174 public: |
| 175 DECLARE_EXTENSION_FUNCTION("downloads.removeFile", DOWNLOADS_REMOVEFILE) | 175 DECLARE_EXTENSION_FUNCTION("downloads.removeFile", DOWNLOADS_REMOVEFILE) |
| 176 DownloadsRemoveFileFunction(); | 176 DownloadsRemoveFileFunction(); |
| 177 virtual bool RunImpl() OVERRIDE; | 177 virtual bool RunImpl() OVERRIDE; |
| 178 | 178 |
| 179 protected: | 179 protected: |
| 180 virtual ~DownloadsRemoveFileFunction(); | 180 virtual ~DownloadsRemoveFileFunction(); |
| 181 | 181 |
| 182 private: | 182 private: |
| 183 virtual void OnDownloadUpdated(content::DownloadItem* item) OVERRIDE; | 183 void Done(bool success); |
| 184 virtual void OnDownloadDestroyed(content::DownloadItem* item) OVERRIDE; | |
| 185 | |
| 186 content::DownloadItem* item_; | |
| 187 | 184 |
| 188 DISALLOW_COPY_AND_ASSIGN(DownloadsRemoveFileFunction); | 185 DISALLOW_COPY_AND_ASSIGN(DownloadsRemoveFileFunction); |
| 189 }; | 186 }; |
| 190 | 187 |
| 191 class DownloadsAcceptDangerFunction : public ChromeAsyncExtensionFunction { | 188 class DownloadsAcceptDangerFunction : public ChromeAsyncExtensionFunction { |
| 192 public: | 189 public: |
| 193 typedef base::Callback<void(DownloadDangerPrompt*)> OnPromptCreatedCallback; | 190 typedef base::Callback<void(DownloadDangerPrompt*)> OnPromptCreatedCallback; |
| 194 static void OnPromptCreatedForTesting( | 191 static void OnPromptCreatedForTesting( |
| 195 OnPromptCreatedCallback* callback) { | 192 OnPromptCreatedCallback* callback) { |
| 196 on_prompt_created_ = callback; | 193 on_prompt_created_ = callback; |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 | 389 |
| 393 Profile* profile_; | 390 Profile* profile_; |
| 394 AllDownloadItemNotifier notifier_; | 391 AllDownloadItemNotifier notifier_; |
| 395 std::set<const extensions::Extension*> shelf_disabling_extensions_; | 392 std::set<const extensions::Extension*> shelf_disabling_extensions_; |
| 396 content::NotificationRegistrar registrar_; | 393 content::NotificationRegistrar registrar_; |
| 397 | 394 |
| 398 DISALLOW_COPY_AND_ASSIGN(ExtensionDownloadsEventRouter); | 395 DISALLOW_COPY_AND_ASSIGN(ExtensionDownloadsEventRouter); |
| 399 }; | 396 }; |
| 400 | 397 |
| 401 #endif // CHROME_BROWSER_EXTENSIONS_API_DOWNLOADS_DOWNLOADS_API_H_ | 398 #endif // CHROME_BROWSER_EXTENSIONS_API_DOWNLOADS_DOWNLOADS_API_H_ |
| OLD | NEW |