| 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 "sync/internal_api/public/sync_manager.h" | 5 #include "sync/internal_api/public/sync_manager.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 #include "sync/syncable/directory.h" | 55 #include "sync/syncable/directory.h" |
| 56 #include "sync/syncable/directory_change_delegate.h" | 56 #include "sync/syncable/directory_change_delegate.h" |
| 57 #include "sync/syncable/entry.h" | 57 #include "sync/syncable/entry.h" |
| 58 #include "sync/syncable/in_memory_directory_backing_store.h" | 58 #include "sync/syncable/in_memory_directory_backing_store.h" |
| 59 #include "sync/syncable/on_disk_directory_backing_store.h" | 59 #include "sync/syncable/on_disk_directory_backing_store.h" |
| 60 #include "sync/util/cryptographer.h" | 60 #include "sync/util/cryptographer.h" |
| 61 #include "sync/util/get_session_name.h" | 61 #include "sync/util/get_session_name.h" |
| 62 #include "sync/util/time.h" | 62 #include "sync/util/time.h" |
| 63 | 63 |
| 64 using base::TimeDelta; | 64 using base::TimeDelta; |
| 65 using csync::AllStatus; | 65 using syncer::AllStatus; |
| 66 using csync::Cryptographer; | 66 using syncer::Cryptographer; |
| 67 using csync::Encryptor; | 67 using syncer::Encryptor; |
| 68 using csync::JsArgList; | 68 using syncer::JsArgList; |
| 69 using csync::JsBackend; | 69 using syncer::JsBackend; |
| 70 using csync::JsEventDetails; | 70 using syncer::JsEventDetails; |
| 71 using csync::JsEventHandler; | 71 using syncer::JsEventHandler; |
| 72 using csync::JsEventHandler; | 72 using syncer::JsEventHandler; |
| 73 using csync::JsReplyHandler; | 73 using syncer::JsReplyHandler; |
| 74 using csync::JsMutationEventObserver; | 74 using syncer::JsMutationEventObserver; |
| 75 using csync::JsSyncManagerObserver; | 75 using syncer::JsSyncManagerObserver; |
| 76 using csync::kNigoriTag; | 76 using syncer::kNigoriTag; |
| 77 using csync::KeyParams; | 77 using syncer::KeyParams; |
| 78 using csync::ModelSafeRoutingInfo; | 78 using syncer::ModelSafeRoutingInfo; |
| 79 using csync::ReportUnrecoverableErrorFunction; | 79 using syncer::ReportUnrecoverableErrorFunction; |
| 80 using csync::ServerConnectionEvent; | 80 using syncer::ServerConnectionEvent; |
| 81 using csync::ServerConnectionEventListener; | 81 using syncer::ServerConnectionEventListener; |
| 82 using csync::SyncEngineEvent; | 82 using syncer::SyncEngineEvent; |
| 83 using csync::SyncEngineEventListener; | 83 using syncer::SyncEngineEventListener; |
| 84 using csync::SyncScheduler; | 84 using syncer::SyncScheduler; |
| 85 using csync::Syncer; | 85 using syncer::Syncer; |
| 86 using csync::UnrecoverableErrorHandler; | 86 using syncer::UnrecoverableErrorHandler; |
| 87 using csync::WeakHandle; | 87 using syncer::WeakHandle; |
| 88 using csync::sessions::SyncSessionContext; | 88 using syncer::sessions::SyncSessionContext; |
| 89 using syncable::ImmutableWriteTransactionInfo; | 89 using syncable::ImmutableWriteTransactionInfo; |
| 90 using syncable::ModelType; | 90 using syncable::ModelType; |
| 91 using syncable::ModelTypeSet; | 91 using syncable::ModelTypeSet; |
| 92 using syncable::SPECIFICS; | 92 using syncable::SPECIFICS; |
| 93 using sync_pb::GetUpdatesCallerInfo; | 93 using sync_pb::GetUpdatesCallerInfo; |
| 94 | 94 |
| 95 namespace { | 95 namespace { |
| 96 | 96 |
| 97 // Delays for syncer nudges. | 97 // Delays for syncer nudges. |
| 98 static const int kSyncRefreshDelayMsec = 500; | 98 static const int kSyncRefreshDelayMsec = 500; |
| 99 static const int kSyncSchedulerDelayMsec = 250; | 99 static const int kSyncSchedulerDelayMsec = 250; |
| 100 | 100 |
| 101 GetUpdatesCallerInfo::GetUpdatesSource GetSourceFromReason( | 101 GetUpdatesCallerInfo::GetUpdatesSource GetSourceFromReason( |
| 102 csync::ConfigureReason reason) { | 102 syncer::ConfigureReason reason) { |
| 103 switch (reason) { | 103 switch (reason) { |
| 104 case csync::CONFIGURE_REASON_RECONFIGURATION: | 104 case syncer::CONFIGURE_REASON_RECONFIGURATION: |
| 105 return GetUpdatesCallerInfo::RECONFIGURATION; | 105 return GetUpdatesCallerInfo::RECONFIGURATION; |
| 106 case csync::CONFIGURE_REASON_MIGRATION: | 106 case syncer::CONFIGURE_REASON_MIGRATION: |
| 107 return GetUpdatesCallerInfo::MIGRATION; | 107 return GetUpdatesCallerInfo::MIGRATION; |
| 108 case csync::CONFIGURE_REASON_NEW_CLIENT: | 108 case syncer::CONFIGURE_REASON_NEW_CLIENT: |
| 109 return GetUpdatesCallerInfo::NEW_CLIENT; | 109 return GetUpdatesCallerInfo::NEW_CLIENT; |
| 110 case csync::CONFIGURE_REASON_NEWLY_ENABLED_DATA_TYPE: | 110 case syncer::CONFIGURE_REASON_NEWLY_ENABLED_DATA_TYPE: |
| 111 return GetUpdatesCallerInfo::NEWLY_SUPPORTED_DATATYPE; | 111 return GetUpdatesCallerInfo::NEWLY_SUPPORTED_DATATYPE; |
| 112 default: | 112 default: |
| 113 NOTREACHED(); | 113 NOTREACHED(); |
| 114 } | 114 } |
| 115 | 115 |
| 116 return GetUpdatesCallerInfo::UNKNOWN; | 116 return GetUpdatesCallerInfo::UNKNOWN; |
| 117 } | 117 } |
| 118 | 118 |
| 119 // The maximum number of times we will automatically overwrite the nigori node | 119 // The maximum number of times we will automatically overwrite the nigori node |
| 120 // because the encryption keys don't match (per chrome instantiation). | 120 // because the encryption keys don't match (per chrome instantiation). |
| 121 static const int kNigoriOverwriteLimit = 10; | 121 static const int kNigoriOverwriteLimit = 10; |
| 122 | 122 |
| 123 } // namespace | 123 } // namespace |
| 124 | 124 |
| 125 namespace csync { | 125 namespace syncer { |
| 126 | 126 |
| 127 const int SyncManager::kDefaultNudgeDelayMilliseconds = 200; | 127 const int SyncManager::kDefaultNudgeDelayMilliseconds = 200; |
| 128 const int SyncManager::kPreferencesNudgeDelayMilliseconds = 2000; | 128 const int SyncManager::kPreferencesNudgeDelayMilliseconds = 2000; |
| 129 | 129 |
| 130 // Maximum count and size for traffic recorder. | 130 // Maximum count and size for traffic recorder. |
| 131 const unsigned int kMaxMessagesToRecord = 10; | 131 const unsigned int kMaxMessagesToRecord = 10; |
| 132 const unsigned int kMaxMessageSizeToRecord = 5 * 1024; | 132 const unsigned int kMaxMessageSizeToRecord = 5 * 1024; |
| 133 | 133 |
| 134 ////////////////////////////////////////////////////////////////////////// | 134 ////////////////////////////////////////////////////////////////////////// |
| 135 // SyncManager's implementation: SyncManager::SyncInternal | 135 // SyncManager's implementation: SyncManager::SyncInternal |
| 136 class SyncManager::SyncInternal | 136 class SyncManager::SyncInternal |
| 137 : public net::NetworkChangeNotifier::IPAddressObserver, | 137 : public net::NetworkChangeNotifier::IPAddressObserver, |
| 138 public csync::Cryptographer::Observer, | 138 public syncer::Cryptographer::Observer, |
| 139 public csync::SyncNotifierObserver, | 139 public syncer::SyncNotifierObserver, |
| 140 public JsBackend, | 140 public JsBackend, |
| 141 public SyncEngineEventListener, | 141 public SyncEngineEventListener, |
| 142 public ServerConnectionEventListener, | 142 public ServerConnectionEventListener, |
| 143 public syncable::DirectoryChangeDelegate { | 143 public syncable::DirectoryChangeDelegate { |
| 144 public: | 144 public: |
| 145 explicit SyncInternal(const std::string& name) | 145 explicit SyncInternal(const std::string& name) |
| 146 : name_(name), | 146 : name_(name), |
| 147 weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), | 147 weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), |
| 148 change_delegate_(NULL), | 148 change_delegate_(NULL), |
| 149 initialized_(false), | 149 initialized_(false), |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 CHECK(!initialized_); | 194 CHECK(!initialized_); |
| 195 } | 195 } |
| 196 | 196 |
| 197 bool Init(const FilePath& database_location, | 197 bool Init(const FilePath& database_location, |
| 198 const WeakHandle<JsEventHandler>& event_handler, | 198 const WeakHandle<JsEventHandler>& event_handler, |
| 199 const std::string& sync_server_and_path, | 199 const std::string& sync_server_and_path, |
| 200 int port, | 200 int port, |
| 201 bool use_ssl, | 201 bool use_ssl, |
| 202 const scoped_refptr<base::TaskRunner>& blocking_task_runner, | 202 const scoped_refptr<base::TaskRunner>& blocking_task_runner, |
| 203 HttpPostProviderFactory* post_factory, | 203 HttpPostProviderFactory* post_factory, |
| 204 const csync::ModelSafeRoutingInfo& model_safe_routing_info, | 204 const syncer::ModelSafeRoutingInfo& model_safe_routing_info, |
| 205 const std::vector<csync::ModelSafeWorker*>& workers, | 205 const std::vector<syncer::ModelSafeWorker*>& workers, |
| 206 csync::ExtensionsActivityMonitor* | 206 syncer::ExtensionsActivityMonitor* |
| 207 extensions_activity_monitor, | 207 extensions_activity_monitor, |
| 208 ChangeDelegate* change_delegate, | 208 ChangeDelegate* change_delegate, |
| 209 const SyncCredentials& credentials, | 209 const SyncCredentials& credentials, |
| 210 csync::SyncNotifier* sync_notifier, | 210 syncer::SyncNotifier* sync_notifier, |
| 211 const std::string& restored_key_for_bootstrapping, | 211 const std::string& restored_key_for_bootstrapping, |
| 212 TestingMode testing_mode, | 212 TestingMode testing_mode, |
| 213 Encryptor* encryptor, | 213 Encryptor* encryptor, |
| 214 UnrecoverableErrorHandler* unrecoverable_error_handler, | 214 UnrecoverableErrorHandler* unrecoverable_error_handler, |
| 215 ReportUnrecoverableErrorFunction | 215 ReportUnrecoverableErrorFunction |
| 216 report_unrecoverable_error_function); | 216 report_unrecoverable_error_function); |
| 217 | 217 |
| 218 // Sign into sync with given credentials. | 218 // Sign into sync with given credentials. |
| 219 // We do not verify the tokens given. After this call, the tokens are set | 219 // We do not verify the tokens given. After this call, the tokens are set |
| 220 // and the sync DB is open. True if successful, false if something | 220 // and the sync DB is open. True if successful, false if something |
| 221 // went wrong. | 221 // went wrong. |
| 222 bool SignIn(const SyncCredentials& credentials); | 222 bool SignIn(const SyncCredentials& credentials); |
| 223 | 223 |
| 224 // Update tokens that we're using in Sync. Email must stay the same. | 224 // Update tokens that we're using in Sync. Email must stay the same. |
| 225 void UpdateCredentials(const SyncCredentials& credentials); | 225 void UpdateCredentials(const SyncCredentials& credentials); |
| 226 | 226 |
| 227 // Called when the user disables or enables a sync type. | 227 // Called when the user disables or enables a sync type. |
| 228 void UpdateEnabledTypes(const ModelTypeSet& enabled_types); | 228 void UpdateEnabledTypes(const ModelTypeSet& enabled_types); |
| 229 | 229 |
| 230 // Tell the sync engine to start the syncing process. | 230 // Tell the sync engine to start the syncing process. |
| 231 void StartSyncingNormally( | 231 void StartSyncingNormally( |
| 232 const csync::ModelSafeRoutingInfo& routing_info); | 232 const syncer::ModelSafeRoutingInfo& routing_info); |
| 233 | 233 |
| 234 // Whether or not the Nigori node is encrypted using an explicit passphrase. | 234 // Whether or not the Nigori node is encrypted using an explicit passphrase. |
| 235 bool IsUsingExplicitPassphrase(); | 235 bool IsUsingExplicitPassphrase(); |
| 236 | 236 |
| 237 // Update the Cryptographer from the current nigori node and write back any | 237 // Update the Cryptographer from the current nigori node and write back any |
| 238 // necessary changes to the nigori node. We also detect missing encryption | 238 // necessary changes to the nigori node. We also detect missing encryption |
| 239 // keys and write them into the nigori node. | 239 // keys and write them into the nigori node. |
| 240 // Also updates or adds the device information into the nigori node. | 240 // Also updates or adds the device information into the nigori node. |
| 241 // Note: opens a transaction and can trigger an ON_PASSPHRASE_REQUIRED, so | 241 // Note: opens a transaction and can trigger an ON_PASSPHRASE_REQUIRED, so |
| 242 // should only be called after syncapi is fully initialized. | 242 // should only be called after syncapi is fully initialized. |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 bool OpenDirectory(); | 318 bool OpenDirectory(); |
| 319 | 319 |
| 320 // Cryptographer::Observer implementation. | 320 // Cryptographer::Observer implementation. |
| 321 virtual void OnEncryptedTypesChanged( | 321 virtual void OnEncryptedTypesChanged( |
| 322 syncable::ModelTypeSet encrypted_types, | 322 syncable::ModelTypeSet encrypted_types, |
| 323 bool encrypt_everything) OVERRIDE; | 323 bool encrypt_everything) OVERRIDE; |
| 324 | 324 |
| 325 // SyncNotifierObserver implementation. | 325 // SyncNotifierObserver implementation. |
| 326 virtual void OnNotificationsEnabled() OVERRIDE; | 326 virtual void OnNotificationsEnabled() OVERRIDE; |
| 327 virtual void OnNotificationsDisabled( | 327 virtual void OnNotificationsDisabled( |
| 328 csync::NotificationsDisabledReason reason) OVERRIDE; | 328 syncer::NotificationsDisabledReason reason) OVERRIDE; |
| 329 virtual void OnIncomingNotification( | 329 virtual void OnIncomingNotification( |
| 330 const syncable::ModelTypePayloadMap& type_payloads, | 330 const syncable::ModelTypePayloadMap& type_payloads, |
| 331 csync::IncomingNotificationSource source) OVERRIDE; | 331 syncer::IncomingNotificationSource source) OVERRIDE; |
| 332 | 332 |
| 333 void AddObserver(SyncManager::Observer* observer); | 333 void AddObserver(SyncManager::Observer* observer); |
| 334 void RemoveObserver(SyncManager::Observer* observer); | 334 void RemoveObserver(SyncManager::Observer* observer); |
| 335 | 335 |
| 336 // Accessors for the private members. | 336 // Accessors for the private members. |
| 337 syncable::Directory* directory() { return share_.directory.get(); } | 337 syncable::Directory* directory() { return share_.directory.get(); } |
| 338 SyncAPIServerConnectionManager* connection_manager() { | 338 SyncAPIServerConnectionManager* connection_manager() { |
| 339 return connection_manager_.get(); | 339 return connection_manager_.get(); |
| 340 } | 340 } |
| 341 SyncSessionContext* session_context() { return session_context_.get(); } | 341 SyncSessionContext* session_context() { return session_context_.get(); } |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 // |blocking_task_runner| is a TaskRunner to be used for tasks that | 546 // |blocking_task_runner| is a TaskRunner to be used for tasks that |
| 547 // may block on disk I/O. | 547 // may block on disk I/O. |
| 548 scoped_refptr<base::TaskRunner> blocking_task_runner_; | 548 scoped_refptr<base::TaskRunner> blocking_task_runner_; |
| 549 | 549 |
| 550 // We give a handle to share_ to clients of the API for use when constructing | 550 // We give a handle to share_ to clients of the API for use when constructing |
| 551 // any transaction type. | 551 // any transaction type. |
| 552 UserShare share_; | 552 UserShare share_; |
| 553 | 553 |
| 554 // This can be called from any thread, but only between calls to | 554 // This can be called from any thread, but only between calls to |
| 555 // OpenDirectory() and ShutdownOnSyncThread(). | 555 // OpenDirectory() and ShutdownOnSyncThread(). |
| 556 csync::WeakHandle<SyncManager::ChangeObserver> change_observer_; | 556 syncer::WeakHandle<SyncManager::ChangeObserver> change_observer_; |
| 557 | 557 |
| 558 ObserverList<SyncManager::Observer> observers_; | 558 ObserverList<SyncManager::Observer> observers_; |
| 559 | 559 |
| 560 // The ServerConnectionManager used to abstract communication between the | 560 // The ServerConnectionManager used to abstract communication between the |
| 561 // client (the Syncer) and the sync server. | 561 // client (the Syncer) and the sync server. |
| 562 scoped_ptr<SyncAPIServerConnectionManager> connection_manager_; | 562 scoped_ptr<SyncAPIServerConnectionManager> connection_manager_; |
| 563 | 563 |
| 564 // A container of various bits of information used by the SyncScheduler to | 564 // A container of various bits of information used by the SyncScheduler to |
| 565 // create SyncSessions. Must outlive the SyncScheduler. | 565 // create SyncSessions. Must outlive the SyncScheduler. |
| 566 scoped_ptr<SyncSessionContext> session_context_; | 566 scoped_ptr<SyncSessionContext> session_context_; |
| 567 | 567 |
| 568 // The scheduler that runs the Syncer. Needs to be explicitly | 568 // The scheduler that runs the Syncer. Needs to be explicitly |
| 569 // Start()ed. | 569 // Start()ed. |
| 570 scoped_ptr<SyncScheduler> scheduler_; | 570 scoped_ptr<SyncScheduler> scheduler_; |
| 571 | 571 |
| 572 // The SyncNotifier which notifies us when updates need to be downloaded. | 572 // The SyncNotifier which notifies us when updates need to be downloaded. |
| 573 scoped_ptr<csync::SyncNotifier> sync_notifier_; | 573 scoped_ptr<syncer::SyncNotifier> sync_notifier_; |
| 574 | 574 |
| 575 // A multi-purpose status watch object that aggregates stats from various | 575 // A multi-purpose status watch object that aggregates stats from various |
| 576 // sync components. | 576 // sync components. |
| 577 AllStatus allstatus_; | 577 AllStatus allstatus_; |
| 578 | 578 |
| 579 // Each element of this array is a store of change records produced by | 579 // Each element of this array is a store of change records produced by |
| 580 // HandleChangeEvent during the CALCULATE_CHANGES step. The changes are | 580 // HandleChangeEvent during the CALCULATE_CHANGES step. The changes are |
| 581 // segregated by model type, and are stored here to be processed and | 581 // segregated by model type, and are stored here to be processed and |
| 582 // forwarded to the observer slightly later, at the TRANSACTION_ENDING | 582 // forwarded to the observer slightly later, at the TRANSACTION_ENDING |
| 583 // step by HandleTransactionEndingChangeEvent. The list is cleared in the | 583 // step by HandleTransactionEndingChangeEvent. The list is cleared in the |
| (...skipping 16 matching lines...) Expand all Loading... |
| 600 // Map used to store the notification info to be displayed in | 600 // Map used to store the notification info to be displayed in |
| 601 // about:sync page. | 601 // about:sync page. |
| 602 NotificationInfoMap notification_info_map_; | 602 NotificationInfoMap notification_info_map_; |
| 603 | 603 |
| 604 // These are for interacting with chrome://sync-internals. | 604 // These are for interacting with chrome://sync-internals. |
| 605 JsMessageHandlerMap js_message_handlers_; | 605 JsMessageHandlerMap js_message_handlers_; |
| 606 WeakHandle<JsEventHandler> js_event_handler_; | 606 WeakHandle<JsEventHandler> js_event_handler_; |
| 607 JsSyncManagerObserver js_sync_manager_observer_; | 607 JsSyncManagerObserver js_sync_manager_observer_; |
| 608 JsMutationEventObserver js_mutation_event_observer_; | 608 JsMutationEventObserver js_mutation_event_observer_; |
| 609 | 609 |
| 610 csync::ThrottledDataTypeTracker throttled_data_type_tracker_; | 610 syncer::ThrottledDataTypeTracker throttled_data_type_tracker_; |
| 611 | 611 |
| 612 // This is for keeping track of client events to send to the server. | 612 // This is for keeping track of client events to send to the server. |
| 613 DebugInfoEventListener debug_info_event_listener_; | 613 DebugInfoEventListener debug_info_event_listener_; |
| 614 | 614 |
| 615 csync::TrafficRecorder traffic_recorder_; | 615 syncer::TrafficRecorder traffic_recorder_; |
| 616 | 616 |
| 617 Encryptor* encryptor_; | 617 Encryptor* encryptor_; |
| 618 UnrecoverableErrorHandler* unrecoverable_error_handler_; | 618 UnrecoverableErrorHandler* unrecoverable_error_handler_; |
| 619 ReportUnrecoverableErrorFunction report_unrecoverable_error_function_; | 619 ReportUnrecoverableErrorFunction report_unrecoverable_error_function_; |
| 620 | 620 |
| 621 MessageLoop* const created_on_loop_; | 621 MessageLoop* const created_on_loop_; |
| 622 | 622 |
| 623 // The number of times we've automatically (i.e. not via SetPassphrase or | 623 // The number of times we've automatically (i.e. not via SetPassphrase or |
| 624 // conflict resolver) updated the nigori's encryption keys in this chrome | 624 // conflict resolver) updated the nigori's encryption keys in this chrome |
| 625 // instantiation. | 625 // instantiation. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 CHECK(core); | 671 CHECK(core); |
| 672 TimeDelta delay = TimeDelta::FromMilliseconds( | 672 TimeDelta delay = TimeDelta::FromMilliseconds( |
| 673 SyncManager::kDefaultNudgeDelayMilliseconds); | 673 SyncManager::kDefaultNudgeDelayMilliseconds); |
| 674 switch (delay_type) { | 674 switch (delay_type) { |
| 675 case IMMEDIATE: | 675 case IMMEDIATE: |
| 676 delay = TimeDelta::FromMilliseconds( | 676 delay = TimeDelta::FromMilliseconds( |
| 677 SyncManager::kDefaultNudgeDelayMilliseconds); | 677 SyncManager::kDefaultNudgeDelayMilliseconds); |
| 678 break; | 678 break; |
| 679 case ACCOMPANY_ONLY: | 679 case ACCOMPANY_ONLY: |
| 680 delay = TimeDelta::FromSeconds( | 680 delay = TimeDelta::FromSeconds( |
| 681 csync::kDefaultShortPollIntervalSeconds); | 681 syncer::kDefaultShortPollIntervalSeconds); |
| 682 break; | 682 break; |
| 683 case CUSTOM: | 683 case CUSTOM: |
| 684 switch (model_type) { | 684 switch (model_type) { |
| 685 case syncable::PREFERENCES: | 685 case syncable::PREFERENCES: |
| 686 delay = TimeDelta::FromMilliseconds( | 686 delay = TimeDelta::FromMilliseconds( |
| 687 SyncManager::kPreferencesNudgeDelayMilliseconds); | 687 SyncManager::kPreferencesNudgeDelayMilliseconds); |
| 688 break; | 688 break; |
| 689 case syncable::SESSIONS: | 689 case syncable::SESSIONS: |
| 690 delay = core->scheduler()->sessions_commit_delay(); | 690 delay = core->scheduler()->sessions_commit_delay(); |
| 691 break; | 691 break; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 710 : data_(new SyncInternal(name)) {} | 710 : data_(new SyncInternal(name)) {} |
| 711 | 711 |
| 712 bool SyncManager::Init( | 712 bool SyncManager::Init( |
| 713 const FilePath& database_location, | 713 const FilePath& database_location, |
| 714 const WeakHandle<JsEventHandler>& event_handler, | 714 const WeakHandle<JsEventHandler>& event_handler, |
| 715 const std::string& sync_server_and_path, | 715 const std::string& sync_server_and_path, |
| 716 int sync_server_port, | 716 int sync_server_port, |
| 717 bool use_ssl, | 717 bool use_ssl, |
| 718 const scoped_refptr<base::TaskRunner>& blocking_task_runner, | 718 const scoped_refptr<base::TaskRunner>& blocking_task_runner, |
| 719 HttpPostProviderFactory* post_factory, | 719 HttpPostProviderFactory* post_factory, |
| 720 const csync::ModelSafeRoutingInfo& model_safe_routing_info, | 720 const syncer::ModelSafeRoutingInfo& model_safe_routing_info, |
| 721 const std::vector<csync::ModelSafeWorker*>& workers, | 721 const std::vector<syncer::ModelSafeWorker*>& workers, |
| 722 csync::ExtensionsActivityMonitor* extensions_activity_monitor, | 722 syncer::ExtensionsActivityMonitor* extensions_activity_monitor, |
| 723 ChangeDelegate* change_delegate, | 723 ChangeDelegate* change_delegate, |
| 724 const SyncCredentials& credentials, | 724 const SyncCredentials& credentials, |
| 725 csync::SyncNotifier* sync_notifier, | 725 syncer::SyncNotifier* sync_notifier, |
| 726 const std::string& restored_key_for_bootstrapping, | 726 const std::string& restored_key_for_bootstrapping, |
| 727 TestingMode testing_mode, | 727 TestingMode testing_mode, |
| 728 Encryptor* encryptor, | 728 Encryptor* encryptor, |
| 729 UnrecoverableErrorHandler* unrecoverable_error_handler, | 729 UnrecoverableErrorHandler* unrecoverable_error_handler, |
| 730 ReportUnrecoverableErrorFunction report_unrecoverable_error_function) { | 730 ReportUnrecoverableErrorFunction report_unrecoverable_error_function) { |
| 731 DCHECK(thread_checker_.CalledOnValidThread()); | 731 DCHECK(thread_checker_.CalledOnValidThread()); |
| 732 DCHECK(post_factory); | 732 DCHECK(post_factory); |
| 733 DVLOG(1) << "SyncManager starting Init..."; | 733 DVLOG(1) << "SyncManager starting Init..."; |
| 734 std::string server_string(sync_server_and_path); | 734 std::string server_string(sync_server_and_path); |
| 735 return data_->Init(database_location, | 735 return data_->Init(database_location, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 ReadTransaction trans(FROM_HERE, GetUserShare()); | 767 ReadTransaction trans(FROM_HERE, GetUserShare()); |
| 768 trans.GetWrappedTrans()->OnUnrecoverableError( | 768 trans.GetWrappedTrans()->OnUnrecoverableError( |
| 769 FROM_HERE, "Simulating unrecoverable error for testing purposes."); | 769 FROM_HERE, "Simulating unrecoverable error for testing purposes."); |
| 770 } | 770 } |
| 771 | 771 |
| 772 syncable::ModelTypeSet SyncManager::InitialSyncEndedTypes() { | 772 syncable::ModelTypeSet SyncManager::InitialSyncEndedTypes() { |
| 773 return data_->InitialSyncEndedTypes(); | 773 return data_->InitialSyncEndedTypes(); |
| 774 } | 774 } |
| 775 | 775 |
| 776 void SyncManager::StartSyncingNormally( | 776 void SyncManager::StartSyncingNormally( |
| 777 const csync::ModelSafeRoutingInfo& routing_info) { | 777 const syncer::ModelSafeRoutingInfo& routing_info) { |
| 778 DCHECK(thread_checker_.CalledOnValidThread()); | 778 DCHECK(thread_checker_.CalledOnValidThread()); |
| 779 data_->StartSyncingNormally(routing_info); | 779 data_->StartSyncingNormally(routing_info); |
| 780 } | 780 } |
| 781 | 781 |
| 782 void SyncManager::SetEncryptionPassphrase(const std::string& passphrase, | 782 void SyncManager::SetEncryptionPassphrase(const std::string& passphrase, |
| 783 bool is_explicit) { | 783 bool is_explicit) { |
| 784 DCHECK(thread_checker_.CalledOnValidThread()); | 784 DCHECK(thread_checker_.CalledOnValidThread()); |
| 785 data_->SetEncryptionPassphrase(passphrase, is_explicit); | 785 data_->SetEncryptionPassphrase(passphrase, is_explicit); |
| 786 } | 786 } |
| 787 | 787 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 811 bool SyncManager::EncryptEverythingEnabledForTest() const { | 811 bool SyncManager::EncryptEverythingEnabledForTest() const { |
| 812 ReadTransaction trans(FROM_HERE, GetUserShare()); | 812 ReadTransaction trans(FROM_HERE, GetUserShare()); |
| 813 return trans.GetCryptographer()->encrypt_everything(); | 813 return trans.GetCryptographer()->encrypt_everything(); |
| 814 } | 814 } |
| 815 | 815 |
| 816 bool SyncManager::IsUsingExplicitPassphrase() { | 816 bool SyncManager::IsUsingExplicitPassphrase() { |
| 817 return data_ && data_->IsUsingExplicitPassphrase(); | 817 return data_ && data_->IsUsingExplicitPassphrase(); |
| 818 } | 818 } |
| 819 | 819 |
| 820 void SyncManager::RequestCleanupDisabledTypes( | 820 void SyncManager::RequestCleanupDisabledTypes( |
| 821 const csync::ModelSafeRoutingInfo& routing_info) { | 821 const syncer::ModelSafeRoutingInfo& routing_info) { |
| 822 DCHECK(thread_checker_.CalledOnValidThread()); | 822 DCHECK(thread_checker_.CalledOnValidThread()); |
| 823 if (data_->scheduler()) { | 823 if (data_->scheduler()) { |
| 824 data_->session_context()->set_routing_info(routing_info); | 824 data_->session_context()->set_routing_info(routing_info); |
| 825 data_->scheduler()->CleanupDisabledTypes(); | 825 data_->scheduler()->CleanupDisabledTypes(); |
| 826 } | 826 } |
| 827 } | 827 } |
| 828 | 828 |
| 829 void SyncManager::RequestConfig( | 829 void SyncManager::RequestConfig( |
| 830 const csync::ModelSafeRoutingInfo& routing_info, | 830 const syncer::ModelSafeRoutingInfo& routing_info, |
| 831 const ModelTypeSet& types, ConfigureReason reason) { | 831 const ModelTypeSet& types, ConfigureReason reason) { |
| 832 DCHECK(thread_checker_.CalledOnValidThread()); | 832 DCHECK(thread_checker_.CalledOnValidThread()); |
| 833 if (!data_->scheduler()) { | 833 if (!data_->scheduler()) { |
| 834 LOG(INFO) | 834 LOG(INFO) |
| 835 << "SyncManager::RequestConfig: bailing out because scheduler is " | 835 << "SyncManager::RequestConfig: bailing out because scheduler is " |
| 836 << "null"; | 836 << "null"; |
| 837 return; | 837 return; |
| 838 } | 838 } |
| 839 StartConfigurationMode(base::Closure()); | 839 StartConfigurationMode(base::Closure()); |
| 840 data_->session_context()->set_routing_info(routing_info); | 840 data_->session_context()->set_routing_info(routing_info); |
| 841 data_->scheduler()->ScheduleConfiguration(types, GetSourceFromReason(reason)); | 841 data_->scheduler()->ScheduleConfiguration(types, GetSourceFromReason(reason)); |
| 842 } | 842 } |
| 843 | 843 |
| 844 void SyncManager::StartConfigurationMode(const base::Closure& callback) { | 844 void SyncManager::StartConfigurationMode(const base::Closure& callback) { |
| 845 DCHECK(thread_checker_.CalledOnValidThread()); | 845 DCHECK(thread_checker_.CalledOnValidThread()); |
| 846 if (!data_->scheduler()) { | 846 if (!data_->scheduler()) { |
| 847 LOG(INFO) | 847 LOG(INFO) |
| 848 << "SyncManager::StartConfigurationMode: could not start " | 848 << "SyncManager::StartConfigurationMode: could not start " |
| 849 << "configuration mode because because scheduler is null"; | 849 << "configuration mode because because scheduler is null"; |
| 850 return; | 850 return; |
| 851 } | 851 } |
| 852 data_->scheduler()->Start( | 852 data_->scheduler()->Start( |
| 853 csync::SyncScheduler::CONFIGURATION_MODE, callback); | 853 syncer::SyncScheduler::CONFIGURATION_MODE, callback); |
| 854 } | 854 } |
| 855 | 855 |
| 856 bool SyncManager::SyncInternal::Init( | 856 bool SyncManager::SyncInternal::Init( |
| 857 const FilePath& database_location, | 857 const FilePath& database_location, |
| 858 const WeakHandle<JsEventHandler>& event_handler, | 858 const WeakHandle<JsEventHandler>& event_handler, |
| 859 const std::string& sync_server_and_path, | 859 const std::string& sync_server_and_path, |
| 860 int port, | 860 int port, |
| 861 bool use_ssl, | 861 bool use_ssl, |
| 862 const scoped_refptr<base::TaskRunner>& blocking_task_runner, | 862 const scoped_refptr<base::TaskRunner>& blocking_task_runner, |
| 863 HttpPostProviderFactory* post_factory, | 863 HttpPostProviderFactory* post_factory, |
| 864 const csync::ModelSafeRoutingInfo& model_safe_routing_info, | 864 const syncer::ModelSafeRoutingInfo& model_safe_routing_info, |
| 865 const std::vector<csync::ModelSafeWorker*>& workers, | 865 const std::vector<syncer::ModelSafeWorker*>& workers, |
| 866 csync::ExtensionsActivityMonitor* extensions_activity_monitor, | 866 syncer::ExtensionsActivityMonitor* extensions_activity_monitor, |
| 867 ChangeDelegate* change_delegate, | 867 ChangeDelegate* change_delegate, |
| 868 const SyncCredentials& credentials, | 868 const SyncCredentials& credentials, |
| 869 csync::SyncNotifier* sync_notifier, | 869 syncer::SyncNotifier* sync_notifier, |
| 870 const std::string& restored_key_for_bootstrapping, | 870 const std::string& restored_key_for_bootstrapping, |
| 871 TestingMode testing_mode, | 871 TestingMode testing_mode, |
| 872 Encryptor* encryptor, | 872 Encryptor* encryptor, |
| 873 UnrecoverableErrorHandler* unrecoverable_error_handler, | 873 UnrecoverableErrorHandler* unrecoverable_error_handler, |
| 874 ReportUnrecoverableErrorFunction report_unrecoverable_error_function) { | 874 ReportUnrecoverableErrorFunction report_unrecoverable_error_function) { |
| 875 CHECK(!initialized_); | 875 CHECK(!initialized_); |
| 876 | 876 |
| 877 DCHECK(thread_checker_.CalledOnValidThread()); | 877 DCHECK(thread_checker_.CalledOnValidThread()); |
| 878 | 878 |
| 879 DVLOG(1) << "Starting SyncInternal initialization."; | 879 DVLOG(1) << "Starting SyncInternal initialization."; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 945 &traffic_recorder_)); | 945 &traffic_recorder_)); |
| 946 session_context()->set_account_name(credentials.email); | 946 session_context()->set_account_name(credentials.email); |
| 947 scheduler_.reset(new SyncScheduler(name_, session_context(), new Syncer())); | 947 scheduler_.reset(new SyncScheduler(name_, session_context(), new Syncer())); |
| 948 } | 948 } |
| 949 | 949 |
| 950 bool signed_in = SignIn(credentials); | 950 bool signed_in = SignIn(credentials); |
| 951 | 951 |
| 952 if (signed_in) { | 952 if (signed_in) { |
| 953 if (scheduler()) { | 953 if (scheduler()) { |
| 954 scheduler()->Start( | 954 scheduler()->Start( |
| 955 csync::SyncScheduler::CONFIGURATION_MODE, base::Closure()); | 955 syncer::SyncScheduler::CONFIGURATION_MODE, base::Closure()); |
| 956 } | 956 } |
| 957 | 957 |
| 958 initialized_ = true; | 958 initialized_ = true; |
| 959 | 959 |
| 960 // Cryptographer should only be accessed while holding a | 960 // Cryptographer should only be accessed while holding a |
| 961 // transaction. Grabbing the user share for the transaction | 961 // transaction. Grabbing the user share for the transaction |
| 962 // checks the initialization state, so this must come after | 962 // checks the initialization state, so this must come after |
| 963 // |initialized_| is set to true. | 963 // |initialized_| is set to true. |
| 964 ReadTransaction trans(FROM_HERE, GetUserShare()); | 964 ReadTransaction trans(FROM_HERE, GetUserShare()); |
| 965 trans.GetCryptographer()->Bootstrap(restored_key_for_bootstrapping); | 965 trans.GetCryptographer()->Bootstrap(restored_key_for_bootstrapping); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 981 | 981 |
| 982 sync_notifier_->AddObserver(this); | 982 sync_notifier_->AddObserver(this); |
| 983 | 983 |
| 984 return signed_in; | 984 return signed_in; |
| 985 } | 985 } |
| 986 | 986 |
| 987 void SyncManager::SyncInternal::UpdateCryptographerAndNigori( | 987 void SyncManager::SyncInternal::UpdateCryptographerAndNigori( |
| 988 const std::string& chrome_version, | 988 const std::string& chrome_version, |
| 989 const base::Closure& done_callback) { | 989 const base::Closure& done_callback) { |
| 990 DCHECK(initialized_); | 990 DCHECK(initialized_); |
| 991 csync::GetSessionName( | 991 syncer::GetSessionName( |
| 992 blocking_task_runner_, | 992 blocking_task_runner_, |
| 993 base::Bind( | 993 base::Bind( |
| 994 &SyncManager::SyncInternal::UpdateCryptographerAndNigoriCallback, | 994 &SyncManager::SyncInternal::UpdateCryptographerAndNigoriCallback, |
| 995 weak_ptr_factory_.GetWeakPtr(), | 995 weak_ptr_factory_.GetWeakPtr(), |
| 996 chrome_version, | 996 chrome_version, |
| 997 done_callback)); | 997 done_callback)); |
| 998 } | 998 } |
| 999 | 999 |
| 1000 void SyncManager::SyncInternal::UpdateNigoriEncryptionState( | 1000 void SyncManager::SyncInternal::UpdateNigoriEncryptionState( |
| 1001 Cryptographer* cryptographer, | 1001 Cryptographer* cryptographer, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1039 done_callback.Run(); // Should only happen during first time sync. | 1039 done_callback.Run(); // Should only happen during first time sync. |
| 1040 return; | 1040 return; |
| 1041 } | 1041 } |
| 1042 | 1042 |
| 1043 bool success = false; | 1043 bool success = false; |
| 1044 { | 1044 { |
| 1045 WriteTransaction trans(FROM_HERE, GetUserShare()); | 1045 WriteTransaction trans(FROM_HERE, GetUserShare()); |
| 1046 Cryptographer* cryptographer = trans.GetCryptographer(); | 1046 Cryptographer* cryptographer = trans.GetCryptographer(); |
| 1047 WriteNode node(&trans); | 1047 WriteNode node(&trans); |
| 1048 | 1048 |
| 1049 if (node.InitByTagLookup(kNigoriTag) == csync::BaseNode::INIT_OK) { | 1049 if (node.InitByTagLookup(kNigoriTag) == syncer::BaseNode::INIT_OK) { |
| 1050 sync_pb::NigoriSpecifics nigori(node.GetNigoriSpecifics()); | 1050 sync_pb::NigoriSpecifics nigori(node.GetNigoriSpecifics()); |
| 1051 Cryptographer::UpdateResult result = cryptographer->Update(nigori); | 1051 Cryptographer::UpdateResult result = cryptographer->Update(nigori); |
| 1052 if (result == Cryptographer::NEEDS_PASSPHRASE) { | 1052 if (result == Cryptographer::NEEDS_PASSPHRASE) { |
| 1053 sync_pb::EncryptedData pending_keys; | 1053 sync_pb::EncryptedData pending_keys; |
| 1054 if (cryptographer->has_pending_keys()) | 1054 if (cryptographer->has_pending_keys()) |
| 1055 pending_keys = cryptographer->GetPendingKeys(); | 1055 pending_keys = cryptographer->GetPendingKeys(); |
| 1056 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, | 1056 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, |
| 1057 OnPassphraseRequired(csync::REASON_DECRYPTION, | 1057 OnPassphraseRequired(syncer::REASON_DECRYPTION, |
| 1058 pending_keys)); | 1058 pending_keys)); |
| 1059 } | 1059 } |
| 1060 | 1060 |
| 1061 | 1061 |
| 1062 // Add or update device information. | 1062 // Add or update device information. |
| 1063 bool contains_this_device = false; | 1063 bool contains_this_device = false; |
| 1064 for (int i = 0; i < nigori.device_information_size(); ++i) { | 1064 for (int i = 0; i < nigori.device_information_size(); ++i) { |
| 1065 const sync_pb::DeviceInformation& device_information = | 1065 const sync_pb::DeviceInformation& device_information = |
| 1066 nigori.device_information(i); | 1066 nigori.device_information(i); |
| 1067 if (device_information.cache_guid() == directory()->cache_guid()) { | 1067 if (device_information.cache_guid() == directory()->cache_guid()) { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1117 // TODO(lipalani): Explore the possibility of hooking this up to | 1117 // TODO(lipalani): Explore the possibility of hooking this up to |
| 1118 // SyncManager::Observer and making |AllStatus| a listener for that. | 1118 // SyncManager::Observer and making |AllStatus| a listener for that. |
| 1119 allstatus_.SetCryptographerReady(cryptographer->is_ready()); | 1119 allstatus_.SetCryptographerReady(cryptographer->is_ready()); |
| 1120 allstatus_.SetCryptoHasPendingKeys(cryptographer->has_pending_keys()); | 1120 allstatus_.SetCryptoHasPendingKeys(cryptographer->has_pending_keys()); |
| 1121 debug_info_event_listener_.SetCryptographerReady(cryptographer->is_ready()); | 1121 debug_info_event_listener_.SetCryptographerReady(cryptographer->is_ready()); |
| 1122 debug_info_event_listener_.SetCrytographerHasPendingKeys( | 1122 debug_info_event_listener_.SetCrytographerHasPendingKeys( |
| 1123 cryptographer->has_pending_keys()); | 1123 cryptographer->has_pending_keys()); |
| 1124 } | 1124 } |
| 1125 | 1125 |
| 1126 void SyncManager::SyncInternal::StartSyncingNormally( | 1126 void SyncManager::SyncInternal::StartSyncingNormally( |
| 1127 const csync::ModelSafeRoutingInfo& routing_info) { | 1127 const syncer::ModelSafeRoutingInfo& routing_info) { |
| 1128 // Start the sync scheduler. | 1128 // Start the sync scheduler. |
| 1129 if (scheduler()) { // NULL during certain unittests. | 1129 if (scheduler()) { // NULL during certain unittests. |
| 1130 session_context()->set_routing_info(routing_info); | 1130 session_context()->set_routing_info(routing_info); |
| 1131 scheduler()->Start(SyncScheduler::NORMAL_MODE, base::Closure()); | 1131 scheduler()->Start(SyncScheduler::NORMAL_MODE, base::Closure()); |
| 1132 } | 1132 } |
| 1133 } | 1133 } |
| 1134 | 1134 |
| 1135 bool SyncManager::SyncInternal::OpenDirectory() { | 1135 bool SyncManager::SyncInternal::OpenDirectory() { |
| 1136 DCHECK(!initialized_) << "Should only happen once"; | 1136 DCHECK(!initialized_) << "Should only happen once"; |
| 1137 | 1137 |
| 1138 // Set before Open(). | 1138 // Set before Open(). |
| 1139 change_observer_ = | 1139 change_observer_ = |
| 1140 csync::MakeWeakHandle(js_mutation_event_observer_.AsWeakPtr()); | 1140 syncer::MakeWeakHandle(js_mutation_event_observer_.AsWeakPtr()); |
| 1141 WeakHandle<syncable::TransactionObserver> transaction_observer( | 1141 WeakHandle<syncable::TransactionObserver> transaction_observer( |
| 1142 csync::MakeWeakHandle(js_mutation_event_observer_.AsWeakPtr())); | 1142 syncer::MakeWeakHandle(js_mutation_event_observer_.AsWeakPtr())); |
| 1143 | 1143 |
| 1144 syncable::DirOpenResult open_result = syncable::NOT_INITIALIZED; | 1144 syncable::DirOpenResult open_result = syncable::NOT_INITIALIZED; |
| 1145 open_result = directory()->Open(username_for_share(), this, | 1145 open_result = directory()->Open(username_for_share(), this, |
| 1146 transaction_observer); | 1146 transaction_observer); |
| 1147 if (open_result != syncable::OPENED) { | 1147 if (open_result != syncable::OPENED) { |
| 1148 LOG(ERROR) << "Could not open share for:" << username_for_share(); | 1148 LOG(ERROR) << "Could not open share for:" << username_for_share(); |
| 1149 return false; | 1149 return false; |
| 1150 } | 1150 } |
| 1151 | 1151 |
| 1152 connection_manager()->set_client_id(directory()->cache_guid()); | 1152 connection_manager()->set_client_id(directory()->cache_guid()); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1212 if (passphrase.empty()) { | 1212 if (passphrase.empty()) { |
| 1213 NOTREACHED() << "Cannot encrypt with an empty passphrase."; | 1213 NOTREACHED() << "Cannot encrypt with an empty passphrase."; |
| 1214 return; | 1214 return; |
| 1215 } | 1215 } |
| 1216 | 1216 |
| 1217 // All accesses to the cryptographer are protected by a transaction. | 1217 // All accesses to the cryptographer are protected by a transaction. |
| 1218 WriteTransaction trans(FROM_HERE, GetUserShare()); | 1218 WriteTransaction trans(FROM_HERE, GetUserShare()); |
| 1219 Cryptographer* cryptographer = trans.GetCryptographer(); | 1219 Cryptographer* cryptographer = trans.GetCryptographer(); |
| 1220 KeyParams key_params = {"localhost", "dummy", passphrase}; | 1220 KeyParams key_params = {"localhost", "dummy", passphrase}; |
| 1221 WriteNode node(&trans); | 1221 WriteNode node(&trans); |
| 1222 if (node.InitByTagLookup(kNigoriTag) != csync::BaseNode::INIT_OK) { | 1222 if (node.InitByTagLookup(kNigoriTag) != syncer::BaseNode::INIT_OK) { |
| 1223 // TODO(albertb): Plumb an UnrecoverableError all the way back to the PSS. | 1223 // TODO(albertb): Plumb an UnrecoverableError all the way back to the PSS. |
| 1224 NOTREACHED(); | 1224 NOTREACHED(); |
| 1225 return; | 1225 return; |
| 1226 } | 1226 } |
| 1227 | 1227 |
| 1228 bool nigori_has_explicit_passphrase = | 1228 bool nigori_has_explicit_passphrase = |
| 1229 node.GetNigoriSpecifics().using_explicit_passphrase(); | 1229 node.GetNigoriSpecifics().using_explicit_passphrase(); |
| 1230 std::string bootstrap_token; | 1230 std::string bootstrap_token; |
| 1231 sync_pb::EncryptedData pending_keys; | 1231 sync_pb::EncryptedData pending_keys; |
| 1232 if (cryptographer->has_pending_keys()) | 1232 if (cryptographer->has_pending_keys()) |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1326 if (passphrase.empty()) { | 1326 if (passphrase.empty()) { |
| 1327 NOTREACHED() << "Cannot decrypt with an empty passphrase."; | 1327 NOTREACHED() << "Cannot decrypt with an empty passphrase."; |
| 1328 return; | 1328 return; |
| 1329 } | 1329 } |
| 1330 | 1330 |
| 1331 // All accesses to the cryptographer are protected by a transaction. | 1331 // All accesses to the cryptographer are protected by a transaction. |
| 1332 WriteTransaction trans(FROM_HERE, GetUserShare()); | 1332 WriteTransaction trans(FROM_HERE, GetUserShare()); |
| 1333 Cryptographer* cryptographer = trans.GetCryptographer(); | 1333 Cryptographer* cryptographer = trans.GetCryptographer(); |
| 1334 KeyParams key_params = {"localhost", "dummy", passphrase}; | 1334 KeyParams key_params = {"localhost", "dummy", passphrase}; |
| 1335 WriteNode node(&trans); | 1335 WriteNode node(&trans); |
| 1336 if (node.InitByTagLookup(kNigoriTag) != csync::BaseNode::INIT_OK) { | 1336 if (node.InitByTagLookup(kNigoriTag) != syncer::BaseNode::INIT_OK) { |
| 1337 // TODO(albertb): Plumb an UnrecoverableError all the way back to the PSS. | 1337 // TODO(albertb): Plumb an UnrecoverableError all the way back to the PSS. |
| 1338 NOTREACHED(); | 1338 NOTREACHED(); |
| 1339 return; | 1339 return; |
| 1340 } | 1340 } |
| 1341 | 1341 |
| 1342 if (!cryptographer->has_pending_keys()) { | 1342 if (!cryptographer->has_pending_keys()) { |
| 1343 // Note that this *can* happen in a rare situation where data is | 1343 // Note that this *can* happen in a rare situation where data is |
| 1344 // re-encrypted on another client while a SetDecryptionPassphrase() call is | 1344 // re-encrypted on another client while a SetDecryptionPassphrase() call is |
| 1345 // in-flight on this client. It is rare enough that we choose to do nothing. | 1345 // in-flight on this client. It is rare enough that we choose to do nothing. |
| 1346 NOTREACHED() << "Attempt to set decryption passphrase failed because there " | 1346 NOTREACHED() << "Attempt to set decryption passphrase failed because there " |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1479 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, | 1479 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, |
| 1480 OnBootstrapTokenUpdated(bootstrap_token)); | 1480 OnBootstrapTokenUpdated(bootstrap_token)); |
| 1481 } | 1481 } |
| 1482 | 1482 |
| 1483 if (!success) { | 1483 if (!success) { |
| 1484 if (cryptographer->is_ready()) { | 1484 if (cryptographer->is_ready()) { |
| 1485 LOG(ERROR) << "Attempt to change passphrase failed while cryptographer " | 1485 LOG(ERROR) << "Attempt to change passphrase failed while cryptographer " |
| 1486 << "was ready."; | 1486 << "was ready."; |
| 1487 } else if (cryptographer->has_pending_keys()) { | 1487 } else if (cryptographer->has_pending_keys()) { |
| 1488 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, | 1488 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, |
| 1489 OnPassphraseRequired(csync::REASON_DECRYPTION, | 1489 OnPassphraseRequired(syncer::REASON_DECRYPTION, |
| 1490 cryptographer->GetPendingKeys())); | 1490 cryptographer->GetPendingKeys())); |
| 1491 } else { | 1491 } else { |
| 1492 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, | 1492 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, |
| 1493 OnPassphraseRequired(csync::REASON_ENCRYPTION, | 1493 OnPassphraseRequired(syncer::REASON_ENCRYPTION, |
| 1494 sync_pb::EncryptedData())); | 1494 sync_pb::EncryptedData())); |
| 1495 } | 1495 } |
| 1496 return; | 1496 return; |
| 1497 } | 1497 } |
| 1498 | 1498 |
| 1499 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, | 1499 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, |
| 1500 OnPassphraseAccepted()); | 1500 OnPassphraseAccepted()); |
| 1501 DCHECK(cryptographer->is_ready()); | 1501 DCHECK(cryptographer->is_ready()); |
| 1502 | 1502 |
| 1503 // TODO(tim): Bug 58231. It would be nice if setting a passphrase didn't | 1503 // TODO(tim): Bug 58231. It would be nice if setting a passphrase didn't |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1515 nigori_node->SetNigoriSpecifics(specifics); | 1515 nigori_node->SetNigoriSpecifics(specifics); |
| 1516 | 1516 |
| 1517 // Does nothing if everything is already encrypted or the cryptographer has | 1517 // Does nothing if everything is already encrypted or the cryptographer has |
| 1518 // pending keys. | 1518 // pending keys. |
| 1519 ReEncryptEverything(trans); | 1519 ReEncryptEverything(trans); |
| 1520 } | 1520 } |
| 1521 | 1521 |
| 1522 bool SyncManager::SyncInternal::IsUsingExplicitPassphrase() { | 1522 bool SyncManager::SyncInternal::IsUsingExplicitPassphrase() { |
| 1523 ReadTransaction trans(FROM_HERE, &share_); | 1523 ReadTransaction trans(FROM_HERE, &share_); |
| 1524 ReadNode node(&trans); | 1524 ReadNode node(&trans); |
| 1525 if (node.InitByTagLookup(kNigoriTag) != csync::BaseNode::INIT_OK) { | 1525 if (node.InitByTagLookup(kNigoriTag) != syncer::BaseNode::INIT_OK) { |
| 1526 // TODO(albertb): Plumb an UnrecoverableError all the way back to the PSS. | 1526 // TODO(albertb): Plumb an UnrecoverableError all the way back to the PSS. |
| 1527 NOTREACHED(); | 1527 NOTREACHED(); |
| 1528 return false; | 1528 return false; |
| 1529 } | 1529 } |
| 1530 | 1530 |
| 1531 return node.GetNigoriSpecifics().using_explicit_passphrase(); | 1531 return node.GetNigoriSpecifics().using_explicit_passphrase(); |
| 1532 } | 1532 } |
| 1533 | 1533 |
| 1534 void SyncManager::SyncInternal::RefreshEncryption() { | 1534 void SyncManager::SyncInternal::RefreshEncryption() { |
| 1535 DCHECK(initialized_); | 1535 DCHECK(initialized_); |
| 1536 | 1536 |
| 1537 WriteTransaction trans(FROM_HERE, GetUserShare()); | 1537 WriteTransaction trans(FROM_HERE, GetUserShare()); |
| 1538 WriteNode node(&trans); | 1538 WriteNode node(&trans); |
| 1539 if (node.InitByTagLookup(kNigoriTag) != csync::BaseNode::INIT_OK) { | 1539 if (node.InitByTagLookup(kNigoriTag) != syncer::BaseNode::INIT_OK) { |
| 1540 NOTREACHED() << "Unable to set encrypted datatypes because Nigori node not " | 1540 NOTREACHED() << "Unable to set encrypted datatypes because Nigori node not " |
| 1541 << "found."; | 1541 << "found."; |
| 1542 return; | 1542 return; |
| 1543 } | 1543 } |
| 1544 | 1544 |
| 1545 Cryptographer* cryptographer = trans.GetCryptographer(); | 1545 Cryptographer* cryptographer = trans.GetCryptographer(); |
| 1546 | 1546 |
| 1547 if (!cryptographer->is_ready()) { | 1547 if (!cryptographer->is_ready()) { |
| 1548 DVLOG(1) << "Attempting to encrypt datatypes when cryptographer not " | 1548 DVLOG(1) << "Attempting to encrypt datatypes when cryptographer not " |
| 1549 << "initialized, prompting for passphrase."; | 1549 << "initialized, prompting for passphrase."; |
| 1550 // TODO(zea): this isn't really decryption, but that's the only way we have | 1550 // TODO(zea): this isn't really decryption, but that's the only way we have |
| 1551 // to prompt the user for a passsphrase. See http://crbug.com/91379. | 1551 // to prompt the user for a passsphrase. See http://crbug.com/91379. |
| 1552 sync_pb::EncryptedData pending_keys; | 1552 sync_pb::EncryptedData pending_keys; |
| 1553 if (cryptographer->has_pending_keys()) | 1553 if (cryptographer->has_pending_keys()) |
| 1554 pending_keys = cryptographer->GetPendingKeys(); | 1554 pending_keys = cryptographer->GetPendingKeys(); |
| 1555 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, | 1555 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, |
| 1556 OnPassphraseRequired(csync::REASON_DECRYPTION, | 1556 OnPassphraseRequired(syncer::REASON_DECRYPTION, |
| 1557 pending_keys)); | 1557 pending_keys)); |
| 1558 return; | 1558 return; |
| 1559 } | 1559 } |
| 1560 | 1560 |
| 1561 UpdateNigoriEncryptionState(cryptographer, &node); | 1561 UpdateNigoriEncryptionState(cryptographer, &node); |
| 1562 | 1562 |
| 1563 allstatus_.SetEncryptedTypes(cryptographer->GetEncryptedTypes()); | 1563 allstatus_.SetEncryptedTypes(cryptographer->GetEncryptedTypes()); |
| 1564 | 1564 |
| 1565 // We reencrypt everything regardless of whether the set of encrypted | 1565 // We reencrypt everything regardless of whether the set of encrypted |
| 1566 // types changed to ensure that any stray unencrypted entries are overwritten. | 1566 // types changed to ensure that any stray unencrypted entries are overwritten. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1577 return; | 1577 return; |
| 1578 syncable::ModelTypeSet encrypted_types = GetEncryptedTypes(trans); | 1578 syncable::ModelTypeSet encrypted_types = GetEncryptedTypes(trans); |
| 1579 for (syncable::ModelTypeSet::Iterator iter = encrypted_types.First(); | 1579 for (syncable::ModelTypeSet::Iterator iter = encrypted_types.First(); |
| 1580 iter.Good(); iter.Inc()) { | 1580 iter.Good(); iter.Inc()) { |
| 1581 if (iter.Get() == syncable::PASSWORDS || | 1581 if (iter.Get() == syncable::PASSWORDS || |
| 1582 iter.Get() == syncable::NIGORI) | 1582 iter.Get() == syncable::NIGORI) |
| 1583 continue; // These types handle encryption differently. | 1583 continue; // These types handle encryption differently. |
| 1584 | 1584 |
| 1585 ReadNode type_root(trans); | 1585 ReadNode type_root(trans); |
| 1586 std::string tag = syncable::ModelTypeToRootTag(iter.Get()); | 1586 std::string tag = syncable::ModelTypeToRootTag(iter.Get()); |
| 1587 if (type_root.InitByTagLookup(tag) != csync::BaseNode::INIT_OK) | 1587 if (type_root.InitByTagLookup(tag) != syncer::BaseNode::INIT_OK) |
| 1588 continue; // Don't try to reencrypt if the type's data is unavailable. | 1588 continue; // Don't try to reencrypt if the type's data is unavailable. |
| 1589 | 1589 |
| 1590 // Iterate through all children of this datatype. | 1590 // Iterate through all children of this datatype. |
| 1591 std::queue<int64> to_visit; | 1591 std::queue<int64> to_visit; |
| 1592 int64 child_id = type_root.GetFirstChildId(); | 1592 int64 child_id = type_root.GetFirstChildId(); |
| 1593 to_visit.push(child_id); | 1593 to_visit.push(child_id); |
| 1594 while (!to_visit.empty()) { | 1594 while (!to_visit.empty()) { |
| 1595 child_id = to_visit.front(); | 1595 child_id = to_visit.front(); |
| 1596 to_visit.pop(); | 1596 to_visit.pop(); |
| 1597 if (child_id == kInvalidId) | 1597 if (child_id == kInvalidId) |
| 1598 continue; | 1598 continue; |
| 1599 | 1599 |
| 1600 WriteNode child(trans); | 1600 WriteNode child(trans); |
| 1601 if (child.InitByIdLookup(child_id) != csync::BaseNode::INIT_OK) { | 1601 if (child.InitByIdLookup(child_id) != syncer::BaseNode::INIT_OK) { |
| 1602 NOTREACHED(); | 1602 NOTREACHED(); |
| 1603 continue; | 1603 continue; |
| 1604 } | 1604 } |
| 1605 if (child.GetIsFolder()) { | 1605 if (child.GetIsFolder()) { |
| 1606 to_visit.push(child.GetFirstChildId()); | 1606 to_visit.push(child.GetFirstChildId()); |
| 1607 } | 1607 } |
| 1608 if (child.GetEntry()->Get(syncable::UNIQUE_SERVER_TAG).empty()) { | 1608 if (child.GetEntry()->Get(syncable::UNIQUE_SERVER_TAG).empty()) { |
| 1609 // Rewrite the specifics of the node with encrypted data if necessary | 1609 // Rewrite the specifics of the node with encrypted data if necessary |
| 1610 // (only rewrite the non-unique folders). | 1610 // (only rewrite the non-unique folders). |
| 1611 child.ResetFromSpecifics(); | 1611 child.ResetFromSpecifics(); |
| 1612 } | 1612 } |
| 1613 to_visit.push(child.GetSuccessorId()); | 1613 to_visit.push(child.GetSuccessorId()); |
| 1614 } | 1614 } |
| 1615 } | 1615 } |
| 1616 | 1616 |
| 1617 // Passwords are encrypted with their own legacy scheme. Passwords are always | 1617 // Passwords are encrypted with their own legacy scheme. Passwords are always |
| 1618 // encrypted so we don't need to check GetEncryptedTypes() here. | 1618 // encrypted so we don't need to check GetEncryptedTypes() here. |
| 1619 ReadNode passwords_root(trans); | 1619 ReadNode passwords_root(trans); |
| 1620 std::string passwords_tag = | 1620 std::string passwords_tag = |
| 1621 syncable::ModelTypeToRootTag(syncable::PASSWORDS); | 1621 syncable::ModelTypeToRootTag(syncable::PASSWORDS); |
| 1622 if (passwords_root.InitByTagLookup(passwords_tag) == | 1622 if (passwords_root.InitByTagLookup(passwords_tag) == |
| 1623 csync::BaseNode::INIT_OK) { | 1623 syncer::BaseNode::INIT_OK) { |
| 1624 int64 child_id = passwords_root.GetFirstChildId(); | 1624 int64 child_id = passwords_root.GetFirstChildId(); |
| 1625 while (child_id != kInvalidId) { | 1625 while (child_id != kInvalidId) { |
| 1626 WriteNode child(trans); | 1626 WriteNode child(trans); |
| 1627 if (child.InitByIdLookup(child_id) != csync::BaseNode::INIT_OK) { | 1627 if (child.InitByIdLookup(child_id) != syncer::BaseNode::INIT_OK) { |
| 1628 NOTREACHED(); | 1628 NOTREACHED(); |
| 1629 return; | 1629 return; |
| 1630 } | 1630 } |
| 1631 child.SetPasswordSpecifics(child.GetPasswordSpecifics()); | 1631 child.SetPasswordSpecifics(child.GetPasswordSpecifics()); |
| 1632 child_id = child.GetSuccessorId(); | 1632 child_id = child.GetSuccessorId(); |
| 1633 } | 1633 } |
| 1634 } | 1634 } |
| 1635 | 1635 |
| 1636 // NOTE: We notify from within a transaction. | 1636 // NOTE: We notify from within a transaction. |
| 1637 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, OnEncryptionComplete()); | 1637 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, OnEncryptionComplete()); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1737 void SyncManager::SyncInternal::OnIPAddressChangedImpl() { | 1737 void SyncManager::SyncInternal::OnIPAddressChangedImpl() { |
| 1738 DCHECK(thread_checker_.CalledOnValidThread()); | 1738 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1739 if (scheduler()) | 1739 if (scheduler()) |
| 1740 scheduler()->OnConnectionStatusChange(); | 1740 scheduler()->OnConnectionStatusChange(); |
| 1741 } | 1741 } |
| 1742 | 1742 |
| 1743 void SyncManager::SyncInternal::OnServerConnectionEvent( | 1743 void SyncManager::SyncInternal::OnServerConnectionEvent( |
| 1744 const ServerConnectionEvent& event) { | 1744 const ServerConnectionEvent& event) { |
| 1745 DCHECK(thread_checker_.CalledOnValidThread()); | 1745 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1746 if (event.connection_code == | 1746 if (event.connection_code == |
| 1747 csync::HttpResponse::SERVER_CONNECTION_OK) { | 1747 syncer::HttpResponse::SERVER_CONNECTION_OK) { |
| 1748 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, | 1748 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, |
| 1749 OnConnectionStatusChange(CONNECTION_OK)); | 1749 OnConnectionStatusChange(CONNECTION_OK)); |
| 1750 } | 1750 } |
| 1751 | 1751 |
| 1752 if (event.connection_code == csync::HttpResponse::SYNC_AUTH_ERROR) { | 1752 if (event.connection_code == syncer::HttpResponse::SYNC_AUTH_ERROR) { |
| 1753 observing_ip_address_changes_ = false; | 1753 observing_ip_address_changes_ = false; |
| 1754 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, | 1754 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, |
| 1755 OnConnectionStatusChange(CONNECTION_AUTH_ERROR)); | 1755 OnConnectionStatusChange(CONNECTION_AUTH_ERROR)); |
| 1756 } | 1756 } |
| 1757 | 1757 |
| 1758 if (event.connection_code == | 1758 if (event.connection_code == |
| 1759 csync::HttpResponse::SYNC_SERVER_ERROR) { | 1759 syncer::HttpResponse::SYNC_SERVER_ERROR) { |
| 1760 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, | 1760 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, |
| 1761 OnConnectionStatusChange(CONNECTION_SERVER_ERROR)); | 1761 OnConnectionStatusChange(CONNECTION_SERVER_ERROR)); |
| 1762 } | 1762 } |
| 1763 } | 1763 } |
| 1764 | 1764 |
| 1765 void SyncManager::SyncInternal::HandleTransactionCompleteChangeEvent( | 1765 void SyncManager::SyncInternal::HandleTransactionCompleteChangeEvent( |
| 1766 ModelTypeSet models_with_changes) { | 1766 ModelTypeSet models_with_changes) { |
| 1767 // This notification happens immediately after the transaction mutex is | 1767 // This notification happens immediately after the transaction mutex is |
| 1768 // released. This allows work to be performed without blocking other threads | 1768 // released. This allows work to be performed without blocking other threads |
| 1769 // from acquiring a transaction. | 1769 // from acquiring a transaction. |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1939 } | 1939 } |
| 1940 | 1940 |
| 1941 SyncStatus SyncManager::SyncInternal::GetStatus() { | 1941 SyncStatus SyncManager::SyncInternal::GetStatus() { |
| 1942 return allstatus_.status(); | 1942 return allstatus_.status(); |
| 1943 } | 1943 } |
| 1944 | 1944 |
| 1945 void SyncManager::SyncInternal::RequestNudge( | 1945 void SyncManager::SyncInternal::RequestNudge( |
| 1946 const tracked_objects::Location& location) { | 1946 const tracked_objects::Location& location) { |
| 1947 if (scheduler()) { | 1947 if (scheduler()) { |
| 1948 scheduler()->ScheduleNudgeAsync( | 1948 scheduler()->ScheduleNudgeAsync( |
| 1949 TimeDelta::FromMilliseconds(0), csync::NUDGE_SOURCE_LOCAL, | 1949 TimeDelta::FromMilliseconds(0), syncer::NUDGE_SOURCE_LOCAL, |
| 1950 ModelTypeSet(), location); | 1950 ModelTypeSet(), location); |
| 1951 } | 1951 } |
| 1952 } | 1952 } |
| 1953 | 1953 |
| 1954 TimeDelta SyncManager::SyncInternal::GetNudgeDelayTimeDelta( | 1954 TimeDelta SyncManager::SyncInternal::GetNudgeDelayTimeDelta( |
| 1955 const ModelType& model_type) { | 1955 const ModelType& model_type) { |
| 1956 return NudgeStrategy::GetNudgeDelayTimeDelta(model_type, this); | 1956 return NudgeStrategy::GetNudgeDelayTimeDelta(model_type, this); |
| 1957 } | 1957 } |
| 1958 | 1958 |
| 1959 void SyncManager::SyncInternal::RequestNudgeForDataTypes( | 1959 void SyncManager::SyncInternal::RequestNudgeForDataTypes( |
| 1960 const tracked_objects::Location& nudge_location, | 1960 const tracked_objects::Location& nudge_location, |
| 1961 ModelTypeSet types) { | 1961 ModelTypeSet types) { |
| 1962 if (!scheduler()) { | 1962 if (!scheduler()) { |
| 1963 NOTREACHED(); | 1963 NOTREACHED(); |
| 1964 return; | 1964 return; |
| 1965 } | 1965 } |
| 1966 | 1966 |
| 1967 debug_info_event_listener_.OnNudgeFromDatatype(types.First().Get()); | 1967 debug_info_event_listener_.OnNudgeFromDatatype(types.First().Get()); |
| 1968 | 1968 |
| 1969 // TODO(lipalani) : Calculate the nudge delay based on all types. | 1969 // TODO(lipalani) : Calculate the nudge delay based on all types. |
| 1970 base::TimeDelta nudge_delay = NudgeStrategy::GetNudgeDelayTimeDelta( | 1970 base::TimeDelta nudge_delay = NudgeStrategy::GetNudgeDelayTimeDelta( |
| 1971 types.First().Get(), | 1971 types.First().Get(), |
| 1972 this); | 1972 this); |
| 1973 scheduler()->ScheduleNudgeAsync(nudge_delay, | 1973 scheduler()->ScheduleNudgeAsync(nudge_delay, |
| 1974 csync::NUDGE_SOURCE_LOCAL, | 1974 syncer::NUDGE_SOURCE_LOCAL, |
| 1975 types, | 1975 types, |
| 1976 nudge_location); | 1976 nudge_location); |
| 1977 } | 1977 } |
| 1978 | 1978 |
| 1979 void SyncManager::SyncInternal::OnSyncEngineEvent( | 1979 void SyncManager::SyncInternal::OnSyncEngineEvent( |
| 1980 const SyncEngineEvent& event) { | 1980 const SyncEngineEvent& event) { |
| 1981 DCHECK(thread_checker_.CalledOnValidThread()); | 1981 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1982 // Only send an event if this is due to a cycle ending and this cycle | 1982 // Only send an event if this is due to a cycle ending and this cycle |
| 1983 // concludes a canonical "sync" process; that is, based on what is known | 1983 // concludes a canonical "sync" process; that is, based on what is known |
| 1984 // locally we are "all happy" and up-to-date. There may be new changes on | 1984 // locally we are "all happy" and up-to-date. There may be new changes on |
| 1985 // the server, but we'll get them on a subsequent sync. | 1985 // the server, but we'll get them on a subsequent sync. |
| 1986 // | 1986 // |
| 1987 // Notifications are sent at the end of every sync cycle, regardless of | 1987 // Notifications are sent at the end of every sync cycle, regardless of |
| 1988 // whether we should sync again. | 1988 // whether we should sync again. |
| 1989 if (event.what_happened == SyncEngineEvent::SYNC_CYCLE_ENDED) { | 1989 if (event.what_happened == SyncEngineEvent::SYNC_CYCLE_ENDED) { |
| 1990 { | 1990 { |
| 1991 // Check to see if we need to notify the frontend that we have newly | 1991 // Check to see if we need to notify the frontend that we have newly |
| 1992 // encrypted types or that we require a passphrase. | 1992 // encrypted types or that we require a passphrase. |
| 1993 ReadTransaction trans(FROM_HERE, GetUserShare()); | 1993 ReadTransaction trans(FROM_HERE, GetUserShare()); |
| 1994 Cryptographer* cryptographer = trans.GetCryptographer(); | 1994 Cryptographer* cryptographer = trans.GetCryptographer(); |
| 1995 // If we've completed a sync cycle and the cryptographer isn't ready | 1995 // If we've completed a sync cycle and the cryptographer isn't ready |
| 1996 // yet, prompt the user for a passphrase. | 1996 // yet, prompt the user for a passphrase. |
| 1997 if (cryptographer->has_pending_keys()) { | 1997 if (cryptographer->has_pending_keys()) { |
| 1998 DVLOG(1) << "OnPassPhraseRequired Sent"; | 1998 DVLOG(1) << "OnPassPhraseRequired Sent"; |
| 1999 sync_pb::EncryptedData pending_keys = cryptographer->GetPendingKeys(); | 1999 sync_pb::EncryptedData pending_keys = cryptographer->GetPendingKeys(); |
| 2000 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, | 2000 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, |
| 2001 OnPassphraseRequired(csync::REASON_DECRYPTION, | 2001 OnPassphraseRequired(syncer::REASON_DECRYPTION, |
| 2002 pending_keys)); | 2002 pending_keys)); |
| 2003 } else if (!cryptographer->is_ready() && | 2003 } else if (!cryptographer->is_ready() && |
| 2004 event.snapshot.initial_sync_ended().Has(syncable::NIGORI)) { | 2004 event.snapshot.initial_sync_ended().Has(syncable::NIGORI)) { |
| 2005 DVLOG(1) << "OnPassphraseRequired sent because cryptographer is not " | 2005 DVLOG(1) << "OnPassphraseRequired sent because cryptographer is not " |
| 2006 << "ready"; | 2006 << "ready"; |
| 2007 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, | 2007 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, |
| 2008 OnPassphraseRequired(csync::REASON_ENCRYPTION, | 2008 OnPassphraseRequired(syncer::REASON_ENCRYPTION, |
| 2009 sync_pb::EncryptedData())); | 2009 sync_pb::EncryptedData())); |
| 2010 } | 2010 } |
| 2011 | 2011 |
| 2012 NotifyCryptographerState(cryptographer); | 2012 NotifyCryptographerState(cryptographer); |
| 2013 allstatus_.SetEncryptedTypes(cryptographer->GetEncryptedTypes()); | 2013 allstatus_.SetEncryptedTypes(cryptographer->GetEncryptedTypes()); |
| 2014 } | 2014 } |
| 2015 | 2015 |
| 2016 if (!initialized_) { | 2016 if (!initialized_) { |
| 2017 LOG(INFO) << "OnSyncCycleCompleted not sent because sync api is not " | 2017 LOG(INFO) << "OnSyncCycleCompleted not sent because sync api is not " |
| 2018 << "initialized"; | 2018 << "initialized"; |
| 2019 return; | 2019 return; |
| 2020 } | 2020 } |
| 2021 | 2021 |
| 2022 if (!event.snapshot.has_more_to_sync()) { | 2022 if (!event.snapshot.has_more_to_sync()) { |
| 2023 // To account for a nigori node arriving with stale/bad data, we ensure | 2023 // To account for a nigori node arriving with stale/bad data, we ensure |
| 2024 // that the nigori node is up to date at the end of each cycle. | 2024 // that the nigori node is up to date at the end of each cycle. |
| 2025 WriteTransaction trans(FROM_HERE, GetUserShare()); | 2025 WriteTransaction trans(FROM_HERE, GetUserShare()); |
| 2026 WriteNode nigori_node(&trans); | 2026 WriteNode nigori_node(&trans); |
| 2027 if (nigori_node.InitByTagLookup(kNigoriTag) == | 2027 if (nigori_node.InitByTagLookup(kNigoriTag) == |
| 2028 csync::BaseNode::INIT_OK) { | 2028 syncer::BaseNode::INIT_OK) { |
| 2029 Cryptographer* cryptographer = trans.GetCryptographer(); | 2029 Cryptographer* cryptographer = trans.GetCryptographer(); |
| 2030 UpdateNigoriEncryptionState(cryptographer, &nigori_node); | 2030 UpdateNigoriEncryptionState(cryptographer, &nigori_node); |
| 2031 } | 2031 } |
| 2032 | 2032 |
| 2033 DVLOG(1) << "Sending OnSyncCycleCompleted"; | 2033 DVLOG(1) << "Sending OnSyncCycleCompleted"; |
| 2034 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, | 2034 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, |
| 2035 OnSyncCycleCompleted(event.snapshot)); | 2035 OnSyncCycleCompleted(event.snapshot)); |
| 2036 } | 2036 } |
| 2037 | 2037 |
| 2038 // This is here for tests, which are still using p2p notifications. | 2038 // This is here for tests, which are still using p2p notifications. |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2187 ListValue* id_list = NULL; | 2187 ListValue* id_list = NULL; |
| 2188 ReadTransaction trans(FROM_HERE, user_share); | 2188 ReadTransaction trans(FROM_HERE, user_share); |
| 2189 if (args.Get().GetList(0, &id_list)) { | 2189 if (args.Get().GetList(0, &id_list)) { |
| 2190 CHECK(id_list); | 2190 CHECK(id_list); |
| 2191 for (size_t i = 0; i < id_list->GetSize(); ++i) { | 2191 for (size_t i = 0; i < id_list->GetSize(); ++i) { |
| 2192 int64 id = GetId(*id_list, i); | 2192 int64 id = GetId(*id_list, i); |
| 2193 if (id == kInvalidId) { | 2193 if (id == kInvalidId) { |
| 2194 continue; | 2194 continue; |
| 2195 } | 2195 } |
| 2196 ReadNode node(&trans); | 2196 ReadNode node(&trans); |
| 2197 if (node.InitByIdLookup(id) != csync::BaseNode::INIT_OK) { | 2197 if (node.InitByIdLookup(id) != syncer::BaseNode::INIT_OK) { |
| 2198 continue; | 2198 continue; |
| 2199 } | 2199 } |
| 2200 node_summaries->Append((node.*info_getter)()); | 2200 node_summaries->Append((node.*info_getter)()); |
| 2201 } | 2201 } |
| 2202 } | 2202 } |
| 2203 return JsArgList(&return_args); | 2203 return JsArgList(&return_args); |
| 2204 } | 2204 } |
| 2205 | 2205 |
| 2206 } // namespace | 2206 } // namespace |
| 2207 | 2207 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2285 DictionaryValue details; | 2285 DictionaryValue details; |
| 2286 details.Set("enabled", Value::CreateBooleanValue(true)); | 2286 details.Set("enabled", Value::CreateBooleanValue(true)); |
| 2287 js_event_handler_.Call(FROM_HERE, | 2287 js_event_handler_.Call(FROM_HERE, |
| 2288 &JsEventHandler::HandleJsEvent, | 2288 &JsEventHandler::HandleJsEvent, |
| 2289 "onNotificationStateChange", | 2289 "onNotificationStateChange", |
| 2290 JsEventDetails(&details)); | 2290 JsEventDetails(&details)); |
| 2291 } | 2291 } |
| 2292 } | 2292 } |
| 2293 | 2293 |
| 2294 void SyncManager::SyncInternal::OnNotificationsDisabled( | 2294 void SyncManager::SyncInternal::OnNotificationsDisabled( |
| 2295 csync::NotificationsDisabledReason reason) { | 2295 syncer::NotificationsDisabledReason reason) { |
| 2296 DVLOG(1) << "Notifications disabled with reason " | 2296 DVLOG(1) << "Notifications disabled with reason " |
| 2297 << csync::NotificationsDisabledReasonToString(reason); | 2297 << syncer::NotificationsDisabledReasonToString(reason); |
| 2298 allstatus_.SetNotificationsEnabled(false); | 2298 allstatus_.SetNotificationsEnabled(false); |
| 2299 if (scheduler()) { | 2299 if (scheduler()) { |
| 2300 scheduler()->set_notifications_enabled(false); | 2300 scheduler()->set_notifications_enabled(false); |
| 2301 } | 2301 } |
| 2302 if (js_event_handler_.IsInitialized()) { | 2302 if (js_event_handler_.IsInitialized()) { |
| 2303 DictionaryValue details; | 2303 DictionaryValue details; |
| 2304 details.Set("enabled", Value::CreateBooleanValue(false)); | 2304 details.Set("enabled", Value::CreateBooleanValue(false)); |
| 2305 js_event_handler_.Call(FROM_HERE, | 2305 js_event_handler_.Call(FROM_HERE, |
| 2306 &JsEventHandler::HandleJsEvent, | 2306 &JsEventHandler::HandleJsEvent, |
| 2307 "onNotificationStateChange", | 2307 "onNotificationStateChange", |
| 2308 JsEventDetails(&details)); | 2308 JsEventDetails(&details)); |
| 2309 } | 2309 } |
| 2310 // TODO(akalin): Treat a CREDENTIALS_REJECTED state as an auth | 2310 // TODO(akalin): Treat a CREDENTIALS_REJECTED state as an auth |
| 2311 // error. | 2311 // error. |
| 2312 } | 2312 } |
| 2313 | 2313 |
| 2314 void SyncManager::SyncInternal::OnIncomingNotification( | 2314 void SyncManager::SyncInternal::OnIncomingNotification( |
| 2315 const syncable::ModelTypePayloadMap& type_payloads, | 2315 const syncable::ModelTypePayloadMap& type_payloads, |
| 2316 csync::IncomingNotificationSource source) { | 2316 syncer::IncomingNotificationSource source) { |
| 2317 DCHECK(thread_checker_.CalledOnValidThread()); | 2317 DCHECK(thread_checker_.CalledOnValidThread()); |
| 2318 if (source == csync::LOCAL_NOTIFICATION) { | 2318 if (source == syncer::LOCAL_NOTIFICATION) { |
| 2319 if (scheduler()) { | 2319 if (scheduler()) { |
| 2320 scheduler()->ScheduleNudgeWithPayloadsAsync( | 2320 scheduler()->ScheduleNudgeWithPayloadsAsync( |
| 2321 TimeDelta::FromMilliseconds(kSyncRefreshDelayMsec), | 2321 TimeDelta::FromMilliseconds(kSyncRefreshDelayMsec), |
| 2322 csync::NUDGE_SOURCE_LOCAL_REFRESH, | 2322 syncer::NUDGE_SOURCE_LOCAL_REFRESH, |
| 2323 type_payloads, FROM_HERE); | 2323 type_payloads, FROM_HERE); |
| 2324 } | 2324 } |
| 2325 } else if (!type_payloads.empty()) { | 2325 } else if (!type_payloads.empty()) { |
| 2326 if (scheduler()) { | 2326 if (scheduler()) { |
| 2327 scheduler()->ScheduleNudgeWithPayloadsAsync( | 2327 scheduler()->ScheduleNudgeWithPayloadsAsync( |
| 2328 TimeDelta::FromMilliseconds(kSyncSchedulerDelayMsec), | 2328 TimeDelta::FromMilliseconds(kSyncSchedulerDelayMsec), |
| 2329 csync::NUDGE_SOURCE_NOTIFICATION, | 2329 syncer::NUDGE_SOURCE_NOTIFICATION, |
| 2330 type_payloads, FROM_HERE); | 2330 type_payloads, FROM_HERE); |
| 2331 } | 2331 } |
| 2332 allstatus_.IncrementNotificationsReceived(); | 2332 allstatus_.IncrementNotificationsReceived(); |
| 2333 UpdateNotificationInfo(type_payloads); | 2333 UpdateNotificationInfo(type_payloads); |
| 2334 debug_info_event_listener_.OnIncomingNotification(type_payloads); | 2334 debug_info_event_listener_.OnIncomingNotification(type_payloads); |
| 2335 } else { | 2335 } else { |
| 2336 LOG(WARNING) << "Sync received notification without any type information."; | 2336 LOG(WARNING) << "Sync received notification without any type information."; |
| 2337 } | 2337 } |
| 2338 | 2338 |
| 2339 if (js_event_handler_.IsInitialized()) { | 2339 if (js_event_handler_.IsInitialized()) { |
| 2340 DictionaryValue details; | 2340 DictionaryValue details; |
| 2341 ListValue* changed_types = new ListValue(); | 2341 ListValue* changed_types = new ListValue(); |
| 2342 details.Set("changedTypes", changed_types); | 2342 details.Set("changedTypes", changed_types); |
| 2343 for (syncable::ModelTypePayloadMap::const_iterator | 2343 for (syncable::ModelTypePayloadMap::const_iterator |
| 2344 it = type_payloads.begin(); | 2344 it = type_payloads.begin(); |
| 2345 it != type_payloads.end(); ++it) { | 2345 it != type_payloads.end(); ++it) { |
| 2346 const std::string& model_type_str = | 2346 const std::string& model_type_str = |
| 2347 syncable::ModelTypeToString(it->first); | 2347 syncable::ModelTypeToString(it->first); |
| 2348 changed_types->Append(Value::CreateStringValue(model_type_str)); | 2348 changed_types->Append(Value::CreateStringValue(model_type_str)); |
| 2349 } | 2349 } |
| 2350 details.SetString("source", (source == csync::LOCAL_NOTIFICATION) ? | 2350 details.SetString("source", (source == syncer::LOCAL_NOTIFICATION) ? |
| 2351 "LOCAL_NOTIFICATION" : "REMOTE_NOTIFICATION"); | 2351 "LOCAL_NOTIFICATION" : "REMOTE_NOTIFICATION"); |
| 2352 js_event_handler_.Call(FROM_HERE, | 2352 js_event_handler_.Call(FROM_HERE, |
| 2353 &JsEventHandler::HandleJsEvent, | 2353 &JsEventHandler::HandleJsEvent, |
| 2354 "onIncomingNotification", | 2354 "onIncomingNotification", |
| 2355 JsEventDetails(&details)); | 2355 JsEventDetails(&details)); |
| 2356 } | 2356 } |
| 2357 } | 2357 } |
| 2358 | 2358 |
| 2359 void SyncManager::SyncInternal::AddObserver( | 2359 void SyncManager::SyncInternal::AddObserver( |
| 2360 SyncManager::Observer* observer) { | 2360 SyncManager::Observer* observer) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2394 TimeDelta SyncManager::GetNudgeDelayTimeDelta( | 2394 TimeDelta SyncManager::GetNudgeDelayTimeDelta( |
| 2395 const ModelType& model_type) { | 2395 const ModelType& model_type) { |
| 2396 return data_->GetNudgeDelayTimeDelta(model_type); | 2396 return data_->GetNudgeDelayTimeDelta(model_type); |
| 2397 } | 2397 } |
| 2398 | 2398 |
| 2399 syncable::ModelTypeSet SyncManager::GetEncryptedDataTypesForTest() const { | 2399 syncable::ModelTypeSet SyncManager::GetEncryptedDataTypesForTest() const { |
| 2400 ReadTransaction trans(FROM_HERE, GetUserShare()); | 2400 ReadTransaction trans(FROM_HERE, GetUserShare()); |
| 2401 return GetEncryptedTypes(&trans); | 2401 return GetEncryptedTypes(&trans); |
| 2402 } | 2402 } |
| 2403 | 2403 |
| 2404 bool SyncManager::ReceivedExperiment(csync::Experiments* experiments) | 2404 bool SyncManager::ReceivedExperiment(syncer::Experiments* experiments) |
| 2405 const { | 2405 const { |
| 2406 ReadTransaction trans(FROM_HERE, GetUserShare()); | 2406 ReadTransaction trans(FROM_HERE, GetUserShare()); |
| 2407 ReadNode node(&trans); | 2407 ReadNode node(&trans); |
| 2408 if (node.InitByTagLookup(kNigoriTag) != csync::BaseNode::INIT_OK) { | 2408 if (node.InitByTagLookup(kNigoriTag) != syncer::BaseNode::INIT_OK) { |
| 2409 DVLOG(1) << "Couldn't find Nigori node."; | 2409 DVLOG(1) << "Couldn't find Nigori node."; |
| 2410 return false; | 2410 return false; |
| 2411 } | 2411 } |
| 2412 bool found_experiment = false; | 2412 bool found_experiment = false; |
| 2413 if (node.GetNigoriSpecifics().sync_tab_favicons()) { | 2413 if (node.GetNigoriSpecifics().sync_tab_favicons()) { |
| 2414 experiments->sync_tab_favicons = true; | 2414 experiments->sync_tab_favicons = true; |
| 2415 found_experiment = true; | 2415 found_experiment = true; |
| 2416 } | 2416 } |
| 2417 return found_experiment; | 2417 return found_experiment; |
| 2418 } | 2418 } |
| 2419 | 2419 |
| 2420 bool SyncManager::HasUnsyncedItems() const { | 2420 bool SyncManager::HasUnsyncedItems() const { |
| 2421 csync::ReadTransaction trans(FROM_HERE, GetUserShare()); | 2421 syncer::ReadTransaction trans(FROM_HERE, GetUserShare()); |
| 2422 return (trans.GetWrappedTrans()->directory()->unsynced_entity_count() != 0); | 2422 return (trans.GetWrappedTrans()->directory()->unsynced_entity_count() != 0); |
| 2423 } | 2423 } |
| 2424 | 2424 |
| 2425 void SyncManager::SimulateEnableNotificationsForTest() { | 2425 void SyncManager::SimulateEnableNotificationsForTest() { |
| 2426 DCHECK(thread_checker_.CalledOnValidThread()); | 2426 DCHECK(thread_checker_.CalledOnValidThread()); |
| 2427 data_->OnNotificationsEnabled(); | 2427 data_->OnNotificationsEnabled(); |
| 2428 } | 2428 } |
| 2429 | 2429 |
| 2430 void SyncManager::SimulateDisableNotificationsForTest(int reason) { | 2430 void SyncManager::SimulateDisableNotificationsForTest(int reason) { |
| 2431 DCHECK(thread_checker_.CalledOnValidThread()); | 2431 DCHECK(thread_checker_.CalledOnValidThread()); |
| 2432 data_->OnNotificationsDisabled( | 2432 data_->OnNotificationsDisabled( |
| 2433 static_cast<csync::NotificationsDisabledReason>(reason)); | 2433 static_cast<syncer::NotificationsDisabledReason>(reason)); |
| 2434 } | 2434 } |
| 2435 | 2435 |
| 2436 void SyncManager::TriggerOnIncomingNotificationForTest( | 2436 void SyncManager::TriggerOnIncomingNotificationForTest( |
| 2437 ModelTypeSet model_types) { | 2437 ModelTypeSet model_types) { |
| 2438 DCHECK(thread_checker_.CalledOnValidThread()); | 2438 DCHECK(thread_checker_.CalledOnValidThread()); |
| 2439 syncable::ModelTypePayloadMap model_types_with_payloads = | 2439 syncable::ModelTypePayloadMap model_types_with_payloads = |
| 2440 syncable::ModelTypePayloadMapFromEnumSet(model_types, | 2440 syncable::ModelTypePayloadMapFromEnumSet(model_types, |
| 2441 std::string()); | 2441 std::string()); |
| 2442 | 2442 |
| 2443 data_->OnIncomingNotification(model_types_with_payloads, | 2443 data_->OnIncomingNotification(model_types_with_payloads, |
| 2444 csync::REMOTE_NOTIFICATION); | 2444 syncer::REMOTE_NOTIFICATION); |
| 2445 } | 2445 } |
| 2446 | 2446 |
| 2447 const char* ConnectionStatusToString(ConnectionStatus status) { | 2447 const char* ConnectionStatusToString(ConnectionStatus status) { |
| 2448 switch (status) { | 2448 switch (status) { |
| 2449 case CONNECTION_OK: | 2449 case CONNECTION_OK: |
| 2450 return "CONNECTION_OK"; | 2450 return "CONNECTION_OK"; |
| 2451 case CONNECTION_AUTH_ERROR: | 2451 case CONNECTION_AUTH_ERROR: |
| 2452 return "CONNECTION_AUTH_ERROR"; | 2452 return "CONNECTION_AUTH_ERROR"; |
| 2453 case CONNECTION_SERVER_ERROR: | 2453 case CONNECTION_SERVER_ERROR: |
| 2454 return "CONNECTION_SERVER_ERROR"; | 2454 return "CONNECTION_SERVER_ERROR"; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2469 case REASON_DECRYPTION: | 2469 case REASON_DECRYPTION: |
| 2470 return "REASON_DECRYPTION"; | 2470 return "REASON_DECRYPTION"; |
| 2471 default: | 2471 default: |
| 2472 NOTREACHED(); | 2472 NOTREACHED(); |
| 2473 return "INVALID_REASON"; | 2473 return "INVALID_REASON"; |
| 2474 } | 2474 } |
| 2475 } | 2475 } |
| 2476 | 2476 |
| 2477 // Helper function to determine if initial sync had ended for types. | 2477 // Helper function to determine if initial sync had ended for types. |
| 2478 bool InitialSyncEndedForTypes(syncable::ModelTypeSet types, | 2478 bool InitialSyncEndedForTypes(syncable::ModelTypeSet types, |
| 2479 csync::UserShare* share) { | 2479 syncer::UserShare* share) { |
| 2480 for (syncable::ModelTypeSet::Iterator i = types.First(); | 2480 for (syncable::ModelTypeSet::Iterator i = types.First(); |
| 2481 i.Good(); i.Inc()) { | 2481 i.Good(); i.Inc()) { |
| 2482 if (!share->directory->initial_sync_ended_for_type(i.Get())) | 2482 if (!share->directory->initial_sync_ended_for_type(i.Get())) |
| 2483 return false; | 2483 return false; |
| 2484 } | 2484 } |
| 2485 return true; | 2485 return true; |
| 2486 } | 2486 } |
| 2487 | 2487 |
| 2488 syncable::ModelTypeSet GetTypesWithEmptyProgressMarkerToken( | 2488 syncable::ModelTypeSet GetTypesWithEmptyProgressMarkerToken( |
| 2489 syncable::ModelTypeSet types, | 2489 syncable::ModelTypeSet types, |
| 2490 csync::UserShare* share) { | 2490 syncer::UserShare* share) { |
| 2491 syncable::ModelTypeSet result; | 2491 syncable::ModelTypeSet result; |
| 2492 for (syncable::ModelTypeSet::Iterator i = types.First(); | 2492 for (syncable::ModelTypeSet::Iterator i = types.First(); |
| 2493 i.Good(); i.Inc()) { | 2493 i.Good(); i.Inc()) { |
| 2494 sync_pb::DataTypeProgressMarker marker; | 2494 sync_pb::DataTypeProgressMarker marker; |
| 2495 share->directory->GetDownloadProgress(i.Get(), &marker); | 2495 share->directory->GetDownloadProgress(i.Get(), &marker); |
| 2496 | 2496 |
| 2497 if (marker.token().empty()) | 2497 if (marker.token().empty()) |
| 2498 result.Put(i.Get()); | 2498 result.Put(i.Get()); |
| 2499 | 2499 |
| 2500 } | 2500 } |
| 2501 return result; | 2501 return result; |
| 2502 } | 2502 } |
| 2503 | 2503 |
| 2504 } // namespace csync | 2504 } // namespace syncer |
| OLD | NEW |