| 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 NativeFileUtil |
| 29 // instance. | 29 // instance. |
| 30 static QuotaFileUtil* CreateDefault(); | 30 static QuotaFileUtil* CreateDefault(); |
| 31 | 31 |
| 32 virtual base::PlatformFileError Truncate( |
| 33 FileSystemOperationContext* fs_context, |
| 34 const FilePath& path, |
| 35 int64 length) OVERRIDE; |
| 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 | |
| 38 virtual base::PlatformFileError DeleteFile( | 41 virtual base::PlatformFileError DeleteFile( |
| 39 FileSystemOperationContext* fs_context, | 42 FileSystemOperationContext* fs_context, |
| 40 const FilePath& file_path) OVERRIDE; | 43 const FilePath& file_path) OVERRIDE; |
| 41 | 44 |
| 42 virtual base::PlatformFileError Truncate( | |
| 43 FileSystemOperationContext* fs_context, | |
| 44 const FilePath& path, | |
| 45 int64 length) OVERRIDE; | |
| 46 | |
| 47 private: | 45 private: |
| 48 scoped_ptr<FileSystemFileUtil> underlying_file_util_; | |
| 49 | |
| 50 DISALLOW_COPY_AND_ASSIGN(QuotaFileUtil); | 46 DISALLOW_COPY_AND_ASSIGN(QuotaFileUtil); |
| 51 }; | 47 }; |
| 52 | 48 |
| 53 } // namespace fileapi | 49 } // namespace fileapi |
| 54 | 50 |
| 55 #endif // WEBKIT_FILEAPI_QUOTA_FILE_UTIL_H_ | 51 #endif // WEBKIT_FILEAPI_QUOTA_FILE_UTIL_H_ |
| OLD | NEW |