Index: chrome/browser/chromeos/extensions/file_manager/file_tasks.h |
diff --git a/chrome/browser/chromeos/extensions/file_manager/file_tasks.h b/chrome/browser/chromeos/extensions/file_manager/file_tasks.h |
index b9eee37e7a7b6ea32a75f6f9d701d8c61ef285d9..37c04f084fbd1b766874e2239d7c020afb006681 100644 |
--- a/chrome/browser/chromeos/extensions/file_manager/file_tasks.h |
+++ b/chrome/browser/chromeos/extensions/file_manager/file_tasks.h |
@@ -116,11 +116,16 @@ |
#include "base/basictypes.h" |
#include "base/callback_forward.h" |
+#include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h" |
class GURL; |
class PrefService; |
class Profile; |
+namespace drive { |
+class DriveAppRegistry; |
+} |
+ |
namespace fileapi { |
class FileSystemURL; |
} |
@@ -219,6 +224,80 @@ bool ExecuteFileTask(Profile* profile, |
const std::vector<fileapi::FileSystemURL>& file_urls, |
const FileTaskFinishedCallback& done); |
+typedef extensions::app_file_handler_util::PathAndMimeTypeSet |
+ PathAndMimeTypeSet; |
+ |
+// Holds fields to build a task result. |
+struct TaskInfo; |
+ |
+// Map from a task id to TaskInfo. |
+typedef std::map<std::string, TaskInfo> TaskInfoMap; |
+ |
+// Looks up available apps for each file in |path_mime_set| in the |
+// |registry|, and returns the intersection of all available apps as a |
+// map from task id to TaskInfo. |
+void GetAvailableDriveTasks(const drive::DriveAppRegistry& registry, |
+ const PathAndMimeTypeSet& path_mime_set, |
+ TaskInfoMap* task_info_map); |
+ |
+// Looks in the preferences and finds any of the available apps that are |
+// also listed as default apps for any of the files in the info list. |
+void FindDefaultDriveTasks(const PrefService& pref_service, |
+ const PathAndMimeTypeSet& path_mime_set, |
+ const TaskInfoMap& task_info_map, |
+ std::set<std::string>* default_tasks); |
+ |
+// Creates a list of each task in |task_info_map| and stores the result into |
+// |result_list|. If a default task is set in the result list, |
+// |default_already_set| is set to true. |
+void CreateDriveTasks(const TaskInfoMap& task_info_map, |
+ const std::set<std::string>& default_tasks, |
+ ListValue* result_list, |
+ bool* default_already_set); |
+ |
+// Finds the drive app tasks that can be used with the given files, and |
+// append them to the |result_list|. |*default_already_set| indicates if |
+// the |result_list| already contains the default task. If the value is |
+// false, the function will find the default task and set the value to true |
+// if found. |
+// |
+// "taskId" field in |result_list| will look like |
+// "<drive-app-id>|drive|open-with" (See also file_tasks.h). |
+// "driveApp" field in |result_list| will be set to "true". |
+void FindDriveAppTasks(Profile* profile, |
+ const PathAndMimeTypeSet& path_mime_set, |
+ ListValue* result_list, |
+ bool* default_already_set); |
+ |
+// Finds the file handler tasks (apps declaring "file_handlers" in |
+// manifest.json) that can be used with the given files, appending them to |
+// the |result_list|. See the comment at FindDriveAppTasks() about |
+// |default_already_set| |
+void FindFileHandlerTasks(Profile* profile, |
+ const PathAndMimeTypeSet& path_mime_set, |
+ ListValue* result_list, |
+ bool* default_already_set); |
+ |
+// Finds the file browser handler tasks (app/extensions declaring |
+// "file_browser_handlers" in manifest.json) that can be used with the |
+// given files, appending them to the |result_list|. See the comment at |
+// FindDriveAppTasks() about |default_already_set| |
+void FindFileBrowserHandlerTasks( |
+ Profile* profile, |
+ const std::vector<GURL>& file_urls, |
+ const std::vector<base::FilePath>& file_paths, |
+ ListValue* result_list, |
+ bool* default_already_set); |
+ |
+// Finds all types (drive, file handlers, file browser handlers) of |
+// tasks. See the comment at FindDriveAppTasks() about |result_list|. |
+void FindAllTypesOfTasks( |
+ Profile* profile, |
+ const PathAndMimeTypeSet& path_mime_set, |
+ const std::vector<GURL>& file_urls, |
+ const std::vector<base::FilePath>& file_paths, |
+ ListValue* result_list); |
+ |
} // namespace file_tasks |
} // namespace file_manager |