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
3 // found in the LICENSE file.
5 // This file provides task related API functions.
7 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_TASKS_H_
8 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_TASKS_H_
12 #include "base/memory/scoped_ptr.h"
13 #include "chrome/browser/chromeos/extensions/file_manager/private_api_base.h"
14 #include "chrome/browser/chromeos/file_manager/file_tasks.h"
15 #include "chrome/common/extensions/api/file_manager_private.h"
21 namespace extensions
{
23 namespace app_file_handler_util
{
24 class MimeTypeCollector
;
25 } // namespace app_file_handler_util
27 // Implements the chrome.fileManagerPrivate.executeTask method.
28 class FileManagerPrivateExecuteTaskFunction
29 : public LoggedAsyncExtensionFunction
{
31 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.executeTask",
32 FILEMANAGERPRIVATE_EXECUTETASK
)
35 ~FileManagerPrivateExecuteTaskFunction() override
{}
37 // AsyncExtensionFunction overrides.
38 bool RunAsync() override
;
42 extensions::api::file_manager_private::TaskResult success
);
45 // Implements the chrome.fileManagerPrivate.getFileTasks method.
46 class FileManagerPrivateGetFileTasksFunction
47 : public LoggedAsyncExtensionFunction
{
49 FileManagerPrivateGetFileTasksFunction();
51 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.getFileTasks",
52 FILEMANAGERPRIVATE_GETFILETASKS
)
55 ~FileManagerPrivateGetFileTasksFunction() override
;
57 // AsyncExtensionFunction overrides.
58 bool RunAsync() override
;
61 void OnMimeTypesCollected(scoped_ptr
<std::vector
<std::string
> > mime_types
);
63 void OnSniffingMimeTypeCompleted(
64 scoped_ptr
<app_file_handler_util::PathAndMimeTypeSet
> path_mime_set
,
65 scoped_ptr
<std::vector
<GURL
> > file_urls
);
67 scoped_ptr
<app_file_handler_util::MimeTypeCollector
> collector_
;
68 std::vector
<GURL
> file_urls_
;
69 std::vector
<base::FilePath
> local_paths_
;
72 // Implements the chrome.fileManagerPrivate.setDefaultTask method.
73 class FileManagerPrivateSetDefaultTaskFunction
74 : public ChromeSyncExtensionFunction
{
76 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.setDefaultTask",
77 FILEMANAGERPRIVATE_SETDEFAULTTASK
)
80 ~FileManagerPrivateSetDefaultTaskFunction() override
{}
82 // SyncExtensionFunction overrides.
83 bool RunSync() override
;
86 } // namespace extensions
88 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_TASKS_H_