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 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
885 } | 885 } |
886 if (!db->RemoveFileInfo(file_id)) | 886 if (!db->RemoveFileInfo(file_id)) |
887 return base::PLATFORM_FILE_ERROR_NOT_EMPTY; | 887 return base::PLATFORM_FILE_ERROR_NOT_EMPTY; |
888 int64 growth = -UsageForPath(file_info.name.size()); | 888 int64 growth = -UsageForPath(file_info.name.size()); |
889 AllocateQuota(context, growth); | 889 AllocateQuota(context, growth); |
890 UpdateUsage(context, url.origin(), url.type(), growth); | 890 UpdateUsage(context, url.origin(), url.type(), growth); |
891 TouchDirectory(db, file_info.parent_id); | 891 TouchDirectory(db, file_info.parent_id); |
892 return base::PLATFORM_FILE_OK; | 892 return base::PLATFORM_FILE_OK; |
893 } | 893 } |
894 | 894 |
895 scoped_refptr<webkit_blob::ShareableFileReference> | 895 base::PlatformFileError ObfuscatedFileUtil::CreateSnapshotFile( |
896 ObfuscatedFileUtil::CreateSnapshotFile( | |
897 FileSystemOperationContext* context, | 896 FileSystemOperationContext* context, |
898 const FileSystemURL& url, | 897 const FileSystemURL& url, |
899 base::PlatformFileError* result, | |
900 base::PlatformFileInfo* file_info, | 898 base::PlatformFileInfo* file_info, |
901 FilePath* platform_path) { | 899 FilePath* platform_path, |
902 DCHECK(result); | 900 SnapshotFilePolicy* policy) { |
903 *result = GetFileInfo(context, url, file_info, platform_path); | 901 DCHECK(policy); |
904 return NULL; | 902 // We're just returning the local file information. |
| 903 *policy = kSnapshotFileLocal; |
| 904 return GetFileInfo(context, url, file_info, platform_path); |
905 } | 905 } |
906 | 906 |
907 FilePath ObfuscatedFileUtil::GetDirectoryForOriginAndType( | 907 FilePath ObfuscatedFileUtil::GetDirectoryForOriginAndType( |
908 const GURL& origin, | 908 const GURL& origin, |
909 FileSystemType type, | 909 FileSystemType type, |
910 bool create, | 910 bool create, |
911 base::PlatformFileError* error_code) { | 911 base::PlatformFileError* error_code) { |
912 FilePath origin_dir = GetDirectoryForOrigin(origin, create, error_code); | 912 FilePath origin_dir = GetDirectoryForOrigin(origin, create, error_code); |
913 if (origin_dir.empty()) | 913 if (origin_dir.empty()) |
914 return FilePath(); | 914 return FilePath(); |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1388 error = NativeFileUtil::CreateDirectory( | 1388 error = NativeFileUtil::CreateDirectory( |
1389 new_local_path, false /* exclusive */, false /* recursive */); | 1389 new_local_path, false /* exclusive */, false /* recursive */); |
1390 if (error != base::PLATFORM_FILE_OK) | 1390 if (error != base::PLATFORM_FILE_OK) |
1391 return error; | 1391 return error; |
1392 | 1392 |
1393 *local_path = new_local_path.AppendASCII(StringPrintf("%08" PRId64, number)); | 1393 *local_path = new_local_path.AppendASCII(StringPrintf("%08" PRId64, number)); |
1394 return base::PLATFORM_FILE_OK; | 1394 return base::PLATFORM_FILE_OK; |
1395 } | 1395 } |
1396 | 1396 |
1397 } // namespace fileapi | 1397 } // namespace fileapi |
OLD | NEW |