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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 syncer::ModelType type, | 476 syncer::ModelType type, |
477 const syncer::SyncDataList& initial_sync_data, | 477 const syncer::SyncDataList& initial_sync_data, |
478 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, | 478 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, |
479 scoped_ptr<syncer::SyncErrorFactory> error_handler) { | 479 scoped_ptr<syncer::SyncErrorFactory> error_handler) { |
480 DCHECK(!sync_processor_.get()); | 480 DCHECK(!sync_processor_.get()); |
481 DCHECK(sync_processor.get()); | 481 DCHECK(sync_processor.get()); |
482 DCHECK(error_handler.get()); | 482 DCHECK(error_handler.get()); |
483 | 483 |
484 sync_processor_ = sync_processor.Pass(); | 484 sync_processor_ = sync_processor.Pass(); |
485 sync_error_handler_ = error_handler.Pass(); | 485 sync_error_handler_ = error_handler.Pass(); |
| 486 if (switches::IsFolderUIEnabled()) |
| 487 model_->SetFoldersEnabled(true); |
486 | 488 |
487 syncer::SyncMergeResult result = syncer::SyncMergeResult(type); | 489 syncer::SyncMergeResult result = syncer::SyncMergeResult(type); |
488 result.set_num_items_before_association(sync_items_.size()); | 490 result.set_num_items_before_association(sync_items_.size()); |
489 VLOG(1) << this << ": MergeDataAndStartSyncing: " | 491 VLOG(1) << this << ": MergeDataAndStartSyncing: " |
490 << initial_sync_data.size(); | 492 << initial_sync_data.size(); |
491 | 493 |
492 // Copy all sync items to |unsynced_items|. | 494 // Copy all sync items to |unsynced_items|. |
493 std::set<std::string> unsynced_items; | 495 std::set<std::string> unsynced_items; |
494 for (SyncItemMap::const_iterator iter = sync_items_.begin(); | 496 for (SyncItemMap::const_iterator iter = sync_items_.begin(); |
495 iter != sync_items_.end(); ++iter) { | 497 iter != sync_items_.end(); ++iter) { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 model_observer_.reset(new ModelObserver(this)); | 543 model_observer_.reset(new ModelObserver(this)); |
542 | 544 |
543 return result; | 545 return result; |
544 } | 546 } |
545 | 547 |
546 void AppListSyncableService::StopSyncing(syncer::ModelType type) { | 548 void AppListSyncableService::StopSyncing(syncer::ModelType type) { |
547 DCHECK_EQ(type, syncer::APP_LIST); | 549 DCHECK_EQ(type, syncer::APP_LIST); |
548 | 550 |
549 sync_processor_.reset(); | 551 sync_processor_.reset(); |
550 sync_error_handler_.reset(); | 552 sync_error_handler_.reset(); |
| 553 model_->SetFoldersEnabled(false); |
551 } | 554 } |
552 | 555 |
553 syncer::SyncDataList AppListSyncableService::GetAllSyncData( | 556 syncer::SyncDataList AppListSyncableService::GetAllSyncData( |
554 syncer::ModelType type) const { | 557 syncer::ModelType type) const { |
555 DCHECK_EQ(syncer::APP_LIST, type); | 558 DCHECK_EQ(syncer::APP_LIST, type); |
556 | 559 |
557 VLOG(1) << this << ": GetAllSyncData: " << sync_items_.size(); | 560 VLOG(1) << this << ": GetAllSyncData: " << sync_items_.size(); |
558 syncer::SyncDataList list; | 561 syncer::SyncDataList list; |
559 for (SyncItemMap::const_iterator iter = sync_items_.begin(); | 562 for (SyncItemMap::const_iterator iter = sync_items_.begin(); |
560 iter != sync_items_.end(); ++iter) { | 563 iter != sync_items_.end(); ++iter) { |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
805 } else { | 808 } else { |
806 res += " { " + item_name + " }"; | 809 res += " { " + item_name + " }"; |
807 res += " [" + item_ordinal.ToDebugString() + "]"; | 810 res += " [" + item_ordinal.ToDebugString() + "]"; |
808 if (!parent_id.empty()) | 811 if (!parent_id.empty()) |
809 res += " <" + parent_id.substr(0, 8) + ">"; | 812 res += " <" + parent_id.substr(0, 8) + ">"; |
810 } | 813 } |
811 return res; | 814 return res; |
812 } | 815 } |
813 | 816 |
814 } // namespace app_list | 817 } // namespace app_list |
OLD | NEW |