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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
240 break; | 240 break; |
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) { |
hashimoto
2013/12/20 07:41:56
nit; Could you emit an error for errors other than
kinaba
2013/12/20 07:51:47
Sounds good. Reverted the treatment of other error
| |
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 parent_resource_id_map_[it->first] = ""; | |
253 break; | 256 break; |
254 } | 257 } |
255 ResourceEntry parent_entry; | 258 ResourceEntry parent_entry; |
256 while (it_parent == entry_map_.end() && !parent_local_id.empty()) { | 259 while (it_parent == entry_map_.end() && !parent_local_id.empty()) { |
257 error = resource_metadata_->GetResourceEntryById( | 260 error = resource_metadata_->GetResourceEntryById( |
258 parent_local_id, &parent_entry); | 261 parent_local_id, &parent_entry); |
259 if (error != FILE_ERROR_OK) { | 262 if (error != FILE_ERROR_OK) { |
260 LOG(ERROR) << "Failed to get local entry: " | 263 LOG(ERROR) << "Failed to get local entry: " |
261 << FileErrorToString(error); | 264 << FileErrorToString(error); |
262 break; | 265 break; |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
454 resource_metadata_->GetSubDirectoriesRecursively(local_id, | 457 resource_metadata_->GetSubDirectoriesRecursively(local_id, |
455 &sub_directories); | 458 &sub_directories); |
456 changed_dirs_.insert(sub_directories.begin(), sub_directories.end()); | 459 changed_dirs_.insert(sub_directories.begin(), sub_directories.end()); |
457 } | 460 } |
458 } | 461 } |
459 } | 462 } |
460 } | 463 } |
461 | 464 |
462 } // namespace internal | 465 } // namespace internal |
463 } // namespace drive | 466 } // namespace drive |
OLD | NEW |