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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "chrome/browser/chromeos/drive/drive.pb.h" | 10 #include "chrome/browser/chromeos/drive/drive.pb.h" |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 } | 345 } |
346 | 346 |
347 for (size_t j = 0; j < feed->entries().size(); ++j) { | 347 for (size_t j = 0; j < feed->entries().size(); ++j) { |
348 const google_apis::ResourceEntry* entry = feed->entries()[j]; | 348 const google_apis::ResourceEntry* entry = feed->entries()[j]; |
349 DriveEntryProto entry_proto = | 349 DriveEntryProto entry_proto = |
350 ConvertResourceEntryToDriveEntryProto(*entry); | 350 ConvertResourceEntryToDriveEntryProto(*entry); |
351 // Some document entries don't map into files (i.e. sites). | 351 // Some document entries don't map into files (i.e. sites). |
352 if (entry_proto.resource_id().empty()) | 352 if (entry_proto.resource_id().empty()) |
353 continue; | 353 continue; |
354 | 354 |
| 355 // TODO(haruki): Apply mapping from an empty parent to special dummy |
| 356 // directory here or in ConvertResourceEntryToDriveEntryProto. See |
| 357 // http://crbug.com/174233 http://crbug.com/171207. Until we implement it, |
| 358 // ChangeListProcessor ignores such "no parent" entries. |
| 359 // Please note that this will cause a temporal issue when |
| 360 // - The user unselect all the parent using drive.google.com UI. |
| 361 // ChangeListProcessor just ignores the incoming changes and keeps stale |
| 362 // metadata. We need to work on this ASAP to reduce confusion. |
| 363 if (entry_proto.parent_resource_id().empty()) { |
| 364 continue; |
| 365 } |
| 366 |
355 // Count the number of files. | 367 // Count the number of files. |
356 if (uma_stats && !entry_proto.file_info().is_directory()) { | 368 if (uma_stats && !entry_proto.file_info().is_directory()) { |
357 uma_stats->IncrementNumFiles( | 369 uma_stats->IncrementNumFiles( |
358 entry_proto.file_specific_info().is_hosted_document()); | 370 entry_proto.file_specific_info().is_hosted_document()); |
359 } | 371 } |
360 | 372 |
361 std::pair<DriveEntryProtoMap::iterator, bool> ret = entry_proto_map_. | 373 std::pair<DriveEntryProtoMap::iterator, bool> ret = entry_proto_map_. |
362 insert(std::make_pair(entry_proto.resource_id(), entry_proto)); | 374 insert(std::make_pair(entry_proto.resource_id(), entry_proto)); |
363 DCHECK(ret.second); | 375 DCHECK(ret.second); |
364 if (!ret.second) | 376 if (!ret.second) |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 445 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
434 | 446 |
435 entry_proto_map_.clear(); | 447 entry_proto_map_.clear(); |
436 changed_dirs_.clear(); | 448 changed_dirs_.clear(); |
437 root_upload_url_ = GURL(); | 449 root_upload_url_ = GURL(); |
438 largest_changestamp_ = 0; | 450 largest_changestamp_ = 0; |
439 on_complete_callback_.Reset(); | 451 on_complete_callback_.Reset(); |
440 } | 452 } |
441 | 453 |
442 } // namespace drive | 454 } // namespace drive |
OLD | NEW |