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 |
11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
12 #include "base/format_macros.h" | 12 #include "base/format_macros.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
15 #include "base/metrics/histogram.h" | |
16 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
17 #include "base/string_number_conversions.h" | 16 #include "base/string_number_conversions.h" |
18 #include "base/stringprintf.h" | 17 #include "base/stringprintf.h" |
19 #include "base/sys_string_conversions.h" | 18 #include "base/sys_string_conversions.h" |
20 #include "googleurl/src/gurl.h" | 19 #include "googleurl/src/gurl.h" |
21 #include "webkit/fileapi/file_observers.h" | 20 #include "webkit/fileapi/file_observers.h" |
22 #include "webkit/fileapi/file_system_context.h" | 21 #include "webkit/fileapi/file_system_context.h" |
23 #include "webkit/fileapi/file_system_operation_context.h" | 22 #include "webkit/fileapi/file_system_operation_context.h" |
24 #include "webkit/fileapi/file_system_url.h" | 23 #include "webkit/fileapi/file_system_url.h" |
25 #include "webkit/fileapi/file_system_util.h" | 24 #include "webkit/fileapi/file_system_util.h" |
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
953 if (!file_util::Delete(origin_type_path, true /* recursive */)) | 952 if (!file_util::Delete(origin_type_path, true /* recursive */)) |
954 return false; | 953 return false; |
955 } | 954 } |
956 | 955 |
957 FilePath origin_path = origin_type_path.DirName(); | 956 FilePath origin_path = origin_type_path.DirName(); |
958 DCHECK_EQ(origin_path.value(), | 957 DCHECK_EQ(origin_path.value(), |
959 GetDirectoryForOrigin(origin, false, NULL).value()); | 958 GetDirectoryForOrigin(origin, false, NULL).value()); |
960 | 959 |
961 // At this point we are sure we had successfully deleted the origin/type | 960 // At this point we are sure we had successfully deleted the origin/type |
962 // directory (i.e. we're ready to just return true). | 961 // directory (i.e. we're ready to just return true). |
963 | |
964 // See if we have other directories in this origin directory. | 962 // See if we have other directories in this origin directory. |
965 std::vector<FileSystemType> other_types; | 963 std::vector<FileSystemType> other_types; |
966 if (type != kFileSystemTypeTemporary) | 964 if (type != kFileSystemTypeTemporary) |
967 other_types.push_back(kFileSystemTypeTemporary); | 965 other_types.push_back(kFileSystemTypeTemporary); |
968 if (type != kFileSystemTypePersistent) | 966 if (type != kFileSystemTypePersistent) |
969 other_types.push_back(kFileSystemTypePersistent); | 967 other_types.push_back(kFileSystemTypePersistent); |
970 if (type != kFileSystemTypeSyncable) | 968 if (type != kFileSystemTypeSyncable) |
971 other_types.push_back(kFileSystemTypeSyncable); | 969 other_types.push_back(kFileSystemTypeSyncable); |
972 | 970 |
973 for (size_t i = 0; i < other_types.size(); ++i) { | 971 for (size_t i = 0; i < other_types.size(); ++i) { |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1325 error = NativeFileUtil::CreateDirectory( | 1323 error = NativeFileUtil::CreateDirectory( |
1326 new_local_path, false /* exclusive */, false /* recursive */); | 1324 new_local_path, false /* exclusive */, false /* recursive */); |
1327 if (error != base::PLATFORM_FILE_OK) | 1325 if (error != base::PLATFORM_FILE_OK) |
1328 return error; | 1326 return error; |
1329 | 1327 |
1330 *local_path = new_local_path.AppendASCII(StringPrintf("%08" PRId64, number)); | 1328 *local_path = new_local_path.AppendASCII(StringPrintf("%08" PRId64, number)); |
1331 return base::PLATFORM_FILE_OK; | 1329 return base::PLATFORM_FILE_OK; |
1332 } | 1330 } |
1333 | 1331 |
1334 } // namespace fileapi | 1332 } // namespace fileapi |
OLD | NEW |