| 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 "chrome/browser/chromeos/gdata/gdata_file_system.h" | 5 #include "chrome/browser/chromeos/gdata/gdata_file_system.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1122 FilePath new_file(file_name); | 1122 FilePath new_file(file_name); |
| 1123 if (new_file.Extension() == | 1123 if (new_file.Extension() == |
| 1124 entry_proto->file_specific_info().document_extension()) { | 1124 entry_proto->file_specific_info().document_extension()) { |
| 1125 file_name = new_file.RemoveExtension().value(); | 1125 file_name = new_file.RemoveExtension().value(); |
| 1126 } | 1126 } |
| 1127 } | 1127 } |
| 1128 | 1128 |
| 1129 documents_service_->RenameResource( | 1129 documents_service_->RenameResource( |
| 1130 GURL(entry_proto->edit_url()), | 1130 GURL(entry_proto->edit_url()), |
| 1131 file_name, | 1131 file_name, |
| 1132 base::Bind(&GDataFileSystem::RenameFileOnFileSystem, | 1132 base::Bind(&GDataFileSystem::RenameEntryLocally, |
| 1133 ui_weak_ptr_, | 1133 ui_weak_ptr_, |
| 1134 file_path, | 1134 file_path, |
| 1135 file_name, | 1135 file_name, |
| 1136 callback)); | 1136 callback)); |
| 1137 } | 1137 } |
| 1138 | 1138 |
| 1139 void GDataFileSystem::Move(const FilePath& src_file_path, | 1139 void GDataFileSystem::Move(const FilePath& src_file_path, |
| 1140 const FilePath& dest_file_path, | 1140 const FilePath& dest_file_path, |
| 1141 const FileOperationCallback& callback) { | 1141 const FileOperationCallback& callback) { |
| 1142 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || | 1142 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1210 // 3. Adds the file to the parent directory of |dest_file_path|, which | 1210 // 3. Adds the file to the parent directory of |dest_file_path|, which |
| 1211 // effectively moves the file from the root directory to the parent | 1211 // effectively moves the file from the root directory to the parent |
| 1212 // directory of |dest_file_path|. | 1212 // directory of |dest_file_path|. |
| 1213 FileMoveCallback add_file_to_directory_callback = | 1213 FileMoveCallback add_file_to_directory_callback = |
| 1214 base::Bind(&GDataFileSystem::MoveEntryFromRootDirectory, | 1214 base::Bind(&GDataFileSystem::MoveEntryFromRootDirectory, |
| 1215 ui_weak_ptr_, | 1215 ui_weak_ptr_, |
| 1216 dest_file_path.DirName(), | 1216 dest_file_path.DirName(), |
| 1217 callback); | 1217 callback); |
| 1218 | 1218 |
| 1219 FileMoveCallback remove_file_from_directory_callback = | 1219 FileMoveCallback remove_file_from_directory_callback = |
| 1220 base::Bind(&GDataFileSystem::RemoveEntryFromDirectory, | 1220 base::Bind(&GDataFileSystem::RemoveEntryFromNonRootDirectory, |
| 1221 ui_weak_ptr_, | 1221 ui_weak_ptr_, |
| 1222 src_file_path.DirName(), | |
| 1223 add_file_to_directory_callback); | 1222 add_file_to_directory_callback); |
| 1224 | 1223 |
| 1225 Rename(src_file_path, dest_file_path.BaseName().value(), | 1224 Rename(src_file_path, dest_file_path.BaseName().value(), |
| 1226 remove_file_from_directory_callback); | 1225 remove_file_from_directory_callback); |
| 1227 } | 1226 } |
| 1228 | 1227 |
| 1229 void GDataFileSystem::MoveEntryFromRootDirectory( | 1228 void GDataFileSystem::MoveEntryFromRootDirectory( |
| 1230 const FilePath& dir_path, | 1229 const FilePath& dir_path, |
| 1231 const FileOperationCallback& callback, | 1230 const FileOperationCallback& callback, |
| 1232 GDataFileError error, | 1231 GDataFileError error, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1278 documents_service_->AddResourceToDirectory( | 1277 documents_service_->AddResourceToDirectory( |
| 1279 GURL(dir_proto->content_url()), | 1278 GURL(dir_proto->content_url()), |
| 1280 GURL(src_proto->edit_url()), | 1279 GURL(src_proto->edit_url()), |
| 1281 base::Bind(&GDataFileSystem::OnMoveEntryFromRootDirectoryCompleted, | 1280 base::Bind(&GDataFileSystem::OnMoveEntryFromRootDirectoryCompleted, |
| 1282 ui_weak_ptr_, | 1281 ui_weak_ptr_, |
| 1283 callback, | 1282 callback, |
| 1284 file_path, | 1283 file_path, |
| 1285 dir_path)); | 1284 dir_path)); |
| 1286 } | 1285 } |
| 1287 | 1286 |
| 1288 void GDataFileSystem::RemoveEntryFromDirectory( | 1287 void GDataFileSystem::RemoveEntryFromNonRootDirectory( |
| 1289 const FilePath& dir_path, | |
| 1290 const FileMoveCallback& callback, | 1288 const FileMoveCallback& callback, |
| 1291 GDataFileError error, | 1289 GDataFileError error, |
| 1292 const FilePath& file_path) { | 1290 const FilePath& file_path) { |
| 1293 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1291 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 1292 DCHECK(!callback.is_null()); |
| 1294 | 1293 |
| 1294 const FilePath dir_path = file_path.DirName(); |
| 1295 GDataEntry* entry = directory_service_->FindEntryByPathSync(file_path); | 1295 GDataEntry* entry = directory_service_->FindEntryByPathSync(file_path); |
| 1296 GDataEntry* dir = directory_service_->FindEntryByPathSync(dir_path); | 1296 GDataEntry* dir = directory_service_->FindEntryByPathSync(dir_path); |
| 1297 if (error == GDATA_FILE_OK) { | 1297 if (error == GDATA_FILE_OK) { |
| 1298 if (!entry || !dir) { | 1298 if (!entry || !dir) { |
| 1299 error = GDATA_FILE_ERROR_NOT_FOUND; | 1299 error = GDATA_FILE_ERROR_NOT_FOUND; |
| 1300 } else { | 1300 } else { |
| 1301 if (!dir->AsGDataDirectory()) | 1301 if (!dir->AsGDataDirectory()) |
| 1302 error = GDATA_FILE_ERROR_NOT_A_DIRECTORY; | 1302 error = GDATA_FILE_ERROR_NOT_A_DIRECTORY; |
| 1303 } | 1303 } |
| 1304 } | 1304 } |
| 1305 | 1305 |
| 1306 // Returns if there is an error or |dir_path| is the root directory. | 1306 // Returns if there is an error or |dir_path| is the root directory. |
| 1307 if (error != GDATA_FILE_OK || | 1307 if (error != GDATA_FILE_OK || |
| 1308 dir->resource_id() == kGDataRootDirectoryResourceId) { | 1308 dir->resource_id() == kGDataRootDirectoryResourceId) { |
| 1309 if (!callback.is_null()) { | 1309 callback.Run(error, file_path); |
| 1310 MessageLoop::current()->PostTask(FROM_HERE, | |
| 1311 base::Bind(callback, error, file_path)); | |
| 1312 } | |
| 1313 return; | 1310 return; |
| 1314 } | 1311 } |
| 1315 | 1312 |
| 1316 documents_service_->RemoveResourceFromDirectory( | 1313 documents_service_->RemoveResourceFromDirectory( |
| 1317 dir->content_url(), | 1314 dir->content_url(), |
| 1318 entry->edit_url(), | 1315 entry->edit_url(), |
| 1319 entry->resource_id(), | 1316 entry->resource_id(), |
| 1320 base::Bind(&GDataFileSystem::RemoveEntryFromDirectoryOnFileSystem, | 1317 base::Bind(&GDataFileSystem::MoveEntryToRootDirectoryLocally, |
| 1321 ui_weak_ptr_, | 1318 ui_weak_ptr_, |
| 1322 callback, | 1319 callback, |
| 1323 file_path, | 1320 file_path, |
| 1324 dir_path)); | 1321 dir_path)); |
| 1325 } | 1322 } |
| 1326 | 1323 |
| 1327 void GDataFileSystem::Remove(const FilePath& file_path, | 1324 void GDataFileSystem::Remove(const FilePath& file_path, |
| 1328 bool is_recursive, | 1325 bool is_recursive, |
| 1329 const FileOperationCallback& callback) { | 1326 const FileOperationCallback& callback) { |
| 1330 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || | 1327 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || |
| (...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2524 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 2521 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 2525 DCHECK(!callback.is_null()); | 2522 DCHECK(!callback.is_null()); |
| 2526 | 2523 |
| 2527 GDataFileError error = util::GDataToGDataFileError(status); | 2524 GDataFileError error = util::GDataToGDataFileError(status); |
| 2528 if (error == GDATA_FILE_OK) { | 2525 if (error == GDATA_FILE_OK) { |
| 2529 GDataEntry* entry = directory_service_->FindEntryByPathSync(file_path); | 2526 GDataEntry* entry = directory_service_->FindEntryByPathSync(file_path); |
| 2530 if (entry) { | 2527 if (entry) { |
| 2531 DCHECK_EQ(directory_service_->root(), entry->parent()); | 2528 DCHECK_EQ(directory_service_->root(), entry->parent()); |
| 2532 directory_service_->MoveEntryToDirectory(dir_path, entry, | 2529 directory_service_->MoveEntryToDirectory(dir_path, entry, |
| 2533 base::Bind( | 2530 base::Bind( |
| 2534 &GDataFileSystem::OnMoveEntryToDirectoryWithFileOperationCallback, | 2531 &GDataFileSystem::NotifyAndRunFileOperationCallback, |
| 2535 ui_weak_ptr_, | 2532 ui_weak_ptr_, |
| 2536 callback)); | 2533 callback)); |
| 2537 return; | 2534 return; |
| 2538 } else { | 2535 } else { |
| 2539 error = GDATA_FILE_ERROR_NOT_FOUND; | 2536 error = GDATA_FILE_ERROR_NOT_FOUND; |
| 2540 } | 2537 } |
| 2541 } | 2538 } |
| 2542 | 2539 |
| 2543 callback.Run(error); | 2540 callback.Run(error); |
| 2544 } | 2541 } |
| 2545 | 2542 |
| 2546 void GDataFileSystem::OnRemovedDocument( | 2543 void GDataFileSystem::OnRemovedDocument( |
| 2547 const FileOperationCallback& callback, | 2544 const FileOperationCallback& callback, |
| 2548 const FilePath& file_path, | 2545 const FilePath& file_path, |
| 2549 GDataErrorCode status, | 2546 GDataErrorCode status, |
| 2550 const GURL& document_url) { | 2547 const GURL& document_url) { |
| 2551 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 2548 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 2552 | 2549 |
| 2553 GDataFileError error = util::GDataToGDataFileError(status); | 2550 GDataFileError error = util::GDataToGDataFileError(status); |
| 2554 | 2551 |
| 2555 if (error == GDATA_FILE_OK) | 2552 if (error == GDATA_FILE_OK) |
| 2556 error = RemoveEntryFromFileSystem(file_path); | 2553 error = RemoveEntryAndCacheLocally(file_path); |
| 2557 | 2554 |
| 2558 if (!callback.is_null()) { | 2555 if (!callback.is_null()) { |
| 2559 callback.Run(error); | 2556 callback.Run(error); |
| 2560 } | 2557 } |
| 2561 } | 2558 } |
| 2562 | 2559 |
| 2563 void GDataFileSystem::OnFileDownloaded( | 2560 void GDataFileSystem::OnFileDownloaded( |
| 2564 const GetFileFromCacheParams& params, | 2561 const GetFileFromCacheParams& params, |
| 2565 GDataErrorCode status, | 2562 GDataErrorCode status, |
| 2566 const GURL& content_url, | 2563 const GURL& content_url, |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2659 } | 2656 } |
| 2660 } | 2657 } |
| 2661 | 2658 |
| 2662 void GDataFileSystem::OnDownloadStoredToCache(GDataFileError error, | 2659 void GDataFileSystem::OnDownloadStoredToCache(GDataFileError error, |
| 2663 const std::string& resource_id, | 2660 const std::string& resource_id, |
| 2664 const std::string& md5) { | 2661 const std::string& md5) { |
| 2665 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 2662 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 2666 // Nothing much to do here for now. | 2663 // Nothing much to do here for now. |
| 2667 } | 2664 } |
| 2668 | 2665 |
| 2669 void GDataFileSystem::RenameFileOnFileSystem( | 2666 void GDataFileSystem::RenameEntryLocally( |
| 2670 const FilePath& file_path, | 2667 const FilePath& file_path, |
| 2671 const FilePath::StringType& new_name, | 2668 const FilePath::StringType& new_name, |
| 2672 const FileMoveCallback& callback, | 2669 const FileMoveCallback& callback, |
| 2673 GDataErrorCode status, | 2670 GDataErrorCode status, |
| 2674 const GURL& document_url) { | 2671 const GURL& document_url) { |
| 2675 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 2672 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 2676 | 2673 |
| 2677 const GDataFileError error = util::GDataToGDataFileError(status); | 2674 const GDataFileError error = util::GDataToGDataFileError(status); |
| 2678 if (error != GDATA_FILE_OK) { | 2675 if (error != GDATA_FILE_OK) { |
| 2679 if (!callback.is_null()) | 2676 if (!callback.is_null()) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 2693 // After changing the title of the entry, call MoveEntryToDirectory() to | 2690 // After changing the title of the entry, call MoveEntryToDirectory() to |
| 2694 // remove the entry from its parent directory and then add it back in order to | 2691 // remove the entry from its parent directory and then add it back in order to |
| 2695 // go through the file name de-duplication. | 2692 // go through the file name de-duplication. |
| 2696 // TODO(achuith/satorux/zel): This code is fragile. The title has been | 2693 // TODO(achuith/satorux/zel): This code is fragile. The title has been |
| 2697 // changed, but not the file_name. MoveEntryToDirectory calls RemoveChild to | 2694 // changed, but not the file_name. MoveEntryToDirectory calls RemoveChild to |
| 2698 // remove the child based on the old file_name, and then re-adds the child by | 2695 // remove the child based on the old file_name, and then re-adds the child by |
| 2699 // first assigning the new title to file_name. http://crbug.com/30157 | 2696 // first assigning the new title to file_name. http://crbug.com/30157 |
| 2700 directory_service_->MoveEntryToDirectory( | 2697 directory_service_->MoveEntryToDirectory( |
| 2701 entry->parent()->GetFilePath(), | 2698 entry->parent()->GetFilePath(), |
| 2702 entry, | 2699 entry, |
| 2703 base::Bind(&GDataFileSystem::OnMoveEntryToDirectoryWithFileMoveCallback, | 2700 base::Bind(&GDataFileSystem::NotifyAndRunFileMoveCallback, |
| 2704 ui_weak_ptr_, | 2701 ui_weak_ptr_, |
| 2705 callback)); | 2702 callback)); |
| 2706 } | 2703 } |
| 2707 | 2704 |
| 2708 void GDataFileSystem::RemoveEntryFromDirectoryOnFileSystem( | 2705 void GDataFileSystem::MoveEntryToRootDirectoryLocally( |
| 2709 const FileMoveCallback& callback, | 2706 const FileMoveCallback& callback, |
| 2710 const FilePath& file_path, | 2707 const FilePath& file_path, |
| 2711 const FilePath& dir_path, | 2708 const FilePath& dir_path, |
| 2712 GDataErrorCode status, | 2709 GDataErrorCode status, |
| 2713 const GURL& document_url) { | 2710 const GURL& document_url) { |
| 2714 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 2711 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 2712 DCHECK(!callback.is_null()); |
| 2715 | 2713 |
| 2716 const GDataFileError error = util::GDataToGDataFileError(status); | 2714 const GDataFileError error = util::GDataToGDataFileError(status); |
| 2717 if (error != GDATA_FILE_OK) { | 2715 if (error != GDATA_FILE_OK) { |
| 2718 if (!callback.is_null()) | 2716 callback.Run(error, FilePath()); |
| 2719 callback.Run(error, FilePath()); | |
| 2720 return; | 2717 return; |
| 2721 } | 2718 } |
| 2722 | 2719 |
| 2723 GDataEntry* entry = directory_service_->FindEntryByPathSync(file_path); | 2720 GDataEntry* entry = directory_service_->FindEntryByPathSync(file_path); |
| 2724 if (!entry) { | 2721 if (!entry) { |
| 2725 if (!callback.is_null()) | 2722 callback.Run(GDATA_FILE_ERROR_NOT_FOUND, FilePath()); |
| 2726 callback.Run(GDATA_FILE_ERROR_NOT_FOUND, FilePath()); | |
| 2727 return; | 2723 return; |
| 2728 } | 2724 } |
| 2729 | 2725 |
| 2730 directory_service_->MoveEntryToDirectory( | 2726 directory_service_->MoveEntryToDirectory( |
| 2731 directory_service_->root()->GetFilePath(), | 2727 directory_service_->root()->GetFilePath(), |
| 2732 entry, | 2728 entry, |
| 2733 base::Bind(&GDataFileSystem::OnMoveEntryToDirectoryWithFileMoveCallback, | 2729 base::Bind(&GDataFileSystem::NotifyAndRunFileMoveCallback, |
| 2734 ui_weak_ptr_, | 2730 ui_weak_ptr_, |
| 2735 callback)); | 2731 callback)); |
| 2736 } | 2732 } |
| 2737 | 2733 |
| 2738 void GDataFileSystem::OnMoveEntryToDirectoryWithFileMoveCallback( | 2734 void GDataFileSystem::NotifyAndRunFileMoveCallback( |
| 2739 const FileMoveCallback& callback, | 2735 const FileMoveCallback& callback, |
| 2740 GDataFileError error, | 2736 GDataFileError error, |
| 2741 const FilePath& moved_file_path) { | 2737 const FilePath& moved_file_path) { |
| 2738 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 2739 DCHECK(!callback.is_null()); |
| 2740 |
| 2742 if (error == GDATA_FILE_OK) | 2741 if (error == GDATA_FILE_OK) |
| 2743 OnDirectoryChanged(moved_file_path.DirName()); | 2742 OnDirectoryChanged(moved_file_path.DirName()); |
| 2744 | 2743 |
| 2745 if (!callback.is_null()) | 2744 callback.Run(error, moved_file_path); |
| 2746 callback.Run(error, moved_file_path); | |
| 2747 } | 2745 } |
| 2748 | 2746 |
| 2749 void GDataFileSystem::OnMoveEntryToDirectoryWithFileOperationCallback( | 2747 void GDataFileSystem::NotifyAndRunFileOperationCallback( |
| 2750 const FileOperationCallback& callback, | 2748 const FileOperationCallback& callback, |
| 2751 GDataFileError error, | 2749 GDataFileError error, |
| 2752 const FilePath& moved_file_path) { | 2750 const FilePath& moved_file_path) { |
| 2751 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 2753 DCHECK(!callback.is_null()); | 2752 DCHECK(!callback.is_null()); |
| 2754 | 2753 |
| 2755 if (error == GDATA_FILE_OK) | 2754 if (error == GDATA_FILE_OK) |
| 2756 OnDirectoryChanged(moved_file_path.DirName()); | 2755 OnDirectoryChanged(moved_file_path.DirName()); |
| 2757 | 2756 |
| 2758 callback.Run(error); | 2757 callback.Run(error); |
| 2759 } | 2758 } |
| 2760 | 2759 |
| 2761 GDataFileError GDataFileSystem::RemoveEntryFromFileSystem( | 2760 GDataFileError GDataFileSystem::RemoveEntryAndCacheLocally( |
| 2762 const FilePath& file_path) { | 2761 const FilePath& file_path) { |
| 2763 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 2762 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 2764 | 2763 |
| 2765 std::string resource_id; | 2764 std::string resource_id; |
| 2766 GDataFileError error = RemoveEntryFromGData(file_path, &resource_id); | 2765 GDataFileError error = RemoveEntryLocally(file_path, &resource_id); |
| 2767 if (error != GDATA_FILE_OK) | 2766 if (error != GDATA_FILE_OK) |
| 2768 return error; | 2767 return error; |
| 2769 | 2768 |
| 2770 // If resource_id is not empty, remove its corresponding file from cache. | 2769 // If resource_id is not empty, remove its corresponding file from cache. |
| 2771 if (!resource_id.empty()) | 2770 if (!resource_id.empty()) |
| 2772 cache_->RemoveOnUIThread(resource_id, CacheOperationCallback()); | 2771 cache_->RemoveOnUIThread(resource_id, CacheOperationCallback()); |
| 2773 | 2772 |
| 2774 return GDATA_FILE_OK; | 2773 return GDATA_FILE_OK; |
| 2775 } | 2774 } |
| 2776 | 2775 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2882 return FOUND_INVALID; | 2881 return FOUND_INVALID; |
| 2883 } | 2882 } |
| 2884 } else { | 2883 } else { |
| 2885 *first_missing_parent_path = current_path; | 2884 *first_missing_parent_path = current_path; |
| 2886 return FOUND_MISSING; | 2885 return FOUND_MISSING; |
| 2887 } | 2886 } |
| 2888 } | 2887 } |
| 2889 return DIRECTORY_ALREADY_PRESENT; | 2888 return DIRECTORY_ALREADY_PRESENT; |
| 2890 } | 2889 } |
| 2891 | 2890 |
| 2892 GDataFileError GDataFileSystem::RemoveEntryFromGData( | 2891 GDataFileError GDataFileSystem::RemoveEntryLocally( |
| 2893 const FilePath& file_path, std::string* resource_id) { | 2892 const FilePath& file_path, std::string* resource_id) { |
| 2894 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 2893 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 2895 | 2894 |
| 2896 resource_id->clear(); | 2895 resource_id->clear(); |
| 2897 | 2896 |
| 2898 // Find directory element within the cached file system snapshot. | 2897 // Find directory element within the cached file system snapshot. |
| 2899 GDataEntry* entry = directory_service_->FindEntryByPathSync(file_path); | 2898 GDataEntry* entry = directory_service_->FindEntryByPathSync(file_path); |
| 2900 | 2899 |
| 2901 if (!entry) | 2900 if (!entry) |
| 2902 return GDATA_FILE_ERROR_NOT_FOUND; | 2901 return GDATA_FILE_ERROR_NOT_FOUND; |
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3466 } | 3465 } |
| 3467 | 3466 |
| 3468 PlatformFileInfoProto entry_file_info; | 3467 PlatformFileInfoProto entry_file_info; |
| 3469 GDataEntry::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info); | 3468 GDataEntry::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info); |
| 3470 *entry_proto->mutable_file_info() = entry_file_info; | 3469 *entry_proto->mutable_file_info() = entry_file_info; |
| 3471 if (!callback.is_null()) | 3470 if (!callback.is_null()) |
| 3472 callback.Run(GDATA_FILE_OK, entry_proto.Pass()); | 3471 callback.Run(GDATA_FILE_OK, entry_proto.Pass()); |
| 3473 } | 3472 } |
| 3474 | 3473 |
| 3475 } // namespace gdata | 3474 } // namespace gdata |
| OLD | NEW |