| 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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 | 241 |
| 242 ResourceEntryMap::iterator it_parent = | 242 ResourceEntryMap::iterator it_parent = |
| 243 entry_map_.find(parent_resource_id); | 243 entry_map_.find(parent_resource_id); |
| 244 if (it_parent == entry_map_.end()) { | 244 if (it_parent == entry_map_.end()) { |
| 245 // Current entry's parent is already updated or not going to be updated, | 245 // Current entry's parent is already updated or not going to be updated, |
| 246 // get the parent from the local tree. | 246 // get the parent from the local tree. |
| 247 std::string parent_local_id; | 247 std::string parent_local_id; |
| 248 FileError error = resource_metadata_->GetIdByResourceId( | 248 FileError error = resource_metadata_->GetIdByResourceId( |
| 249 parent_resource_id, &parent_local_id); | 249 parent_resource_id, &parent_local_id); |
| 250 if (error != FILE_ERROR_OK) { | 250 if (error != FILE_ERROR_OK) { |
| 251 LOG(ERROR) << "Failed to get local ID: " << parent_resource_id | 251 // See crbug.com/326043. In some complicated situations, parent folder |
| 252 << ", error = " << FileErrorToString(error); | 252 // for shared entries may be accessible (and hence its resource id is |
| 253 // included), but not in the change/file list. |
| 254 // In such a case, clear the parent and move it to drive/other. |
| 255 if (error == FILE_ERROR_NOT_FOUND) { |
| 256 parent_resource_id_map_[it->first] = ""; |
| 257 } else { |
| 258 LOG(ERROR) << "Failed to get local ID: " << parent_resource_id |
| 259 << ", error = " << FileErrorToString(error); |
| 260 } |
| 253 break; | 261 break; |
| 254 } | 262 } |
| 255 ResourceEntry parent_entry; | 263 ResourceEntry parent_entry; |
| 256 while (it_parent == entry_map_.end() && !parent_local_id.empty()) { | 264 while (it_parent == entry_map_.end() && !parent_local_id.empty()) { |
| 257 error = resource_metadata_->GetResourceEntryById( | 265 error = resource_metadata_->GetResourceEntryById( |
| 258 parent_local_id, &parent_entry); | 266 parent_local_id, &parent_entry); |
| 259 if (error != FILE_ERROR_OK) { | 267 if (error != FILE_ERROR_OK) { |
| 260 LOG(ERROR) << "Failed to get local entry: " | 268 LOG(ERROR) << "Failed to get local entry: " |
| 261 << FileErrorToString(error); | 269 << FileErrorToString(error); |
| 262 break; | 270 break; |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 resource_metadata_->GetSubDirectoriesRecursively(local_id, | 462 resource_metadata_->GetSubDirectoriesRecursively(local_id, |
| 455 &sub_directories); | 463 &sub_directories); |
| 456 changed_dirs_.insert(sub_directories.begin(), sub_directories.end()); | 464 changed_dirs_.insert(sub_directories.begin(), sub_directories.end()); |
| 457 } | 465 } |
| 458 } | 466 } |
| 459 } | 467 } |
| 460 } | 468 } |
| 461 | 469 |
| 462 } // namespace internal | 470 } // namespace internal |
| 463 } // namespace drive | 471 } // namespace drive |
| OLD | NEW |