OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #include "chrome/browser/sync/glue/sync_backend_host.h" | 7 #include "chrome/browser/sync/glue/sync_backend_host.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <map> | 10 #include <map> |
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 | 677 |
678 if (sync_disabled) | 678 if (sync_disabled) |
679 DeleteSyncDataFolder(); | 679 DeleteSyncDataFolder(); |
680 | 680 |
681 sync_loop_ = NULL; | 681 sync_loop_ = NULL; |
682 | 682 |
683 host_ = NULL; | 683 host_ = NULL; |
684 } | 684 } |
685 | 685 |
686 void SyncBackendHost::Core::DoRequestConfig( | 686 void SyncBackendHost::Core::DoRequestConfig( |
687 const syncable::ModelTypeBitSet& types_to_config, | 687 syncable::ModelEnumSet types_to_config, |
688 sync_api::ConfigureReason reason) { | 688 sync_api::ConfigureReason reason) { |
689 DCHECK_EQ(MessageLoop::current(), sync_loop_); | 689 DCHECK_EQ(MessageLoop::current(), sync_loop_); |
690 sync_manager_->RequestConfig(types_to_config, reason); | 690 sync_manager_->RequestConfig(types_to_config, reason); |
691 } | 691 } |
692 | 692 |
693 void SyncBackendHost::Core::DoStartConfiguration( | 693 void SyncBackendHost::Core::DoStartConfiguration( |
694 const base::Closure& callback) { | 694 const base::Closure& callback) { |
695 DCHECK_EQ(MessageLoop::current(), sync_loop_); | 695 DCHECK_EQ(MessageLoop::current(), sync_loop_); |
696 sync_manager_->StartConfigurationMode(callback); | 696 sync_manager_->StartConfigurationMode(callback); |
697 } | 697 } |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1004 // the initial sync is ended), in case we could not decrypt the data. | 1004 // the initial sync is ended), in case we could not decrypt the data. |
1005 if (pending_config_mode_state_->added_types.empty()) { | 1005 if (pending_config_mode_state_->added_types.empty()) { |
1006 SVLOG(1) << "No new types added; calling ready_task directly"; | 1006 SVLOG(1) << "No new types added; calling ready_task directly"; |
1007 // No new types - just notify the caller that the types are available. | 1007 // No new types - just notify the caller that the types are available. |
1008 const syncable::ModelEnumSet failed_configuration_types; | 1008 const syncable::ModelEnumSet failed_configuration_types; |
1009 pending_config_mode_state_->ready_task.Run(failed_configuration_types); | 1009 pending_config_mode_state_->ready_task.Run(failed_configuration_types); |
1010 } else { | 1010 } else { |
1011 pending_download_state_.reset(pending_config_mode_state_.release()); | 1011 pending_download_state_.reset(pending_config_mode_state_.release()); |
1012 | 1012 |
1013 // Always configure nigori if it's enabled. | 1013 // Always configure nigori if it's enabled. |
1014 syncable::ModelTypeSet types_to_config = | 1014 syncable::ModelEnumSet types_to_config = |
1015 pending_download_state_->added_types; | 1015 syncable::ModelTypeSetToEnumSet( |
| 1016 pending_download_state_->added_types); |
1016 if (IsNigoriEnabled()) { | 1017 if (IsNigoriEnabled()) { |
1017 // Note: Nigori is the only type that gets added with a nonempty | 1018 // Note: Nigori is the only type that gets added with a nonempty |
1018 // progress marker during config. If the server returns a migration | 1019 // progress marker during config. If the server returns a migration |
1019 // error then we will go into unrecoverable error. We dont handle it | 1020 // error then we will go into unrecoverable error. We dont handle it |
1020 // explicitly because server might help us out here by not sending a | 1021 // explicitly because server might help us out here by not sending a |
1021 // migraiton error for nigori during config. | 1022 // migraiton error for nigori during config. |
1022 types_to_config.insert(syncable::NIGORI); | 1023 types_to_config.Put(syncable::NIGORI); |
1023 } | 1024 } |
1024 SVLOG(1) << "Types " << ModelTypeSetToString(types_to_config) | 1025 SVLOG(1) << "Types " |
| 1026 << syncable::ModelEnumSetToString(types_to_config) |
1025 << " added; calling DoRequestConfig"; | 1027 << " added; calling DoRequestConfig"; |
1026 sync_thread_.message_loop()->PostTask(FROM_HERE, | 1028 sync_thread_.message_loop()->PostTask(FROM_HERE, |
1027 base::Bind(&SyncBackendHost::Core::DoRequestConfig, | 1029 base::Bind(&SyncBackendHost::Core::DoRequestConfig, |
1028 core_.get(), | 1030 core_.get(), |
1029 syncable::ModelTypeBitSetFromSet(types_to_config), | 1031 types_to_config, |
1030 pending_download_state_->reason)); | 1032 pending_download_state_->reason)); |
1031 } | 1033 } |
1032 | 1034 |
1033 pending_config_mode_state_.reset(); | 1035 pending_config_mode_state_.reset(); |
1034 | 1036 |
1035 // Notify the SyncManager about the new types. | 1037 // Notify the SyncManager about the new types. |
1036 sync_thread_.message_loop()->PostTask(FROM_HERE, | 1038 sync_thread_.message_loop()->PostTask(FROM_HERE, |
1037 base::Bind(&SyncBackendHost::Core::DoUpdateEnabledTypes, core_.get())); | 1039 base::Bind(&SyncBackendHost::Core::DoUpdateEnabledTypes, core_.get())); |
1038 } | 1040 } |
1039 | 1041 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1075 FROM_HERE, | 1077 FROM_HERE, |
1076 base::Bind(&SyncBackendHost::Core::DoRefreshEncryption, | 1078 base::Bind(&SyncBackendHost::Core::DoRefreshEncryption, |
1077 core_.get(), sync_thread_done_callback)); | 1079 core_.get(), sync_thread_done_callback)); |
1078 } | 1080 } |
1079 | 1081 |
1080 #undef SVLOG | 1082 #undef SVLOG |
1081 | 1083 |
1082 #undef SLOG | 1084 #undef SLOG |
1083 | 1085 |
1084 } // namespace browser_sync | 1086 } // namespace browser_sync |
OLD | NEW |