Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(984)

Unified Diff: chrome/browser/chromeos/drive/file_system/search_operation.cc

Issue 16142003: Report all Drive search results even if resource metadata is not fully loaded. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/chromeos/drive/file_system/search_operation_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/drive/file_system/search_operation.cc
diff --git a/chrome/browser/chromeos/drive/file_system/search_operation.cc b/chrome/browser/chromeos/drive/file_system/search_operation.cc
index 59fcff38bef7e30ed58b5417be47396a383a2462..6029d0c8894c1a99bd3a4e9a3498462488345daf 100644
--- a/chrome/browser/chromeos/drive/file_system/search_operation.cc
+++ b/chrome/browser/chromeos/drive/file_system/search_operation.cc
@@ -42,25 +42,23 @@ FileError RefreshEntriesOnBlockingPool(
base::FilePath drive_file_path;
FileError error = resource_metadata->RefreshEntry(
entry, &drive_file_path, &entry);
- if (error == FILE_ERROR_OK) {
- result->push_back(SearchResultInfo(drive_file_path, entry));
- } else if (error == FILE_ERROR_NOT_FOUND) {
- // The result is absent in local resource metadata. There are two cases:
+ if (error == FILE_ERROR_NOT_FOUND) {
+ // The result is absent in local resource metadata. This can happen if
+ // the metadata is not synced to the latest server state yet. In that
+ // case, we temporarily add the file to the special "drive/other"
+ // directory in order to assign a path, which is needed to access the
+ // file through FileSystem API.
//
- // 1) Resource metadata is not up-to-date, and the entry has recently
- // been added to the drive. This is not a fatal error, so just skip to
- // add the result. We should soon receive XMPP update notification
- // and refresh both the metadata and search result UI in Files.app.
- //
- // 2) Resource metadata is not fully loaded.
- // TODO(kinaba) crbug.com/181075:
- // In this case, we are doing "fast fetch" fetching directory lists on
- // the fly to quickly deliver results to the user. However, we have no
- // such equivalent for Search.
- } else {
- // Otherwise, it is a fatal error. Give up to return the search result.
- return error;
+ // It will be moved to the right place after
hashimoto 2013/05/30 02:13:10 nit: Please make it clarify the timing when the ad
kinaba 2013/05/30 03:19:36 Done.
+ entry.set_parent_resource_id(util::kDriveOtherDirSpecialResourceId);
+ error = resource_metadata->AddEntry(entry);
+ if (error == FILE_ERROR_OK || error == FILE_ERROR_EXISTS)
hashimoto 2013/05/30 02:13:10 IIRC, AddEntry does not return FILE_ERROR_EXISTS f
kinaba 2013/05/30 03:19:36 As chatted offline, this is for the case when the
+ resource_metadata->RefreshEntry(entry, &drive_file_path, &entry);
hashimoto 2013/05/30 02:13:10 RefreshEntry here seems redandunt. I think you mig
kinaba 2013/05/30 03:19:36 Done.
}
+ // Otherwise, it is a fatal error. Give up to return the search result.
+ if (error != FILE_ERROR_OK)
+ return error;
+ result->push_back(SearchResultInfo(drive_file_path, entry));
}
return FILE_ERROR_OK;
« no previous file with comments | « no previous file | chrome/browser/chromeos/drive/file_system/search_operation_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698