OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/app_list/app_list_syncable_service.h" | 5 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 // to an extension service delegate associated with this class. | 216 // to an extension service delegate associated with this class. |
217 AppListControllerDelegate* controller = NULL; | 217 AppListControllerDelegate* controller = NULL; |
218 AppListService* service = | 218 AppListService* service = |
219 AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE); | 219 AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE); |
220 if (service) | 220 if (service) |
221 controller = service->GetControllerDelegate(); | 221 controller = service->GetControllerDelegate(); |
222 apps_builder_.reset(new ExtensionAppModelBuilder(controller)); | 222 apps_builder_.reset(new ExtensionAppModelBuilder(controller)); |
223 DCHECK(profile_); | 223 DCHECK(profile_); |
224 // TODO(stevenjb): Correctly handle OTR profiles for Guest mode. | 224 // TODO(stevenjb): Correctly handle OTR profiles for Guest mode. |
225 if (!profile_->IsOffTheRecord() && SyncAppListEnabled()) { | 225 if (!profile_->IsOffTheRecord() && SyncAppListEnabled()) { |
226 DVLOG(1) << this << ": AppListSyncableService: InitializeWithService."; | 226 VLOG(1) << this << ": AppListSyncableService: InitializeWithService."; |
227 SyncStarted(); | 227 SyncStarted(); |
228 apps_builder_->InitializeWithService(this); | 228 apps_builder_->InitializeWithService(this); |
229 } else { | 229 } else { |
230 DVLOG(1) << this << ": AppListSyncableService: InitializeWithProfile."; | 230 VLOG(1) << this << ": AppListSyncableService: InitializeWithProfile."; |
231 apps_builder_->InitializeWithProfile(profile_, model_.get()); | 231 apps_builder_->InitializeWithProfile(profile_, model_.get()); |
232 } | 232 } |
233 } | 233 } |
234 | 234 |
235 void AppListSyncableService::Observe( | 235 void AppListSyncableService::Observe( |
236 int type, | 236 int type, |
237 const content::NotificationSource& source, | 237 const content::NotificationSource& source, |
238 const content::NotificationDetails& details) { | 238 const content::NotificationDetails& details) { |
239 DCHECK_EQ(chrome::NOTIFICATION_EXTENSIONS_READY, type); | 239 DCHECK_EQ(chrome::NOTIFICATION_EXTENSIONS_READY, type); |
240 DCHECK_EQ(profile_, content::Source<Profile>(source).ptr()); | 240 DCHECK_EQ(profile_, content::Source<Profile>(source).ptr()); |
(...skipping 18 matching lines...) Expand all Loading... |
259 | 259 |
260 void AppListSyncableService::AddItem(scoped_ptr<AppListItem> app_item) { | 260 void AppListSyncableService::AddItem(scoped_ptr<AppListItem> app_item) { |
261 SyncItem* sync_item = FindOrAddSyncItem(app_item.get()); | 261 SyncItem* sync_item = FindOrAddSyncItem(app_item.get()); |
262 if (!sync_item) | 262 if (!sync_item) |
263 return; // Item is not valid. | 263 return; // Item is not valid. |
264 | 264 |
265 std::string folder_id; | 265 std::string folder_id; |
266 if (app_list::switches::IsFolderUIEnabled()) { | 266 if (app_list::switches::IsFolderUIEnabled()) { |
267 if (AppIsOem(app_item->id())) { | 267 if (AppIsOem(app_item->id())) { |
268 folder_id = FindOrCreateOemFolder(); | 268 folder_id = FindOrCreateOemFolder(); |
269 DVLOG(1) << this << ": AddItem to OEM folder: " << sync_item->ToString(); | 269 VLOG(2) << this << ": AddItem to OEM folder: " << sync_item->ToString(); |
270 } else { | 270 } else { |
271 folder_id = sync_item->parent_id; | 271 folder_id = sync_item->parent_id; |
272 DVLOG(1) << this << ": AddItem: " << sync_item->ToString() | |
273 << " Folder: '" << folder_id << "'"; | |
274 } | 272 } |
275 } | 273 } |
276 DVLOG(1) << this << ": AddItem: " << sync_item->ToString() | 274 VLOG(2) << this << ": AddItem: " << sync_item->ToString() |
277 << "Folder: '" << folder_id << "'"; | 275 << "Folder: '" << folder_id << "'"; |
278 model_->AddItemToFolder(app_item.Pass(), folder_id); | 276 model_->AddItemToFolder(app_item.Pass(), folder_id); |
279 } | 277 } |
280 | 278 |
281 AppListSyncableService::SyncItem* AppListSyncableService::FindOrAddSyncItem( | 279 AppListSyncableService::SyncItem* AppListSyncableService::FindOrAddSyncItem( |
282 AppListItem* app_item) { | 280 AppListItem* app_item) { |
283 const std::string& item_id = app_item->id(); | 281 const std::string& item_id = app_item->id(); |
284 if (item_id.empty()) { | 282 if (item_id.empty()) { |
285 LOG(ERROR) << "AppListItem item with empty ID"; | 283 LOG(ERROR) << "AppListItem item with empty ID"; |
286 return NULL; | 284 return NULL; |
287 } | 285 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 | 324 |
327 bool AppListSyncableService::RemoveDefaultApp(AppListItem* item, | 325 bool AppListSyncableService::RemoveDefaultApp(AppListItem* item, |
328 SyncItem* sync_item) { | 326 SyncItem* sync_item) { |
329 CHECK_EQ(sync_item->item_type, | 327 CHECK_EQ(sync_item->item_type, |
330 sync_pb::AppListSpecifics::TYPE_REMOVE_DEFAULT_APP); | 328 sync_pb::AppListSpecifics::TYPE_REMOVE_DEFAULT_APP); |
331 | 329 |
332 // If there is an existing REMOVE_DEFAULT_APP entry, and the app is | 330 // If there is an existing REMOVE_DEFAULT_APP entry, and the app is |
333 // installed as a Default app, uninstall the app instead of adding it. | 331 // installed as a Default app, uninstall the app instead of adding it. |
334 if (sync_item->item_type == sync_pb::AppListSpecifics::TYPE_APP && | 332 if (sync_item->item_type == sync_pb::AppListSpecifics::TYPE_APP && |
335 AppIsDefault(extension_system_->extension_service(), item->id())) { | 333 AppIsDefault(extension_system_->extension_service(), item->id())) { |
336 DVLOG(1) << this << ": HandleDefaultApp: Uninstall: " | 334 VLOG(2) << this << ": HandleDefaultApp: Uninstall: " |
337 << sync_item->ToString(); | 335 << sync_item->ToString(); |
338 UninstallExtension(extension_system_->extension_service(), item->id()); | 336 UninstallExtension(extension_system_->extension_service(), item->id()); |
339 return true; | 337 return true; |
340 } | 338 } |
341 | 339 |
342 // Otherwise, we are adding the app as a non-default app (i.e. an app that | 340 // Otherwise, we are adding the app as a non-default app (i.e. an app that |
343 // was installed by Default and removed is getting installed explicitly by | 341 // was installed by Default and removed is getting installed explicitly by |
344 // the user), so delete the REMOVE_DEFAULT_APP. | 342 // the user), so delete the REMOVE_DEFAULT_APP. |
345 DeleteSyncItem(sync_item); | 343 DeleteSyncItem(sync_item); |
346 return false; | 344 return false; |
347 } | 345 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 if (!app_list::switches::IsFolderUIEnabled()) | 382 if (!app_list::switches::IsFolderUIEnabled()) |
385 return; | 383 return; |
386 bool is_oem = AppIsOem(app_item->id()); | 384 bool is_oem = AppIsOem(app_item->id()); |
387 if (!is_oem && app_item->folder_id() == kOemFolderId) | 385 if (!is_oem && app_item->folder_id() == kOemFolderId) |
388 model_->MoveItemToFolder(app_item, ""); | 386 model_->MoveItemToFolder(app_item, ""); |
389 else if (is_oem && app_item->folder_id() != kOemFolderId) | 387 else if (is_oem && app_item->folder_id() != kOemFolderId) |
390 model_->MoveItemToFolder(app_item, kOemFolderId); | 388 model_->MoveItemToFolder(app_item, kOemFolderId); |
391 } | 389 } |
392 | 390 |
393 void AppListSyncableService::RemoveSyncItem(const std::string& id) { | 391 void AppListSyncableService::RemoveSyncItem(const std::string& id) { |
394 DVLOG(2) << this << ": RemoveSyncItem: " << id.substr(0, 8); | 392 VLOG(2) << this << ": RemoveSyncItem: " << id.substr(0, 8); |
395 SyncItemMap::iterator iter = sync_items_.find(id); | 393 SyncItemMap::iterator iter = sync_items_.find(id); |
396 if (iter == sync_items_.end()) { | 394 if (iter == sync_items_.end()) { |
397 DVLOG(2) << this << " : RemoveSyncItem: No Item."; | 395 DVLOG(2) << this << " : RemoveSyncItem: No Item."; |
398 return; | 396 return; |
399 } | 397 } |
400 | 398 |
401 // Check for existing RemoveDefault sync item. | 399 // Check for existing RemoveDefault sync item. |
402 SyncItem* sync_item = iter->second; | 400 SyncItem* sync_item = iter->second; |
403 sync_pb::AppListSpecifics::AppListItemType type = sync_item->item_type; | 401 sync_pb::AppListSpecifics::AppListItemType type = sync_item->item_type; |
404 if (type == sync_pb::AppListSpecifics::TYPE_REMOVE_DEFAULT_APP) { | 402 if (type == sync_pb::AppListSpecifics::TYPE_REMOVE_DEFAULT_APP) { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 scoped_ptr<syncer::SyncErrorFactory> error_handler) { | 467 scoped_ptr<syncer::SyncErrorFactory> error_handler) { |
470 DCHECK(!sync_processor_.get()); | 468 DCHECK(!sync_processor_.get()); |
471 DCHECK(sync_processor.get()); | 469 DCHECK(sync_processor.get()); |
472 DCHECK(error_handler.get()); | 470 DCHECK(error_handler.get()); |
473 | 471 |
474 sync_processor_ = sync_processor.Pass(); | 472 sync_processor_ = sync_processor.Pass(); |
475 sync_error_handler_ = error_handler.Pass(); | 473 sync_error_handler_ = error_handler.Pass(); |
476 | 474 |
477 syncer::SyncMergeResult result = syncer::SyncMergeResult(type); | 475 syncer::SyncMergeResult result = syncer::SyncMergeResult(type); |
478 result.set_num_items_before_association(sync_items_.size()); | 476 result.set_num_items_before_association(sync_items_.size()); |
479 DVLOG(1) << this << ": MergeDataAndStartSyncing: " | 477 VLOG(1) << this << ": MergeDataAndStartSyncing: " |
480 << initial_sync_data.size(); | 478 << initial_sync_data.size(); |
481 | 479 |
482 // Copy all sync items to |unsynced_items|. | 480 // Copy all sync items to |unsynced_items|. |
483 std::set<std::string> unsynced_items; | 481 std::set<std::string> unsynced_items; |
484 for (SyncItemMap::const_iterator iter = sync_items_.begin(); | 482 for (SyncItemMap::const_iterator iter = sync_items_.begin(); |
485 iter != sync_items_.end(); ++iter) { | 483 iter != sync_items_.end(); ++iter) { |
486 unsynced_items.insert(iter->first); | 484 unsynced_items.insert(iter->first); |
487 } | 485 } |
488 | 486 |
489 // Create SyncItem entries for initial_sync_data. | 487 // Create SyncItem entries for initial_sync_data. |
490 size_t new_items = 0, updated_items = 0; | 488 size_t new_items = 0, updated_items = 0; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 DCHECK_EQ(type, syncer::APP_LIST); | 535 DCHECK_EQ(type, syncer::APP_LIST); |
538 | 536 |
539 sync_processor_.reset(); | 537 sync_processor_.reset(); |
540 sync_error_handler_.reset(); | 538 sync_error_handler_.reset(); |
541 } | 539 } |
542 | 540 |
543 syncer::SyncDataList AppListSyncableService::GetAllSyncData( | 541 syncer::SyncDataList AppListSyncableService::GetAllSyncData( |
544 syncer::ModelType type) const { | 542 syncer::ModelType type) const { |
545 DCHECK_EQ(syncer::APP_LIST, type); | 543 DCHECK_EQ(syncer::APP_LIST, type); |
546 | 544 |
547 DVLOG(1) << this << ": GetAllSyncData: " << sync_items_.size(); | 545 VLOG(1) << this << ": GetAllSyncData: " << sync_items_.size(); |
548 syncer::SyncDataList list; | 546 syncer::SyncDataList list; |
549 for (SyncItemMap::const_iterator iter = sync_items_.begin(); | 547 for (SyncItemMap::const_iterator iter = sync_items_.begin(); |
550 iter != sync_items_.end(); ++iter) { | 548 iter != sync_items_.end(); ++iter) { |
551 DVLOG(2) << this << " -> SYNC: " << iter->second->ToString(); | 549 DVLOG(2) << this << " -> SYNC: " << iter->second->ToString(); |
552 list.push_back(GetSyncDataFromSyncItem(iter->second)); | 550 list.push_back(GetSyncDataFromSyncItem(iter->second)); |
553 } | 551 } |
554 return list; | 552 return list; |
555 } | 553 } |
556 | 554 |
557 syncer::SyncError AppListSyncableService::ProcessSyncChanges( | 555 syncer::SyncError AppListSyncableService::ProcessSyncChanges( |
558 const tracked_objects::Location& from_here, | 556 const tracked_objects::Location& from_here, |
559 const syncer::SyncChangeList& change_list) { | 557 const syncer::SyncChangeList& change_list) { |
560 if (!sync_processor_.get()) { | 558 if (!sync_processor_.get()) { |
561 return syncer::SyncError(FROM_HERE, | 559 return syncer::SyncError(FROM_HERE, |
562 syncer::SyncError::DATATYPE_ERROR, | 560 syncer::SyncError::DATATYPE_ERROR, |
563 "App List syncable service is not started.", | 561 "App List syncable service is not started.", |
564 syncer::APP_LIST); | 562 syncer::APP_LIST); |
565 } | 563 } |
566 | 564 |
567 // Don't observe the model while processing incoming sync changes. | 565 // Don't observe the model while processing incoming sync changes. |
568 model_observer_.reset(); | 566 model_observer_.reset(); |
569 | 567 |
570 DVLOG(1) << this << ": ProcessSyncChanges: " << change_list.size(); | 568 VLOG(1) << this << ": ProcessSyncChanges: " << change_list.size(); |
571 for (syncer::SyncChangeList::const_iterator iter = change_list.begin(); | 569 for (syncer::SyncChangeList::const_iterator iter = change_list.begin(); |
572 iter != change_list.end(); ++iter) { | 570 iter != change_list.end(); ++iter) { |
573 const SyncChange& change = *iter; | 571 const SyncChange& change = *iter; |
574 DVLOG(2) << this << " Change: " | 572 DVLOG(2) << this << " Change: " |
575 << change.sync_data().GetSpecifics().app_list().item_id() | 573 << change.sync_data().GetSpecifics().app_list().item_id() |
576 << " (" << change.change_type() << ")"; | 574 << " (" << change.change_type() << ")"; |
577 if (change.change_type() == SyncChange::ACTION_ADD || | 575 if (change.change_type() == SyncChange::ACTION_ADD || |
578 change.change_type() == SyncChange::ACTION_UPDATE) { | 576 change.change_type() == SyncChange::ACTION_UPDATE) { |
579 ProcessSyncItemSpecifics(change.sync_data().GetSpecifics().app_list()); | 577 ProcessSyncItemSpecifics(change.sync_data().GetSpecifics().app_list()); |
580 } else if (change.change_type() == SyncChange::ACTION_DELETE) { | 578 } else if (change.change_type() == SyncChange::ACTION_DELETE) { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 } | 623 } |
626 | 624 |
627 sync_item = CreateSyncItem(item_id, specifics.item_type()); | 625 sync_item = CreateSyncItem(item_id, specifics.item_type()); |
628 UpdateSyncItemFromSync(specifics, sync_item); | 626 UpdateSyncItemFromSync(specifics, sync_item); |
629 ProcessNewSyncItem(sync_item); | 627 ProcessNewSyncItem(sync_item); |
630 DVLOG(2) << this << " <- SYNC ADD: " << sync_item->ToString(); | 628 DVLOG(2) << this << " <- SYNC ADD: " << sync_item->ToString(); |
631 return true; | 629 return true; |
632 } | 630 } |
633 | 631 |
634 void AppListSyncableService::ProcessNewSyncItem(SyncItem* sync_item) { | 632 void AppListSyncableService::ProcessNewSyncItem(SyncItem* sync_item) { |
635 DVLOG(2) << "ProcessNewSyncItem: " << sync_item->ToString(); | 633 VLOG(2) << "ProcessNewSyncItem: " << sync_item->ToString(); |
636 switch (sync_item->item_type) { | 634 switch (sync_item->item_type) { |
637 case sync_pb::AppListSpecifics::TYPE_APP: { | 635 case sync_pb::AppListSpecifics::TYPE_APP: { |
638 // New apps are added through ExtensionAppModelBuilder. | 636 // New apps are added through ExtensionAppModelBuilder. |
639 // TODO(stevenjb): Determine how to handle app items in sync that | 637 // TODO(stevenjb): Determine how to handle app items in sync that |
640 // are not installed (e.g. default / OEM apps). | 638 // are not installed (e.g. default / OEM apps). |
641 return; | 639 return; |
642 } | 640 } |
643 case sync_pb::AppListSpecifics::TYPE_REMOVE_DEFAULT_APP: { | 641 case sync_pb::AppListSpecifics::TYPE_REMOVE_DEFAULT_APP: { |
644 DVLOG(1) << this << ": Uninstall: " << sync_item->ToString(); | 642 VLOG(1) << this << ": Uninstall: " << sync_item->ToString(); |
645 UninstallExtension(extension_system_->extension_service(), | 643 UninstallExtension(extension_system_->extension_service(), |
646 sync_item->item_id); | 644 sync_item->item_id); |
647 return; | 645 return; |
648 } | 646 } |
649 case sync_pb::AppListSpecifics::TYPE_FOLDER: { | 647 case sync_pb::AppListSpecifics::TYPE_FOLDER: { |
650 AppListItem* app_item = model_->FindItem(sync_item->item_id); | 648 AppListItem* app_item = model_->FindItem(sync_item->item_id); |
651 if (!app_item) | 649 if (!app_item) |
652 return; // Don't create new folders here, the model will do that. | 650 return; // Don't create new folders here, the model will do that. |
653 UpdateAppItemFromSyncItem(sync_item, app_item); | 651 UpdateAppItemFromSyncItem(sync_item, app_item); |
654 return; | 652 return; |
655 } | 653 } |
656 case sync_pb::AppListSpecifics::TYPE_URL: { | 654 case sync_pb::AppListSpecifics::TYPE_URL: { |
657 // TODO(stevenjb): Implement | 655 // TODO(stevenjb): Implement |
658 LOG(WARNING) << "TYPE_URL not supported"; | 656 LOG(WARNING) << "TYPE_URL not supported"; |
659 return; | 657 return; |
660 } | 658 } |
661 } | 659 } |
662 NOTREACHED() << "Unrecognized sync item type: " << sync_item->ToString(); | 660 NOTREACHED() << "Unrecognized sync item type: " << sync_item->ToString(); |
663 } | 661 } |
664 | 662 |
665 void AppListSyncableService::ProcessExistingSyncItem(SyncItem* sync_item) { | 663 void AppListSyncableService::ProcessExistingSyncItem(SyncItem* sync_item) { |
666 if (sync_item->item_type == | 664 if (sync_item->item_type == |
667 sync_pb::AppListSpecifics::TYPE_REMOVE_DEFAULT_APP) { | 665 sync_pb::AppListSpecifics::TYPE_REMOVE_DEFAULT_APP) { |
668 return; | 666 return; |
669 } | 667 } |
670 DVLOG(2) << "ProcessExistingSyncItem: " << sync_item->ToString(); | 668 VLOG(2) << "ProcessExistingSyncItem: " << sync_item->ToString(); |
671 AppListItem* app_item = model_->FindItem(sync_item->item_id); | 669 AppListItem* app_item = model_->FindItem(sync_item->item_id); |
672 DVLOG(2) << " AppItem: " << app_item->ToDebugString(); | 670 DVLOG(2) << " AppItem: " << app_item->ToDebugString(); |
673 if (!app_item) { | 671 if (!app_item) { |
674 LOG(ERROR) << "Item not found in model: " << sync_item->ToString(); | 672 LOG(ERROR) << "Item not found in model: " << sync_item->ToString(); |
675 return; | 673 return; |
676 } | 674 } |
677 // This is the only place where sync can cause an item to change folders. | 675 // This is the only place where sync can cause an item to change folders. |
678 if (app_list::switches::IsFolderUIEnabled() && | 676 if (app_list::switches::IsFolderUIEnabled() && |
679 app_item->folder_id() != sync_item->parent_id && | 677 app_item->folder_id() != sync_item->parent_id && |
680 !AppIsOem(app_item->id())) { | 678 !AppIsOem(app_item->id())) { |
(...skipping 14 matching lines...) Expand all Loading... |
695 (app_item->GetItemType() == AppListFolderItem::kItemType || | 693 (app_item->GetItemType() == AppListFolderItem::kItemType || |
696 app_item->name().empty())) { | 694 app_item->name().empty())) { |
697 model_->SetItemName(app_item, sync_item->item_name); | 695 model_->SetItemName(app_item, sync_item->item_name); |
698 } | 696 } |
699 } | 697 } |
700 | 698 |
701 bool AppListSyncableService::SyncStarted() { | 699 bool AppListSyncableService::SyncStarted() { |
702 if (sync_processor_.get()) | 700 if (sync_processor_.get()) |
703 return true; | 701 return true; |
704 if (flare_.is_null()) { | 702 if (flare_.is_null()) { |
705 DVLOG(2) << this << ": SyncStarted: Flare."; | 703 VLOG(1) << this << ": SyncStarted: Flare."; |
706 flare_ = sync_start_util::GetFlareForSyncableService(profile_->GetPath()); | 704 flare_ = sync_start_util::GetFlareForSyncableService(profile_->GetPath()); |
707 flare_.Run(syncer::APP_LIST); | 705 flare_.Run(syncer::APP_LIST); |
708 } | 706 } |
709 return false; | 707 return false; |
710 } | 708 } |
711 | 709 |
712 void AppListSyncableService::SendSyncChange( | 710 void AppListSyncableService::SendSyncChange( |
713 SyncItem* sync_item, | 711 SyncItem* sync_item, |
714 SyncChange::SyncChangeType sync_change_type) { | 712 SyncChange::SyncChangeType sync_change_type) { |
715 if (!SyncStarted()) { | 713 if (!SyncStarted()) { |
(...skipping 29 matching lines...) Expand all Loading... |
745 return sync_item; | 743 return sync_item; |
746 } | 744 } |
747 | 745 |
748 void AppListSyncableService::DeleteSyncItemSpecifics( | 746 void AppListSyncableService::DeleteSyncItemSpecifics( |
749 const sync_pb::AppListSpecifics& specifics) { | 747 const sync_pb::AppListSpecifics& specifics) { |
750 const std::string& item_id = specifics.item_id(); | 748 const std::string& item_id = specifics.item_id(); |
751 if (item_id.empty()) { | 749 if (item_id.empty()) { |
752 LOG(ERROR) << "Delete AppList item with empty ID"; | 750 LOG(ERROR) << "Delete AppList item with empty ID"; |
753 return; | 751 return; |
754 } | 752 } |
755 DVLOG(2) << this << ": DeleteSyncItemSpecifics: " << item_id.substr(0, 8); | 753 VLOG(2) << this << ": DeleteSyncItemSpecifics: " << item_id.substr(0, 8); |
756 SyncItemMap::iterator iter = sync_items_.find(item_id); | 754 SyncItemMap::iterator iter = sync_items_.find(item_id); |
757 if (iter == sync_items_.end()) | 755 if (iter == sync_items_.end()) |
758 return; | 756 return; |
759 sync_pb::AppListSpecifics::AppListItemType item_type = | 757 sync_pb::AppListSpecifics::AppListItemType item_type = |
760 iter->second->item_type; | 758 iter->second->item_type; |
761 DVLOG(2) << this << " <- SYNC DELETE: " << iter->second->ToString(); | 759 DVLOG(2) << this << " <- SYNC DELETE: " << iter->second->ToString(); |
762 delete iter->second; | 760 delete iter->second; |
763 sync_items_.erase(iter); | 761 sync_items_.erase(iter); |
764 // Only delete apps from the model. Folders will be deleted when all | 762 // Only delete apps from the model. Folders will be deleted when all |
765 // children have been deleted. | 763 // children have been deleted. |
(...skipping 28 matching lines...) Expand all Loading... |
794 } else { | 792 } else { |
795 res += " { " + item_name + " }"; | 793 res += " { " + item_name + " }"; |
796 res += " [" + item_ordinal.ToDebugString() + "]"; | 794 res += " [" + item_ordinal.ToDebugString() + "]"; |
797 if (!parent_id.empty()) | 795 if (!parent_id.empty()) |
798 res += " <" + parent_id.substr(0, 8) + ">"; | 796 res += " <" + parent_id.substr(0, 8) + ">"; |
799 } | 797 } |
800 return res; | 798 return res; |
801 } | 799 } |
802 | 800 |
803 } // namespace app_list | 801 } // namespace app_list |
OLD | NEW |