Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Unified Diff: chrome/browser/chromeos/extensions/file_manager/file_tasks.h

Issue 23710012: file_manager: Move "find tasks" stuff to file_tasks.h/cc as-is (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/chromeos/extensions/file_manager/file_tasks.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | chrome/browser/chromeos/extensions/file_manager/file_tasks.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698