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 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
959 | 959 |
960 // Delete the origin directory if the deleted one was the last remaining | 960 // Delete the origin directory if the deleted one was the last remaining |
961 // type for the origin, i.e. if the *other* type doesn't exist. | 961 // type for the origin, i.e. if the *other* type doesn't exist. |
962 FileSystemType other_type = kFileSystemTypeUnknown; | 962 FileSystemType other_type = kFileSystemTypeUnknown; |
963 if (type == kFileSystemTypeTemporary) | 963 if (type == kFileSystemTypeTemporary) |
964 other_type = kFileSystemTypePersistent; | 964 other_type = kFileSystemTypePersistent; |
965 else if (type == kFileSystemTypePersistent) | 965 else if (type == kFileSystemTypePersistent) |
966 other_type = kFileSystemTypeTemporary; | 966 other_type = kFileSystemTypeTemporary; |
967 else | 967 else |
968 NOTREACHED(); | 968 NOTREACHED(); |
969 | |
970 if (!file_util::DirectoryExists( | 969 if (!file_util::DirectoryExists( |
971 origin_path.Append(GetDirectoryNameForType(other_type)))) { | 970 origin_path.Append(GetDirectoryNameForType(other_type)))) { |
972 InitOriginDatabase(false); | 971 InitOriginDatabase(false); |
973 if (origin_database_.get()) | 972 if (origin_database_.get()) |
974 origin_database_->RemovePathForOrigin(GetOriginIdentifierFromURL(origin)); | 973 origin_database_->RemovePathForOrigin(GetOriginIdentifierFromURL(origin)); |
975 if (!file_util::Delete(origin_path, true /* recursive */)) | 974 if (!file_util::Delete(origin_path, true /* recursive */)) |
976 return false; | 975 return false; |
977 } | 976 } |
978 | 977 |
979 // At this point we are sure we had successfully deleted the origin/type | 978 // At this point we are sure we had successfully deleted the origin/type |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1388 error = NativeFileUtil::CreateDirectory( | 1387 error = NativeFileUtil::CreateDirectory( |
1389 new_local_path, false /* exclusive */, false /* recursive */); | 1388 new_local_path, false /* exclusive */, false /* recursive */); |
1390 if (error != base::PLATFORM_FILE_OK) | 1389 if (error != base::PLATFORM_FILE_OK) |
1391 return error; | 1390 return error; |
1392 | 1391 |
1393 *local_path = new_local_path.AppendASCII(StringPrintf("%08" PRId64, number)); | 1392 *local_path = new_local_path.AppendASCII(StringPrintf("%08" PRId64, number)); |
1394 return base::PLATFORM_FILE_OK; | 1393 return base::PLATFORM_FILE_OK; |
1395 } | 1394 } |
1396 | 1395 |
1397 } // namespace fileapi | 1396 } // namespace fileapi |
OLD | NEW |