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; |