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 #ifndef CHROME_BROWSER_EXTENSIONS_API_FILE_HANDLERS_APP_FILE_HANDLER_UTIL_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_FILE_HANDLERS_APP_FILE_HANDLER_UTIL_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_FILE_HANDLERS_APP_FILE_HANDLER_UTIL_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_FILE_HANDLERS_APP_FILE_HANDLER_UTIL_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | |
10 #include <vector> | 11 #include <vector> |
11 | 12 |
12 #include "chrome/common/extensions/api/file_handlers/file_handlers_parser.h" | 13 #include "chrome/common/extensions/api/file_handlers/file_handlers_parser.h" |
13 #include "chrome/common/extensions/extension.h" | 14 #include "chrome/common/extensions/extension.h" |
14 | 15 |
15 class Profile; | 16 class Profile; |
16 | 17 |
17 namespace extensions { | 18 namespace extensions { |
18 | 19 |
19 // TODO(benwells): move this to platform_apps namespace. | 20 // TODO(benwells): move this to platform_apps namespace. |
20 namespace app_file_handler_util { | 21 namespace app_file_handler_util { |
21 | 22 |
23 typedef std::set<std::pair<std::string, base::FilePath> > MimeTypeAndPathSet; | |
Matt Giuca
2013/05/07 05:39:59
Document this type.
Also I would swap the order o
Sam McNally
2013/05/07 06:15:27
Done.
| |
24 | |
22 // Returns the file handler with the specified |handler_id|, or NULL if there | 25 // Returns the file handler with the specified |handler_id|, or NULL if there |
23 // is no such handler. | 26 // is no such handler. |
24 const FileHandlerInfo* FileHandlerForId(const Extension& app, | 27 const FileHandlerInfo* FileHandlerForId(const Extension& app, |
25 const std::string& handler_id); | 28 const std::string& handler_id); |
26 | 29 |
27 // Returns the first file handler that can handle the given MIME type or | 30 // Returns the first file handler that can handle the given MIME type or |
28 // filename, or NULL if is no such handler. | 31 // filename, or NULL if is no such handler. |
29 const FileHandlerInfo* FirstFileHandlerForFile( | 32 const FileHandlerInfo* FirstFileHandlerForFile( |
30 const Extension& app, | 33 const Extension& app, |
31 const std::string& mime_type, | 34 const std::string& mime_type, |
32 const base::FilePath& path); | 35 const base::FilePath& path); |
33 | 36 |
34 std::vector<const FileHandlerInfo*> | 37 std::vector<const FileHandlerInfo*> |
35 FindFileHandlersForMimeTypes(const Extension& extension, | 38 FindFileHandlers(const Extension& extension, |
36 const std::set<std::string>& mime_types); | 39 const MimeTypeAndPathSet& files); |
37 | 40 |
38 bool FileHandlerCanHandleFile( | 41 bool FileHandlerCanHandleFile( |
39 const FileHandlerInfo& handler, | 42 const FileHandlerInfo& handler, |
40 const std::string& mime_type, | 43 const std::string& mime_type, |
41 const base::FilePath& path); | 44 const base::FilePath& path); |
42 bool FileHandlerCanHandleFileWithMimeType( | |
43 const FileHandlerInfo& handler, | |
44 const std::string& mime_type); | |
45 | 45 |
46 // Represents a file entry that a user has given an extension permission to | 46 // Represents a file entry that a user has given an extension permission to |
47 // access. Intended to be persisted to disk (in the Preferences file), so should | 47 // access. Intended to be persisted to disk (in the Preferences file), so should |
48 // remain serializable. | 48 // remain serializable. |
49 struct SavedFileEntry { | 49 struct SavedFileEntry { |
50 SavedFileEntry(const std::string& id, | 50 SavedFileEntry(const std::string& id, |
51 const base::FilePath& path, | 51 const base::FilePath& path, |
52 bool writable) | 52 bool writable) |
53 : id(id), | 53 : id(id), |
54 path(path), | 54 path(path), |
(...skipping 18 matching lines...) Expand all Loading... | |
73 const std::string& extension_id, | 73 const std::string& extension_id, |
74 int renderer_id, | 74 int renderer_id, |
75 const base::FilePath& path, | 75 const base::FilePath& path, |
76 bool writable); | 76 bool writable); |
77 | 77 |
78 } // namespace app_file_handler_util | 78 } // namespace app_file_handler_util |
79 | 79 |
80 } // namespace extensions | 80 } // namespace extensions |
81 | 81 |
82 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_HANDLERS_APP_FILE_HANDLER_UTIL_H_ | 82 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_HANDLERS_APP_FILE_HANDLER_UTIL_H_ |
OLD | NEW |