Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "webkit/fileapi/file_system_file_util_base.h" | |
| 6 #include "webkit/fileapi/file_system_operation_context.h" | |
| 7 | |
| 8 #include "base/file_util.h" | |
| 9 | |
| 10 namespace fileapi { | |
| 11 | |
| 12 bool QuotaFileUtil::CopyFile( | |
| 13 const FileSystemOperationContext& fs_context, | |
| 14 const FilePath& from_path, const FilePath& to_path) { | |
| 15 int allowed_growth = fs_context.GetAllowedGrowth(); | |
| 16 | |
| 17 if (allowed_growth < SIZE_MAX) { | |
| 18 const char* path_str = from_path.value().c_str(); | |
| 19 stat_wrapper_t file_info; | |
| 20 int test = CallStat(path_str, &file_info); | |
| 21 if (test != 0) | |
| 22 return base::PLATFORM_FILE_ERROR_FAILED; | |
| 23 if (file_info.st_size > allowed_growth) | |
| 24 return base::PLATFORM_FILE_ERROR_NO_SPACE; | |
| 25 } | |
| 26 | |
| 27 return file_util::CopyFile(from_path, to_path); | |
|
ericu
2011/02/10 20:41:54
Would this also call into the quota system somehow
| |
| 28 } | |
| 29 | |
| 30 } // namespace fileapi | |
| OLD | NEW |