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_QUOTA_FILE_UTIL_H_ | 5 #ifndef WEBKIT_FILEAPI_QUOTA_FILE_UTIL_H_ |
6 #define WEBKIT_FILEAPI_QUOTA_FILE_UTIL_H_ | 6 #define WEBKIT_FILEAPI_QUOTA_FILE_UTIL_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "webkit/fileapi/file_system_file_util.h" | 9 #include "webkit/fileapi/file_system_file_util.h" |
10 #include "webkit/fileapi/file_system_operation_context.h" | 10 #include "webkit/fileapi/file_system_operation_context.h" |
11 #pragma once | 11 #pragma once |
12 | 12 |
13 namespace fileapi { | 13 namespace fileapi { |
14 | 14 |
15 class QuotaFileUtil : public FileSystemFileUtil { | 15 class QuotaFileUtil : public FileSystemFileUtil { |
16 public: | 16 public: |
17 static const int64 kNoLimit; | 17 static const int64 kNoLimit; |
18 | 18 |
19 // |underlying_file_util| is owned by the instance. It will be deleted by | 19 // |underlying_file_util| is owned by the instance. It will be deleted by |
20 // the owner instance. For example, it can be instanciated as follows: | 20 // the owner instance. For example, it can be instanciated as follows: |
21 // FileSystemFileUtil* file_util = new QuotaFileUtil(new SomeFileUtil()); | 21 // FileSystemFileUtil* file_util = new QuotaFileUtil(new SomeFileUtil()); |
22 // | 22 // |
23 // To instanciate an object whose underlying file_util is FileSystemFileUtil, | 23 // To instanciate an object whose underlying file_util is FileSystemFileUtil, |
24 // QuotaFileUtil::CreateDefault() can be used. | 24 // QuotaFileUtil::CreateDefault() can be used. |
25 explicit QuotaFileUtil(FileSystemFileUtil* underlying_file_util); | 25 explicit QuotaFileUtil(FileSystemFileUtil* underlying_file_util); |
26 virtual ~QuotaFileUtil(); | 26 virtual ~QuotaFileUtil(); |
27 | 27 |
28 // Creates a QuotaFileUtil instance with an underlying FileSystemFileUtil | 28 // Creates a QuotaFileUtil instance with an underlying FileUtil instance. |
ericu
2011/08/25 17:58:05
Should say NativeFileUtil.
Dai Mikurube (NOT FULLTIME)
2011/08/26 05:10:59
Done.
| |
29 // instance. | |
30 static QuotaFileUtil* CreateDefault(); | 29 static QuotaFileUtil* CreateDefault(); |
31 | 30 |
31 virtual base::PlatformFileError Truncate( | |
32 FileSystemOperationContext* fs_context, | |
33 const FilePath& path, | |
34 int64 length) OVERRIDE; | |
35 | |
32 virtual base::PlatformFileError CopyOrMoveFile( | 36 virtual base::PlatformFileError CopyOrMoveFile( |
33 FileSystemOperationContext* fs_context, | 37 FileSystemOperationContext* fs_context, |
34 const FilePath& src_file_path, | 38 const FilePath& src_file_path, |
35 const FilePath& dest_file_path, | 39 const FilePath& dest_file_path, |
36 bool copy) OVERRIDE; | 40 bool copy) OVERRIDE; |
37 | 41 |
38 virtual base::PlatformFileError DeleteFile( | 42 virtual base::PlatformFileError DeleteFile( |
39 FileSystemOperationContext* fs_context, | 43 FileSystemOperationContext* fs_context, |
40 const FilePath& file_path) OVERRIDE; | 44 const FilePath& file_path) OVERRIDE; |
41 | 45 |
42 virtual base::PlatformFileError Truncate( | |
43 FileSystemOperationContext* fs_context, | |
44 const FilePath& path, | |
45 int64 length) OVERRIDE; | |
46 | |
47 private: | 46 private: |
48 scoped_ptr<FileSystemFileUtil> underlying_file_util_; | |
49 | |
50 DISALLOW_COPY_AND_ASSIGN(QuotaFileUtil); | 47 DISALLOW_COPY_AND_ASSIGN(QuotaFileUtil); |
51 }; | 48 }; |
52 | 49 |
53 } // namespace fileapi | 50 } // namespace fileapi |
54 | 51 |
55 #endif // WEBKIT_FILEAPI_QUOTA_FILE_UTIL_H_ | 52 #endif // WEBKIT_FILEAPI_QUOTA_FILE_UTIL_H_ |
OLD | NEW |