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 utility functions for file browser handlers. | 5 // This file provides utility functions for file browser handlers. |
6 // https://developer.chrome.com/extensions/fileBrowserHandler.html | 6 // https://developer.chrome.com/extensions/fileBrowserHandler.html |
7 | 7 |
8 #ifndef CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILE_BROWSER_HANDLERS_H_ | 8 #ifndef CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILE_BROWSER_HANDLERS_H_ |
9 #define CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILE_BROWSER_HANDLERS_H_ | 9 #define CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILE_BROWSER_HANDLERS_H_ |
10 | 10 |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
15 #include "base/callback_forward.h" | 15 #include "base/callback_forward.h" |
16 #include "chrome/browser/chromeos/file_manager/file_tasks.h" | 16 #include "chrome/browser/chromeos/file_manager/file_tasks.h" |
17 | 17 |
18 class FileBrowserHandler; | 18 class FileBrowserHandler; |
19 class GURL; | 19 class GURL; |
20 class Profile; | 20 class Profile; |
21 | 21 |
22 namespace base { | |
23 class FilePath; | |
24 } | |
25 | |
26 namespace extensions { | 22 namespace extensions { |
27 class Extension; | 23 class Extension; |
28 } | 24 } |
29 | 25 |
30 namespace fileapi { | 26 namespace fileapi { |
31 class FileSystemURL; | 27 class FileSystemURL; |
32 } | 28 } |
33 | 29 |
34 namespace file_manager { | 30 namespace file_manager { |
35 namespace file_browser_handlers { | 31 namespace file_browser_handlers { |
36 | 32 |
37 // Tasks are stored as a vector in order of priorities. | 33 // Tasks are stored as a vector in order of priorities. |
38 typedef std::vector<const FileBrowserHandler*> FileBrowserHandlerList; | 34 typedef std::vector<const FileBrowserHandler*> FileBrowserHandlerList; |
39 | 35 |
40 // Returns true if the given task is a fallback file browser handler. Such | |
41 // handlers are Files.app's internal handlers as well as quick office | |
42 // extensions. | |
43 bool IsFallbackFileBrowserHandler(const file_tasks::TaskDescriptor& task); | |
44 | |
45 // Returns the list of file browser handlers that can open all files in | 36 // Returns the list of file browser handlers that can open all files in |
46 // |file_list|. | 37 // |file_list|. |
47 FileBrowserHandlerList FindFileBrowserHandlers( | 38 FileBrowserHandlerList FindFileBrowserHandlers( |
48 Profile* profile, | 39 Profile* profile, |
49 const std::vector<GURL>& file_list); | 40 const std::vector<GURL>& file_list); |
50 | 41 |
51 // Executes a file browser handler specified by |extension| of the given | 42 // Executes a file browser handler specified by |extension| of the given |
52 // action ID for |file_urls|. Returns false if undeclared handlers are | 43 // action ID for |file_urls|. Returns false if undeclared handlers are |
53 // found. |done| is on completion. See also the comment at ExecuteFileTask() | 44 // found. |done| is on completion. See also the comment at ExecuteFileTask() |
54 // for other parameters. | 45 // for other parameters. |
55 bool ExecuteFileBrowserHandler( | 46 bool ExecuteFileBrowserHandler( |
56 Profile* profile, | 47 Profile* profile, |
57 const extensions::Extension* extension, | 48 const extensions::Extension* extension, |
58 const std::string& action_id, | 49 const std::string& action_id, |
59 const std::vector<fileapi::FileSystemURL>& file_urls, | 50 const std::vector<fileapi::FileSystemURL>& file_urls, |
60 const file_tasks::FileTaskFinishedCallback& done); | 51 const file_tasks::FileTaskFinishedCallback& done); |
61 | 52 |
62 } // namespace file_browser_handlers | 53 } // namespace file_browser_handlers |
63 } // namespace file_manager | 54 } // namespace file_manager |
64 | 55 |
65 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILE_BROWSER_HANDLERS_H_ | 56 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILE_BROWSER_HANDLERS_H_ |
OLD | NEW |