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/drive/change_list_processor.h" | 5 #include "chrome/browser/chromeos/drive/change_list_processor.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "chrome/browser/chromeos/drive/drive.pb.h" | 9 #include "chrome/browser/chromeos/drive/drive.pb.h" |
10 #include "chrome/browser/chromeos/drive/file_system_util.h" | 10 #include "chrome/browser/chromeos/drive/file_system_util.h" |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
314 switch (get_existing_entry_result) { | 314 switch (get_existing_entry_result) { |
315 case FILE_ERROR_OK: | 315 case FILE_ERROR_OK: |
316 error = resource_metadata_->RemoveEntry(local_id); | 316 error = resource_metadata_->RemoveEntry(local_id); |
317 break; | 317 break; |
318 case FILE_ERROR_NOT_FOUND: // Already deleted. | 318 case FILE_ERROR_NOT_FOUND: // Already deleted. |
319 error = FILE_ERROR_OK; | 319 error = FILE_ERROR_OK; |
320 break; | 320 break; |
321 default: | 321 default: |
322 error = get_existing_entry_result; | 322 error = get_existing_entry_result; |
323 } | 323 } |
324 } else if (existing_entry.parent_local_id() == util::kDriveOtherDirLocalId && | |
325 existing_entry.deleted()) { | |
kinaba
2013/11/12 06:21:29
Is it correct that a file inside a deleted directo
hashimoto
2013/11/25 10:13:58
Recursively marking entries as deleted might be bu
| |
326 // This entry was deleted locally, do nothing. | |
327 error = FILE_ERROR_OK; | |
324 } else { | 328 } else { |
329 // Add or refresh the entry. | |
325 const std::string& parent_resource_id = | 330 const std::string& parent_resource_id = |
326 parent_resource_id_map_[entry.resource_id()]; | 331 parent_resource_id_map_[entry.resource_id()]; |
327 DCHECK(!parent_resource_id.empty()) << entry.resource_id(); | 332 DCHECK(!parent_resource_id.empty()) << entry.resource_id(); |
328 | 333 |
329 std::string parent_local_id; | 334 std::string parent_local_id; |
330 error = resource_metadata_->GetIdByResourceId( | 335 error = resource_metadata_->GetIdByResourceId( |
331 parent_resource_id, &parent_local_id); | 336 parent_resource_id, &parent_local_id); |
332 if (error == FILE_ERROR_OK) { | 337 if (error == FILE_ERROR_OK) { |
333 ResourceEntry new_entry(entry); | 338 ResourceEntry new_entry(entry); |
334 new_entry.set_parent_local_id(parent_local_id); | 339 new_entry.set_parent_local_id(parent_local_id); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
449 resource_metadata_->GetSubDirectoriesRecursively(local_id, | 454 resource_metadata_->GetSubDirectoriesRecursively(local_id, |
450 &sub_directories); | 455 &sub_directories); |
451 changed_dirs_.insert(sub_directories.begin(), sub_directories.end()); | 456 changed_dirs_.insert(sub_directories.begin(), sub_directories.end()); |
452 } | 457 } |
453 } | 458 } |
454 } | 459 } |
455 } | 460 } |
456 | 461 |
457 } // namespace internal | 462 } // namespace internal |
458 } // namespace drive | 463 } // namespace drive |
OLD | NEW |