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> |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 | 59 |
60 // 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 |
61 // registers a new file system for |path|. | 61 // registers a new file system for |path|. |
62 apps::file_handler_util::GrantedFileEntry CreateFileEntry( | 62 apps::file_handler_util::GrantedFileEntry CreateFileEntry( |
63 Profile* profile, | 63 Profile* profile, |
64 const Extension* extension, | 64 const Extension* extension, |
65 int renderer_id, | 65 int renderer_id, |
66 const base::FilePath& path, | 66 const base::FilePath& path, |
67 bool is_directory); | 67 bool is_directory); |
68 | 68 |
69 void CheckWritableFiles( | 69 // When |is_directory| is true, it verifies that directories exist at each of |
| 70 // the |paths| and calls back to |on_success| or otherwise to |on_failure|. |
| 71 // When |is_directory| is false, it ensures regular files exists (not links and |
| 72 // directories) at the |paths|, creating files if needed, and calls back to |
| 73 // |on_success| or to |on_failure| depending on the result. |
| 74 void PrepareFilesForWritableApp( |
70 const std::vector<base::FilePath>& paths, | 75 const std::vector<base::FilePath>& paths, |
71 Profile* profile, | 76 Profile* profile, |
72 bool is_directory, | 77 bool is_directory, |
73 const base::Closure& on_success, | 78 const base::Closure& on_success, |
74 const base::Callback<void(const base::FilePath&)>& on_failure); | 79 const base::Callback<void(const base::FilePath&)>& on_failure); |
75 | 80 |
76 // Returns whether |extension| has the fileSystem.write permission. | 81 // Returns whether |extension| has the fileSystem.write permission. |
77 bool HasFileSystemWritePermission(const Extension* extension); | 82 bool HasFileSystemWritePermission(const Extension* extension); |
78 | 83 |
79 // Validates a file entry and populates |file_path| with the absolute path if it | 84 // Validates a file entry and populates |file_path| with the absolute path if it |
80 // is valid. | 85 // is valid. |
81 bool ValidateFileEntryAndGetPath( | 86 bool ValidateFileEntryAndGetPath( |
82 const std::string& filesystem_name, | 87 const std::string& filesystem_name, |
83 const std::string& filesystem_path, | 88 const std::string& filesystem_path, |
84 const content::RenderViewHost* render_view_host, | 89 const content::RenderViewHost* render_view_host, |
85 base::FilePath* file_path, | 90 base::FilePath* file_path, |
86 std::string* error); | 91 std::string* error); |
87 | 92 |
88 } // namespace app_file_handler_util | 93 } // namespace app_file_handler_util |
89 | 94 |
90 } // namespace extensions | 95 } // namespace extensions |
91 | 96 |
92 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_HANDLERS_APP_FILE_HANDLER_UTIL_H_ | 97 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_HANDLERS_APP_FILE_HANDLER_UTIL_H_ |
OLD | NEW |