| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // This file provides task related API functions. | 5 // This file provides task related API functions. |
| 6 | 6 |
| 7 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_TASKS_H_ | 7 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_TASKS_H_ |
| 8 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_TASKS_H_ | 8 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_TASKS_H_ |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "chrome/browser/chromeos/extensions/file_manager/private_api_base.h" | 13 #include "chrome/browser/chromeos/extensions/file_manager/private_api_base.h" |
| 14 #include "chrome/browser/chromeos/file_manager/file_tasks.h" | 14 #include "chrome/browser/chromeos/file_manager/file_tasks.h" |
| 15 #include "chrome/common/extensions/api/file_browser_private.h" | 15 #include "chrome/common/extensions/api/file_manager_private.h" |
| 16 | 16 |
| 17 namespace base { | 17 namespace base { |
| 18 class FilePath; | 18 class FilePath; |
| 19 } // namespace base | 19 } // namespace base |
| 20 | 20 |
| 21 namespace extensions { | 21 namespace extensions { |
| 22 | 22 |
| 23 namespace app_file_handler_util { | 23 namespace app_file_handler_util { |
| 24 class MimeTypeCollector; | 24 class MimeTypeCollector; |
| 25 } // namespace app_file_handler_util | 25 } // namespace app_file_handler_util |
| 26 | 26 |
| 27 // Implements the chrome.fileBrowserPrivate.executeTask method. | 27 // Implements the chrome.fileManagerPrivate.executeTask method. |
| 28 class FileBrowserPrivateExecuteTaskFunction | 28 class FileManagerPrivateExecuteTaskFunction |
| 29 : public LoggedAsyncExtensionFunction { | 29 : public LoggedAsyncExtensionFunction { |
| 30 public: | 30 public: |
| 31 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.executeTask", | 31 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.executeTask", |
| 32 FILEBROWSERPRIVATE_EXECUTETASK) | 32 FILEMANAGERPRIVATE_EXECUTETASK) |
| 33 | 33 |
| 34 protected: | 34 protected: |
| 35 virtual ~FileBrowserPrivateExecuteTaskFunction() {} | 35 virtual ~FileManagerPrivateExecuteTaskFunction() {} |
| 36 | 36 |
| 37 // AsyncExtensionFunction overrides. | 37 // AsyncExtensionFunction overrides. |
| 38 virtual bool RunAsync() OVERRIDE; | 38 virtual bool RunAsync() OVERRIDE; |
| 39 | 39 |
| 40 private: | 40 private: |
| 41 void OnTaskExecuted( | 41 void OnTaskExecuted( |
| 42 extensions::api::file_browser_private::TaskResult success); | 42 extensions::api::file_manager_private::TaskResult success); |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 // Implements the chrome.fileBrowserPrivate.getFileTasks method. | 45 // Implements the chrome.fileManagerPrivate.getFileTasks method. |
| 46 class FileBrowserPrivateGetFileTasksFunction | 46 class FileManagerPrivateGetFileTasksFunction |
| 47 : public LoggedAsyncExtensionFunction { | 47 : public LoggedAsyncExtensionFunction { |
| 48 public: | 48 public: |
| 49 FileBrowserPrivateGetFileTasksFunction(); | 49 FileManagerPrivateGetFileTasksFunction(); |
| 50 | 50 |
| 51 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.getFileTasks", | 51 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.getFileTasks", |
| 52 FILEBROWSERPRIVATE_GETFILETASKS) | 52 FILEMANAGERPRIVATE_GETFILETASKS) |
| 53 | 53 |
| 54 protected: | 54 protected: |
| 55 virtual ~FileBrowserPrivateGetFileTasksFunction(); | 55 virtual ~FileManagerPrivateGetFileTasksFunction(); |
| 56 | 56 |
| 57 // AsyncExtensionFunction overrides. | 57 // AsyncExtensionFunction overrides. |
| 58 virtual bool RunAsync() OVERRIDE; | 58 virtual bool RunAsync() OVERRIDE; |
| 59 | 59 |
| 60 private: | 60 private: |
| 61 void OnMimeTypesCollected(scoped_ptr<std::vector<std::string> > mime_types); | 61 void OnMimeTypesCollected(scoped_ptr<std::vector<std::string> > mime_types); |
| 62 | 62 |
| 63 void OnSniffingMimeTypeCompleted( | 63 void OnSniffingMimeTypeCompleted( |
| 64 scoped_ptr<app_file_handler_util::PathAndMimeTypeSet> path_mime_set, | 64 scoped_ptr<app_file_handler_util::PathAndMimeTypeSet> path_mime_set, |
| 65 scoped_ptr<std::vector<GURL> > file_urls); | 65 scoped_ptr<std::vector<GURL> > file_urls); |
| 66 | 66 |
| 67 scoped_ptr<app_file_handler_util::MimeTypeCollector> collector_; | 67 scoped_ptr<app_file_handler_util::MimeTypeCollector> collector_; |
| 68 std::vector<GURL> file_urls_; | 68 std::vector<GURL> file_urls_; |
| 69 std::vector<base::FilePath> local_paths_; | 69 std::vector<base::FilePath> local_paths_; |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 // Implements the chrome.fileBrowserPrivate.setDefaultTask method. | 72 // Implements the chrome.fileManagerPrivate.setDefaultTask method. |
| 73 class FileBrowserPrivateSetDefaultTaskFunction | 73 class FileManagerPrivateSetDefaultTaskFunction |
| 74 : public ChromeSyncExtensionFunction { | 74 : public ChromeSyncExtensionFunction { |
| 75 public: | 75 public: |
| 76 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.setDefaultTask", | 76 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.setDefaultTask", |
| 77 FILEBROWSERPRIVATE_SETDEFAULTTASK) | 77 FILEMANAGERPRIVATE_SETDEFAULTTASK) |
| 78 | 78 |
| 79 protected: | 79 protected: |
| 80 virtual ~FileBrowserPrivateSetDefaultTaskFunction() {} | 80 virtual ~FileManagerPrivateSetDefaultTaskFunction() {} |
| 81 | 81 |
| 82 // SyncExtensionFunction overrides. | 82 // SyncExtensionFunction overrides. |
| 83 virtual bool RunSync() OVERRIDE; | 83 virtual bool RunSync() OVERRIDE; |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 } // namespace extensions | 86 } // namespace extensions |
| 87 | 87 |
| 88 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_TASKS_H_ | 88 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_TASKS_H_ |
| OLD | NEW |