OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_FILE_SYSTEM_OPERATION_H_ | 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_H_ |
6 #define WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_H_ | 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 // Checks the validity of a given |path| for reading. | 120 // Checks the validity of a given |path| for reading. |
121 // Returns true if the given |path| is a valid FileSystem path. | 121 // Returns true if the given |path| is a valid FileSystem path. |
122 // Otherwise it calls dispatcher's DidFail method with | 122 // Otherwise it calls dispatcher's DidFail method with |
123 // PLATFORM_FILE_ERROR_SECURITY and returns false. | 123 // PLATFORM_FILE_ERROR_SECURITY and returns false. |
124 // (Note: this doesn't delete this when it calls DidFail and returns false; | 124 // (Note: this doesn't delete this when it calls DidFail and returns false; |
125 // it's the caller's responsibility.) | 125 // it's the caller's responsibility.) |
126 bool VerifyFileSystemPathForRead(const FilePath& path); | 126 bool VerifyFileSystemPathForRead(const FilePath& path); |
127 | 127 |
128 // Checks the validity of a given |path| for writing. | 128 // Checks the validity of a given |path| for writing. |
129 // Returns true if the given |path| is a valid FileSystem path, and | 129 // Returns true if the given |path| is a valid FileSystem path, and |
130 // its origin embedded in the path has the right to write as much as | 130 // its origin embedded in the path has the right to write. |
131 // the given |growth|. | |
132 // Otherwise it fires dispatcher's DidFail method with | 131 // Otherwise it fires dispatcher's DidFail method with |
133 // PLATFORM_FILE_ERROR_SECURITY if the path is not valid for writing, | 132 // PLATFORM_FILE_ERROR_SECURITY if the path is not valid for writing, |
134 // or with PLATFORM_FILE_ERROR_NO_SPACE if the origin is not allowed to | 133 // or with PLATFORM_FILE_ERROR_NO_SPACE if the origin is not allowed to |
135 // increase the usage by |growth|. | 134 // write to the storage. |
136 // In either case it returns false after firing DidFail. | 135 // In either case it returns false after firing DidFail. |
137 // If |create| flag is true this also checks if the |path| contains | 136 // If |create| flag is true this also checks if the |path| contains |
138 // any restricted names and chars. If it does, the call fires dispatcher's | 137 // any restricted names and chars. If it does, the call fires dispatcher's |
139 // DidFail with PLATFORM_FILE_ERROR_SECURITY and returns false. | 138 // DidFail with PLATFORM_FILE_ERROR_SECURITY and returns false. |
140 // (Note: this doesn't delete this when it calls DidFail and returns false; | 139 // (Note: this doesn't delete this when it calls DidFail and returns false; |
141 // it's the caller's responsibility.) | 140 // it's the caller's responsibility.) |
142 bool VerifyFileSystemPathForWrite(const FilePath& path, | 141 bool VerifyFileSystemPathForWrite(const FilePath& path, |
143 bool create, | 142 bool create); |
144 int64 growth); | |
145 | 143 |
146 #ifndef NDEBUG | 144 #ifndef NDEBUG |
147 enum OperationType { | 145 enum OperationType { |
148 kOperationNone, | 146 kOperationNone, |
149 kOperationOpenFileSystem, | 147 kOperationOpenFileSystem, |
150 kOperationCreateFile, | 148 kOperationCreateFile, |
151 kOperationCreateDirectory, | 149 kOperationCreateDirectory, |
152 kOperationCopy, | 150 kOperationCopy, |
153 kOperationMove, | 151 kOperationMove, |
154 kOperationDirectoryExists, | 152 kOperationDirectoryExists, |
(...skipping 25 matching lines...) Expand all Loading... |
180 scoped_ptr<FileWriterDelegate> file_writer_delegate_; | 178 scoped_ptr<FileWriterDelegate> file_writer_delegate_; |
181 scoped_ptr<net::URLRequest> blob_request_; | 179 scoped_ptr<net::URLRequest> blob_request_; |
182 scoped_ptr<FileSystemOperation> cancel_operation_; | 180 scoped_ptr<FileSystemOperation> cancel_operation_; |
183 | 181 |
184 DISALLOW_COPY_AND_ASSIGN(FileSystemOperation); | 182 DISALLOW_COPY_AND_ASSIGN(FileSystemOperation); |
185 }; | 183 }; |
186 | 184 |
187 } // namespace fileapi | 185 } // namespace fileapi |
188 | 186 |
189 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_H_ | 187 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_H_ |
OLD | NEW |