| 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/sync/glue/sync_backend_host.h" | 5 #include "chrome/browser/sync/glue/sync_backend_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 syncer::ModelTypeSet previous_types = registrar_->GetLastConfiguredTypes(); | 630 syncer::ModelTypeSet previous_types = registrar_->GetLastConfiguredTypes(); |
| 631 | 631 |
| 632 syncer::ModelTypeSet disabled_types = | 632 syncer::ModelTypeSet disabled_types = |
| 633 GetDataTypesInState(DISABLED, config_state_map); | 633 GetDataTypesInState(DISABLED, config_state_map); |
| 634 syncer::ModelTypeSet fatal_types = | 634 syncer::ModelTypeSet fatal_types = |
| 635 GetDataTypesInState(FATAL, config_state_map); | 635 GetDataTypesInState(FATAL, config_state_map); |
| 636 syncer::ModelTypeSet crypto_types = | 636 syncer::ModelTypeSet crypto_types = |
| 637 GetDataTypesInState(CRYPTO, config_state_map); | 637 GetDataTypesInState(CRYPTO, config_state_map); |
| 638 disabled_types.PutAll(fatal_types); | 638 disabled_types.PutAll(fatal_types); |
| 639 disabled_types.PutAll(crypto_types); | 639 disabled_types.PutAll(crypto_types); |
| 640 syncer::ModelTypeSet active_types = |
| 641 GetDataTypesInState(CONFIGURE_ACTIVE, config_state_map); |
| 642 syncer::ModelTypeSet clean_first_types = |
| 643 GetDataTypesInState(CONFIGURE_CLEAN, config_state_map); |
| 640 syncer::ModelTypeSet types_to_download = registrar_->ConfigureDataTypes( | 644 syncer::ModelTypeSet types_to_download = registrar_->ConfigureDataTypes( |
| 641 GetDataTypesInState(CONFIGURE_ACTIVE, config_state_map), | 645 syncer::Union(active_types, clean_first_types), |
| 642 disabled_types); | 646 disabled_types); |
| 647 types_to_download.PutAll(clean_first_types); |
| 643 types_to_download.RemoveAll(syncer::ProxyTypes()); | 648 types_to_download.RemoveAll(syncer::ProxyTypes()); |
| 644 if (!types_to_download.Empty()) | 649 if (!types_to_download.Empty()) |
| 645 types_to_download.Put(syncer::NIGORI); | 650 types_to_download.Put(syncer::NIGORI); |
| 646 | 651 |
| 647 // TODO(sync): crbug.com/137550. | 652 // TODO(sync): crbug.com/137550. |
| 648 // It's dangerous to configure types that have progress markers. Types with | 653 // It's dangerous to configure types that have progress markers. Types with |
| 649 // progress markers can trigger a MIGRATION_DONE response. We are not | 654 // progress markers can trigger a MIGRATION_DONE response. We are not |
| 650 // prepared to handle a migration during a configure, so we must ensure that | 655 // prepared to handle a migration during a configure, so we must ensure that |
| 651 // all our types_to_download actually contain no data before we sync them. | 656 // all our types_to_download actually contain no data before we sync them. |
| 652 // | 657 // |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 // - Types which have encountered a cryptographer error (crypto_types) are | 697 // - Types which have encountered a cryptographer error (crypto_types) are |
| 693 // unapplied (local state is purged but sync state is not). | 698 // unapplied (local state is purged but sync state is not). |
| 694 // - All other types not in the routing info (types just disabled) are deleted | 699 // - All other types not in the routing info (types just disabled) are deleted |
| 695 // from the directory. | 700 // from the directory. |
| 696 // - Everything else (enabled types and already disabled types) is not | 701 // - Everything else (enabled types and already disabled types) is not |
| 697 // touched. | 702 // touched. |
| 698 RequestConfigureSyncer(reason, | 703 RequestConfigureSyncer(reason, |
| 699 types_to_download, | 704 types_to_download, |
| 700 types_to_purge, | 705 types_to_purge, |
| 701 fatal_types, | 706 fatal_types, |
| 702 crypto_types, | 707 syncer::Union(crypto_types, clean_first_types), |
| 703 inactive_types, | 708 inactive_types, |
| 704 routing_info, | 709 routing_info, |
| 705 ready_task, | 710 ready_task, |
| 706 retry_callback); | 711 retry_callback); |
| 707 } | 712 } |
| 708 | 713 |
| 709 void SyncBackendHost::EnableEncryptEverything() { | 714 void SyncBackendHost::EnableEncryptEverything() { |
| 710 sync_thread_.message_loop()->PostTask(FROM_HERE, | 715 sync_thread_.message_loop()->PostTask(FROM_HERE, |
| 711 base::Bind(&SyncBackendHost::Core::DoEnableEncryptEverything, | 716 base::Bind(&SyncBackendHost::Core::DoEnableEncryptEverything, |
| 712 core_.get())); | 717 core_.get())); |
| (...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1618 DVLOG(1) << "Connection status changed: " | 1623 DVLOG(1) << "Connection status changed: " |
| 1619 << syncer::ConnectionStatusToString(status); | 1624 << syncer::ConnectionStatusToString(status); |
| 1620 frontend_->OnConnectionStatusChange(status); | 1625 frontend_->OnConnectionStatusChange(status); |
| 1621 } | 1626 } |
| 1622 | 1627 |
| 1623 #undef SDVLOG | 1628 #undef SDVLOG |
| 1624 | 1629 |
| 1625 #undef SLOG | 1630 #undef SLOG |
| 1626 | 1631 |
| 1627 } // namespace browser_sync | 1632 } // namespace browser_sync |
| OLD | NEW |