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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 64 |
65 // A callback used for OpenFileSystem. | 65 // A callback used for OpenFileSystem. |
66 void DidGetRootPath(bool success, | 66 void DidGetRootPath(bool success, |
67 const FilePath& path, | 67 const FilePath& path, |
68 const std::string& name); | 68 const std::string& name); |
69 | 69 |
70 // Checks the validity of a given |path| for reading. | 70 // Checks the validity of a given |path| for reading. |
71 // Returns true if the given |path| is a valid FileSystem path. | 71 // Returns true if the given |path| is a valid FileSystem path. |
72 // Otherwise it calls dispatcher's DidFail method with | 72 // Otherwise it calls dispatcher's DidFail method with |
73 // PLATFORM_FILE_ERROR_SECURITY and returns false. | 73 // PLATFORM_FILE_ERROR_SECURITY and returns false. |
| 74 // (Note: this doesn't delete this when it calls DidFail and returns false; |
| 75 // it's the caller's responsibility.) |
74 bool VerifyFileSystemPathForRead(const FilePath& path); | 76 bool VerifyFileSystemPathForRead(const FilePath& path); |
75 | 77 |
76 // Checks the validity of a given |path| for writing. | 78 // Checks the validity of a given |path| for writing. |
77 // Returns true if the given |path| is a valid FileSystem path, and | 79 // Returns true if the given |path| is a valid FileSystem path, and |
78 // its origin embedded in the path has the right to write as much as | 80 // its origin embedded in the path has the right to write as much as |
79 // the given |growth|. | 81 // the given |growth|. |
80 // Otherwise it fires dispatcher's DidFail method with | 82 // Otherwise it fires dispatcher's DidFail method with |
81 // PLATFORM_FILE_ERROR_SECURITY if the path is not valid for writing, | 83 // PLATFORM_FILE_ERROR_SECURITY if the path is not valid for writing, |
82 // or with PLATFORM_FILE_ERROR_NO_SPACE if the origin is not allowed to | 84 // or with PLATFORM_FILE_ERROR_NO_SPACE if the origin is not allowed to |
83 // increase the usage by |growth|. | 85 // increase the usage by |growth|. |
84 // In either case it returns false after firing DidFail. | 86 // In either case it returns false after firing DidFail. |
85 // If |create| flag is true this also checks if the |path| contains | 87 // 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 | 88 // any restricted names and chars. If it does, the call fires dispatcher's |
87 // DidFail with PLATFORM_FILE_ERROR_SECURITY and returns false. | 89 // DidFail with PLATFORM_FILE_ERROR_SECURITY and returns false. |
| 90 // (Note: this doesn't delete this when it calls DidFail and returns false; |
| 91 // it's the caller's responsibility.) |
88 bool VerifyFileSystemPathForWrite(const FilePath& path, | 92 bool VerifyFileSystemPathForWrite(const FilePath& path, |
89 bool create, | 93 bool create, |
90 int64 growth); | 94 int64 growth); |
91 | 95 |
92 // Not owned. See the comment at the constructor. | 96 // Not owned. See the comment at the constructor. |
93 SandboxedFileSystemContext* file_system_context_; | 97 SandboxedFileSystemContext* file_system_context_; |
94 | 98 |
95 base::ScopedCallbackFactory<SandboxedFileSystemOperation> callback_factory_; | 99 base::ScopedCallbackFactory<SandboxedFileSystemOperation> callback_factory_; |
96 | 100 |
97 DISALLOW_COPY_AND_ASSIGN(SandboxedFileSystemOperation); | 101 DISALLOW_COPY_AND_ASSIGN(SandboxedFileSystemOperation); |
98 }; | 102 }; |
99 | 103 |
100 } // namespace fileapi | 104 } // namespace fileapi |
101 | 105 |
102 #endif // WEBKIT_FILEAPI_SANDBOXED_FILE_SYSTEM_OPERATION_H_ | 106 #endif // WEBKIT_FILEAPI_SANDBOXED_FILE_SYSTEM_OPERATION_H_ |
OLD | NEW |