OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "webkit/fileapi/obfuscated_file_util.h" | 5 #include "webkit/fileapi/obfuscated_file_util.h" |
6 | 6 |
7 #include <queue> | 7 #include <queue> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 FileInfo file_info; | 806 FileInfo file_info; |
807 base::PlatformFileInfo platform_file_info; | 807 base::PlatformFileInfo platform_file_info; |
808 FilePath local_path; | 808 FilePath local_path; |
809 base::PlatformFileError error = GetFileInfoInternal( | 809 base::PlatformFileError error = GetFileInfoInternal( |
810 db, context, url.origin(), url.type(), file_id, | 810 db, context, url.origin(), url.type(), file_id, |
811 &file_info, &platform_file_info, &local_path); | 811 &file_info, &platform_file_info, &local_path); |
812 if (error != base::PLATFORM_FILE_ERROR_NOT_FOUND && | 812 if (error != base::PLATFORM_FILE_ERROR_NOT_FOUND && |
813 error != base::PLATFORM_FILE_OK) | 813 error != base::PLATFORM_FILE_OK) |
814 return error; | 814 return error; |
815 | 815 |
816 if (file_info.is_directory()) { | 816 if (file_info.is_directory()) |
817 NOTREACHED(); | 817 return base::PLATFORM_FILE_ERROR_NOT_A_FILE; |
818 return base::PLATFORM_FILE_ERROR_FAILED; | |
819 } | |
820 | 818 |
821 int64 growth = -UsageForPath(file_info.name.size()) - platform_file_info.size; | 819 int64 growth = -UsageForPath(file_info.name.size()) - platform_file_info.size; |
822 AllocateQuota(context, growth); | 820 AllocateQuota(context, growth); |
823 if (!db->RemoveFileInfo(file_id)) { | 821 if (!db->RemoveFileInfo(file_id)) { |
824 NOTREACHED(); | 822 NOTREACHED(); |
825 return base::PLATFORM_FILE_ERROR_FAILED; | 823 return base::PLATFORM_FILE_ERROR_FAILED; |
826 } | 824 } |
827 UpdateUsage(context, url, growth); | 825 UpdateUsage(context, url, growth); |
828 TouchDirectory(db, file_info.parent_id); | 826 TouchDirectory(db, file_info.parent_id); |
829 | 827 |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1328 error = NativeFileUtil::CreateDirectory( | 1326 error = NativeFileUtil::CreateDirectory( |
1329 new_local_path, false /* exclusive */, false /* recursive */); | 1327 new_local_path, false /* exclusive */, false /* recursive */); |
1330 if (error != base::PLATFORM_FILE_OK) | 1328 if (error != base::PLATFORM_FILE_OK) |
1331 return error; | 1329 return error; |
1332 | 1330 |
1333 *local_path = new_local_path.AppendASCII(StringPrintf("%08" PRId64, number)); | 1331 *local_path = new_local_path.AppendASCII(StringPrintf("%08" PRId64, number)); |
1334 return base::PLATFORM_FILE_OK; | 1332 return base::PLATFORM_FILE_OK; |
1335 } | 1333 } |
1336 | 1334 |
1337 } // namespace fileapi | 1335 } // namespace fileapi |
OLD | NEW |