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 // This file provides utility functions for "file tasks". | 5 // This file provides utility functions for "file tasks". |
6 // | 6 // |
7 // WHAT ARE FILE TASKS? | 7 // WHAT ARE FILE TASKS? |
8 // | 8 // |
9 // File tasks are representation of actions that can be performed over the | 9 // File tasks are representation of actions that can be performed over the |
10 // currently selected files from Files.app. A task can be either of: | 10 // currently selected files from Files.app. A task can be either of: |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 // "mount-archive" is handled very differently. The task execution business | 104 // "mount-archive" is handled very differently. The task execution business |
105 // should be simplified: crbug.com/267313 | 105 // should be simplified: crbug.com/267313 |
106 // | 106 // |
107 // See also: | 107 // See also: |
108 // ui/file_manager/file_manager/foreground/js/file_tasks.js | 108 // ui/file_manager/file_manager/foreground/js/file_tasks.js |
109 // | 109 // |
110 | 110 |
111 #ifndef CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILE_TASKS_H_ | 111 #ifndef CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILE_TASKS_H_ |
112 #define CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILE_TASKS_H_ | 112 #define CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILE_TASKS_H_ |
113 | 113 |
| 114 #include <memory> |
114 #include <set> | 115 #include <set> |
115 #include <string> | 116 #include <string> |
116 #include <vector> | 117 #include <vector> |
117 | 118 |
118 #include "base/callback_forward.h" | 119 #include "base/callback_forward.h" |
119 #include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h" | 120 #include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h" |
120 #include "chrome/common/extensions/api/file_manager_private.h" | 121 #include "chrome/common/extensions/api/file_manager_private.h" |
121 #include "url/gurl.h" | 122 #include "url/gurl.h" |
122 | 123 |
123 class PrefService; | 124 class PrefService; |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 | 283 |
283 // Finds the file browser handler tasks (app/extensions declaring | 284 // Finds the file browser handler tasks (app/extensions declaring |
284 // "file_browser_handlers" in manifest.json) that can be used with the | 285 // "file_browser_handlers" in manifest.json) that can be used with the |
285 // given files, appending them to the |result_list|. | 286 // given files, appending them to the |result_list|. |
286 void FindFileBrowserHandlerTasks( | 287 void FindFileBrowserHandlerTasks( |
287 Profile* profile, | 288 Profile* profile, |
288 const std::vector<GURL>& file_urls, | 289 const std::vector<GURL>& file_urls, |
289 std::vector<FullTaskDescriptor>* result_list); | 290 std::vector<FullTaskDescriptor>* result_list); |
290 | 291 |
291 // Callback function type for FindAllTypesOfTasks. | 292 // Callback function type for FindAllTypesOfTasks. |
292 typedef base::Callback<void(const std::vector<FullTaskDescriptor>& result)> | 293 typedef base::Callback<void( |
| 294 std::unique_ptr<std::vector<FullTaskDescriptor>> result)> |
293 FindTasksCallback; | 295 FindTasksCallback; |
294 | 296 |
295 // Finds all types (drive, file handlers, file browser handlers) of | 297 // Finds all types (drive, file handlers, file browser handlers) of |
296 // tasks. See the comment at FindDriveAppTasks() about |result_list|. | 298 // tasks. See the comment at FindDriveAppTasks() about |result_list|. |
297 // Drive app tasks will be found only if all of the files are on Drive. | 299 // Drive app tasks will be found only if all of the files are on Drive. |
298 // |drive_app_registry| can be NULL if the drive app registry is not | 300 // |drive_app_registry| can be NULL if the drive app registry is not |
299 // present. | 301 // present. |
300 // | 302 // |
301 // If |entries| contains a Google document, only the internal tasks of | 303 // If |entries| contains a Google document, only the internal tasks of |
302 // Files.app (i.e., tasks having the app ID of Files.app) are listed. | 304 // Files.app (i.e., tasks having the app ID of Files.app) are listed. |
(...skipping 10 matching lines...) Expand all Loading... |
313 // task is found (i.e. the default task may not exist in |tasks|). No tasks | 315 // task is found (i.e. the default task may not exist in |tasks|). No tasks |
314 // should be set as default before calling this function. | 316 // should be set as default before calling this function. |
315 void ChooseAndSetDefaultTask(const PrefService& pref_service, | 317 void ChooseAndSetDefaultTask(const PrefService& pref_service, |
316 const std::vector<extensions::EntryInfo>& entries, | 318 const std::vector<extensions::EntryInfo>& entries, |
317 std::vector<FullTaskDescriptor>* tasks); | 319 std::vector<FullTaskDescriptor>* tasks); |
318 | 320 |
319 } // namespace file_tasks | 321 } // namespace file_tasks |
320 } // namespace file_manager | 322 } // namespace file_manager |
321 | 323 |
322 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILE_TASKS_H_ | 324 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILE_TASKS_H_ |
OLD | NEW |