| 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_EXTENSIONS_FILE_MANAGER_FILE_BROWSER_HANDLERS_H_ | 8 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_FILE_BROWSER_HANDLERS_H_ |
| 9 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_FILE_BROWSER_HANDLERS_H_ | 9 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_FILE_BROWSER_HANDLERS_H_ |
| 10 | 10 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 namespace file_browser_handlers { | 36 namespace file_browser_handlers { |
| 37 | 37 |
| 38 // Tasks are stored as a vector in order of priorities. | 38 // Tasks are stored as a vector in order of priorities. |
| 39 typedef std::vector<const FileBrowserHandler*> FileBrowserHandlerList; | 39 typedef std::vector<const FileBrowserHandler*> FileBrowserHandlerList; |
| 40 | 40 |
| 41 // Returns true if the given task is a fallback file browser handler. Such | 41 // Returns true if the given task is a fallback file browser handler. Such |
| 42 // handlers are Files.app's internal handlers as well as quick office | 42 // handlers are Files.app's internal handlers as well as quick office |
| 43 // extensions. | 43 // extensions. |
| 44 bool IsFallbackFileBrowserHandler(const file_tasks::TaskDescriptor& task); | 44 bool IsFallbackFileBrowserHandler(const file_tasks::TaskDescriptor& task); |
| 45 | 45 |
| 46 // Finds file browser handlers set as default from |common_tasks| for | |
| 47 // |file_list|. If no handlers are set as default, choose the the firstly | |
| 48 // found fallback handler as default. | |
| 49 FileBrowserHandlerList FindDefaultFileBrowserHandlers( | |
| 50 const PrefService& pref_service, | |
| 51 const std::vector<base::FilePath>& file_list, | |
| 52 const FileBrowserHandlerList& common_tasks); | |
| 53 | |
| 54 // Returns the list of file browser handlers that can open all files in | 46 // Returns the list of file browser handlers that can open all files in |
| 55 // |file_list|. | 47 // |file_list|. |
| 56 FileBrowserHandlerList FindCommonFileBrowserHandlers( | 48 FileBrowserHandlerList FindFileBrowserHandlers( |
| 57 Profile* profile, | 49 Profile* profile, |
| 58 const std::vector<GURL>& file_list); | 50 const std::vector<GURL>& file_list); |
| 59 | 51 |
| 60 // Finds a file browser handler for a file whose URL is |url| and whose path | |
| 61 // is |path|. Returns the default handler if one is defined (The default | |
| 62 // handler is the one that is assigned to the file manager task button by | |
| 63 // default). If the default handler is not found, tries to match the url with | |
| 64 // one of the file browser handlers. | |
| 65 const FileBrowserHandler* FindFileBrowserHandlerForURLAndPath( | |
| 66 Profile* profile, | |
| 67 const GURL& url, | |
| 68 const base::FilePath& path); | |
| 69 | |
| 70 // Executes a file browser handler specified by |extension| of the given | 52 // Executes a file browser handler specified by |extension| of the given |
| 71 // action ID for |file_urls|. Returns false if undeclared handlers are | 53 // action ID for |file_urls|. Returns false if undeclared handlers are |
| 72 // found. |done| is on completion. See also the comment at ExecuteFileTask() | 54 // found. |done| is on completion. See also the comment at ExecuteFileTask() |
| 73 // for other parameters. | 55 // for other parameters. |
| 74 bool ExecuteFileBrowserHandler( | 56 bool ExecuteFileBrowserHandler( |
| 75 Profile* profile, | 57 Profile* profile, |
| 76 const extensions::Extension* extension, | 58 const extensions::Extension* extension, |
| 77 int32 tab_id, | 59 int32 tab_id, |
| 78 const std::string& action_id, | 60 const std::string& action_id, |
| 79 const std::vector<fileapi::FileSystemURL>& file_urls, | 61 const std::vector<fileapi::FileSystemURL>& file_urls, |
| 80 const file_tasks::FileTaskFinishedCallback& done); | 62 const file_tasks::FileTaskFinishedCallback& done); |
| 81 | 63 |
| 82 } // namespace file_browser_handlers | 64 } // namespace file_browser_handlers |
| 83 } // namespace file_manager | 65 } // namespace file_manager |
| 84 | 66 |
| 85 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_FILE_BROWSER_HANDLERS
_H_ | 67 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_FILE_BROWSER_HANDLERS
_H_ |
| OLD | NEW |