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 <utility> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "chrome/common/extensions/api/file_handlers/file_handlers_parser.h" | 13 #include "chrome/common/extensions/api/file_handlers/file_handlers_parser.h" |
14 #include "content/public/browser/render_view_host.h" | 14 #include "content/public/browser/render_view_host.h" |
15 #include "extensions/common/extension.h" | 15 #include "extensions/common/extension.h" |
16 | 16 |
17 class Profile; | 17 class Profile; |
18 | 18 |
| 19 namespace apps { |
| 20 namespace file_handler_util { |
| 21 struct GrantedFileEntry; |
| 22 } |
| 23 } |
| 24 |
19 namespace extensions { | 25 namespace extensions { |
20 class ExtensionPrefs; | 26 class ExtensionPrefs; |
21 | 27 |
22 // TODO(benwells): move this to platform_apps namespace. | 28 // TODO(benwells): move this to platform_apps namespace. |
23 namespace app_file_handler_util { | 29 namespace app_file_handler_util { |
24 | 30 |
25 extern const char kInvalidParameters[]; | 31 extern const char kInvalidParameters[]; |
26 extern const char kSecurityError[]; | 32 extern const char kSecurityError[]; |
27 | 33 |
28 // A set of pairs of path and its corresponding MIME type. | 34 // A set of pairs of path and its corresponding MIME type. |
(...skipping 15 matching lines...) Expand all Loading... |
44 // |files| must be populated, but the MIME types are optional. | 50 // |files| must be populated, but the MIME types are optional. |
45 std::vector<const FileHandlerInfo*> | 51 std::vector<const FileHandlerInfo*> |
46 FindFileHandlersForFiles(const Extension& extension, | 52 FindFileHandlersForFiles(const Extension& extension, |
47 const PathAndMimeTypeSet& files); | 53 const PathAndMimeTypeSet& files); |
48 | 54 |
49 bool FileHandlerCanHandleFile( | 55 bool FileHandlerCanHandleFile( |
50 const FileHandlerInfo& handler, | 56 const FileHandlerInfo& handler, |
51 const std::string& mime_type, | 57 const std::string& mime_type, |
52 const base::FilePath& path); | 58 const base::FilePath& path); |
53 | 59 |
54 // Refers to a file entry that a renderer has been given access to. | |
55 struct GrantedFileEntry { | |
56 GrantedFileEntry(); | |
57 | |
58 std::string id; | |
59 std::string filesystem_id; | |
60 std::string registered_name; | |
61 }; | |
62 | |
63 // Creates a new file entry and allows |renderer_id| to access |path|. This | 60 // Creates a new file entry and allows |renderer_id| to access |path|. This |
64 // registers a new file system for |path|. | 61 // registers a new file system for |path|. |
65 GrantedFileEntry CreateFileEntry( | 62 apps::file_handler_util::GrantedFileEntry CreateFileEntry( |
66 Profile* profile, | 63 Profile* profile, |
67 const Extension* extension, | 64 const Extension* extension, |
68 int renderer_id, | 65 int renderer_id, |
69 const base::FilePath& path, | 66 const base::FilePath& path, |
70 bool is_directory); | 67 bool is_directory); |
71 | 68 |
72 void CheckWritableFiles( | 69 void CheckWritableFiles( |
73 const std::vector<base::FilePath>& paths, | 70 const std::vector<base::FilePath>& paths, |
74 Profile* profile, | 71 Profile* profile, |
75 bool is_directory, | 72 bool is_directory, |
(...skipping 10 matching lines...) Expand all Loading... |
86 const std::string& filesystem_path, | 83 const std::string& filesystem_path, |
87 const content::RenderViewHost* render_view_host, | 84 const content::RenderViewHost* render_view_host, |
88 base::FilePath* file_path, | 85 base::FilePath* file_path, |
89 std::string* error); | 86 std::string* error); |
90 | 87 |
91 } // namespace app_file_handler_util | 88 } // namespace app_file_handler_util |
92 | 89 |
93 } // namespace extensions | 90 } // namespace extensions |
94 | 91 |
95 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_HANDLERS_APP_FILE_HANDLER_UTIL_H_ | 92 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_HANDLERS_APP_FILE_HANDLER_UTIL_H_ |
OLD | NEW |