| 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 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 870 FileSystemOperationContext* context, | 870 FileSystemOperationContext* context, |
| 871 const FileSystemURL& url, | 871 const FileSystemURL& url, |
| 872 base::PlatformFileInfo* file_info, | 872 base::PlatformFileInfo* file_info, |
| 873 FilePath* platform_path, | 873 FilePath* platform_path, |
| 874 SnapshotFilePolicy* policy) { | 874 SnapshotFilePolicy* policy) { |
| 875 DCHECK(policy); | 875 DCHECK(policy); |
| 876 // We're just returning the local file information. | 876 // We're just returning the local file information. |
| 877 *policy = kSnapshotFileLocal; | 877 *policy = kSnapshotFileLocal; |
| 878 base::PlatformFileError error = GetFileInfo( | 878 base::PlatformFileError error = GetFileInfo( |
| 879 context, url, file_info, platform_path); | 879 context, url, file_info, platform_path); |
| 880 if (error == base::PLATFORM_FILE_OK && file_info->is_directory) | 880 if (error == base::PLATFORM_FILE_OK && file_info->is_directory) { |
| 881 *file_info = base::PlatformFileInfo(); |
| 881 return base::PLATFORM_FILE_ERROR_NOT_A_FILE; | 882 return base::PLATFORM_FILE_ERROR_NOT_A_FILE; |
| 883 } |
| 882 return error; | 884 return error; |
| 883 } | 885 } |
| 884 | 886 |
| 885 bool ObfuscatedFileUtil::IsDirectoryEmpty( | 887 bool ObfuscatedFileUtil::IsDirectoryEmpty( |
| 886 FileSystemOperationContext* context, | 888 FileSystemOperationContext* context, |
| 887 const FileSystemURL& url) { | 889 const FileSystemURL& url) { |
| 888 FileSystemDirectoryDatabase* db = GetDirectoryDatabase( | 890 FileSystemDirectoryDatabase* db = GetDirectoryDatabase( |
| 889 url.origin(), url.type(), false); | 891 url.origin(), url.type(), false); |
| 890 if (!db) | 892 if (!db) |
| 891 return true; // Not a great answer, but it's what others do. | 893 return true; // Not a great answer, but it's what others do. |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1326 error = NativeFileUtil::CreateDirectory( | 1328 error = NativeFileUtil::CreateDirectory( |
| 1327 new_local_path, false /* exclusive */, false /* recursive */); | 1329 new_local_path, false /* exclusive */, false /* recursive */); |
| 1328 if (error != base::PLATFORM_FILE_OK) | 1330 if (error != base::PLATFORM_FILE_OK) |
| 1329 return error; | 1331 return error; |
| 1330 | 1332 |
| 1331 *local_path = new_local_path.AppendASCII(StringPrintf("%08" PRId64, number)); | 1333 *local_path = new_local_path.AppendASCII(StringPrintf("%08" PRId64, number)); |
| 1332 return base::PLATFORM_FILE_OK; | 1334 return base::PLATFORM_FILE_OK; |
| 1333 } | 1335 } |
| 1334 | 1336 |
| 1335 } // namespace fileapi | 1337 } // namespace fileapi |
| OLD | NEW |