OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 WEBKIT_FILEAPI_SANDBOXED_FILE_SYSTEM_OPERATION_H_ | 5 #ifndef WEBKIT_FILEAPI_SANDBOXED_FILE_SYSTEM_OPERATION_H_ |
6 #define WEBKIT_FILEAPI_SANDBOXED_FILE_SYSTEM_OPERATION_H_ | 6 #define WEBKIT_FILEAPI_SANDBOXED_FILE_SYSTEM_OPERATION_H_ |
7 | 7 |
8 #include "base/scoped_callback_factory.h" | 8 #include "base/scoped_callback_factory.h" |
9 #include "webkit/fileapi/file_system_operation.h" | 9 #include "webkit/fileapi/file_system_operation.h" |
10 #include "webkit/fileapi/file_system_types.h" | 10 #include "webkit/fileapi/file_system_types.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 // or with PLATFORM_FILE_ERROR_NO_SPACE if the origin is not allowed to | 82 // or with PLATFORM_FILE_ERROR_NO_SPACE if the origin is not allowed to |
83 // increase the usage by |growth|. | 83 // increase the usage by |growth|. |
84 // In either case it returns false after firing DidFail. | 84 // In either case it returns false after firing DidFail. |
85 // If |create| flag is true this also checks if the |path| contains | 85 // If |create| flag is true this also checks if the |path| contains |
86 // any restricted names and chars. If it does, the call fires dispatcher's | 86 // any restricted names and chars. If it does, the call fires dispatcher's |
87 // DidFail with PLATFORM_FILE_ERROR_SECURITY and returns false. | 87 // DidFail with PLATFORM_FILE_ERROR_SECURITY and returns false. |
88 bool VerifyFileSystemPathForWrite(const FilePath& path, | 88 bool VerifyFileSystemPathForWrite(const FilePath& path, |
89 bool create, | 89 bool create, |
90 int64 growth); | 90 int64 growth); |
91 | 91 |
92 // Checks if a given |path| does not contain any restricted names/chars | |
93 // for new files. Returns true if the given |path| is safe. | |
94 // Otherwise it fires dispatcher's DidFail method with | |
95 // PLATFORM_FILE_ERROR_SECURITY and returns false. | |
96 bool CheckIfFilePathIsSafe(const FilePath& path); | |
97 | |
98 // Not owned. See the comment at the constructor. | 92 // Not owned. See the comment at the constructor. |
99 SandboxedFileSystemContext* file_system_context_; | 93 SandboxedFileSystemContext* file_system_context_; |
100 | 94 |
101 base::ScopedCallbackFactory<SandboxedFileSystemOperation> callback_factory_; | 95 base::ScopedCallbackFactory<SandboxedFileSystemOperation> callback_factory_; |
102 | 96 |
103 DISALLOW_COPY_AND_ASSIGN(SandboxedFileSystemOperation); | 97 DISALLOW_COPY_AND_ASSIGN(SandboxedFileSystemOperation); |
104 }; | 98 }; |
105 | 99 |
106 } // namespace fileapi | 100 } // namespace fileapi |
107 | 101 |
108 #endif // WEBKIT_FILEAPI_SANDBOXED_FILE_SYSTEM_OPERATION_H_ | 102 #endif // WEBKIT_FILEAPI_SANDBOXED_FILE_SYSTEM_OPERATION_H_ |
OLD | NEW |