| 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 978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 989 FilePath dest_root = GetDirectoryForOriginAndType(origin_url, type, true, | 989 FilePath dest_root = GetDirectoryForOriginAndType(origin_url, type, true, |
| 990 &error); | 990 &error); |
| 991 if (error != base::PLATFORM_FILE_OK) | 991 if (error != base::PLATFORM_FILE_OK) |
| 992 return false; | 992 return false; |
| 993 FileSystemDirectoryDatabase* db = GetDirectoryDatabase( | 993 FileSystemDirectoryDatabase* db = GetDirectoryDatabase( |
| 994 origin_url, type, true); | 994 origin_url, type, true); |
| 995 if (!db) | 995 if (!db) |
| 996 return false; | 996 return false; |
| 997 | 997 |
| 998 file_util::FileEnumerator file_enum(src_root, true, | 998 file_util::FileEnumerator file_enum(src_root, true, |
| 999 static_cast<file_util::FileEnumerator::FileType>( | 999 (file_util::FileEnumerator::FILES | |
| 1000 file_util::FileEnumerator::FILES | | 1000 file_util::FileEnumerator::DIRECTORIES)); |
| 1001 file_util::FileEnumerator::DIRECTORIES)); | |
| 1002 FilePath src_full_path; | 1001 FilePath src_full_path; |
| 1003 size_t root_path_length = src_root.value().length() + 1; // +1 for the slash | 1002 size_t root_path_length = src_root.value().length() + 1; // +1 for the slash |
| 1004 while (!(src_full_path = file_enum.Next()).empty()) { | 1003 while (!(src_full_path = file_enum.Next()).empty()) { |
| 1005 file_util::FileEnumerator::FindInfo info; | 1004 file_util::FileEnumerator::FindInfo info; |
| 1006 file_enum.GetFindInfo(&info); | 1005 file_enum.GetFindInfo(&info); |
| 1007 FilePath relative_virtual_path = | 1006 FilePath relative_virtual_path = |
| 1008 FilePath(src_full_path.value().substr(root_path_length)); | 1007 FilePath(src_full_path.value().substr(root_path_length)); |
| 1009 if (relative_virtual_path.empty()) { | 1008 if (relative_virtual_path.empty()) { |
| 1010 LOG(WARNING) << "Failed to convert path to relative: " << | 1009 LOG(WARNING) << "Failed to convert path to relative: " << |
| 1011 src_full_path.value(); | 1010 src_full_path.value(); |
| (...skipping 376 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 |