Chromium Code Reviews| 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 14 matching lines...) Expand all Loading... | |
| 25 #include "sync/engine/throttled_data_type_tracker.h" | 25 #include "sync/engine/throttled_data_type_tracker.h" |
| 26 #include "sync/internal_api/change_reorder_buffer.h" | 26 #include "sync/internal_api/change_reorder_buffer.h" |
| 27 #include "sync/internal_api/debug_info_event_listener.h" | 27 #include "sync/internal_api/debug_info_event_listener.h" |
| 28 #include "sync/internal_api/js_mutation_event_observer.h" | 28 #include "sync/internal_api/js_mutation_event_observer.h" |
| 29 #include "sync/internal_api/js_sync_manager_observer.h" | 29 #include "sync/internal_api/js_sync_manager_observer.h" |
| 30 #include "sync/internal_api/public/base/model_type.h" | 30 #include "sync/internal_api/public/base/model_type.h" |
| 31 #include "sync/internal_api/public/base/model_type_payload_map.h" | 31 #include "sync/internal_api/public/base/model_type_payload_map.h" |
| 32 #include "sync/internal_api/public/base_node.h" | 32 #include "sync/internal_api/public/base_node.h" |
| 33 #include "sync/internal_api/public/configure_reason.h" | 33 #include "sync/internal_api/public/configure_reason.h" |
| 34 #include "sync/internal_api/public/engine/polling_constants.h" | 34 #include "sync/internal_api/public/engine/polling_constants.h" |
| 35 #include "sync/internal_api/public/internal_components_factory_impl.h" | |
|
Nicolas Zea
2012/07/18 21:10:12
this doesn't need to be the impl does it?
tim (not reviewing)
2012/07/18 21:57:47
Done.
| |
| 35 #include "sync/internal_api/public/read_node.h" | 36 #include "sync/internal_api/public/read_node.h" |
| 36 #include "sync/internal_api/public/read_transaction.h" | 37 #include "sync/internal_api/public/read_transaction.h" |
| 37 #include "sync/internal_api/public/user_share.h" | 38 #include "sync/internal_api/public/user_share.h" |
| 38 #include "sync/internal_api/public/util/experiments.h" | 39 #include "sync/internal_api/public/util/experiments.h" |
| 39 #include "sync/internal_api/public/write_node.h" | 40 #include "sync/internal_api/public/write_node.h" |
| 40 #include "sync/internal_api/public/write_transaction.h" | 41 #include "sync/internal_api/public/write_transaction.h" |
| 41 #include "sync/internal_api/syncapi_internal.h" | 42 #include "sync/internal_api/syncapi_internal.h" |
| 42 #include "sync/internal_api/syncapi_server_connection_manager.h" | 43 #include "sync/internal_api/syncapi_server_connection_manager.h" |
| 43 #include "sync/js/js_arg_list.h" | 44 #include "sync/js/js_arg_list.h" |
| 44 #include "sync/js/js_backend.h" | 45 #include "sync/js/js_backend.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 77 return GetUpdatesCallerInfo::RECONFIGURATION; | 78 return GetUpdatesCallerInfo::RECONFIGURATION; |
| 78 case syncer::CONFIGURE_REASON_MIGRATION: | 79 case syncer::CONFIGURE_REASON_MIGRATION: |
| 79 return GetUpdatesCallerInfo::MIGRATION; | 80 return GetUpdatesCallerInfo::MIGRATION; |
| 80 case syncer::CONFIGURE_REASON_NEW_CLIENT: | 81 case syncer::CONFIGURE_REASON_NEW_CLIENT: |
| 81 return GetUpdatesCallerInfo::NEW_CLIENT; | 82 return GetUpdatesCallerInfo::NEW_CLIENT; |
| 82 case syncer::CONFIGURE_REASON_NEWLY_ENABLED_DATA_TYPE: | 83 case syncer::CONFIGURE_REASON_NEWLY_ENABLED_DATA_TYPE: |
| 83 return GetUpdatesCallerInfo::NEWLY_SUPPORTED_DATATYPE; | 84 return GetUpdatesCallerInfo::NEWLY_SUPPORTED_DATATYPE; |
| 84 default: | 85 default: |
| 85 NOTREACHED(); | 86 NOTREACHED(); |
| 86 } | 87 } |
| 87 | |
| 88 return GetUpdatesCallerInfo::UNKNOWN; | 88 return GetUpdatesCallerInfo::UNKNOWN; |
| 89 } | 89 } |
| 90 | 90 |
| 91 // The maximum number of times we will automatically overwrite the nigori node | 91 // The maximum number of times we will automatically overwrite the nigori node |
| 92 // because the encryption keys don't match (per chrome instantiation). | 92 // because the encryption keys don't match (per chrome instantiation). |
| 93 static const int kNigoriOverwriteLimit = 10; | 93 static const int kNigoriOverwriteLimit = 10; |
| 94 | 94 |
| 95 } // namespace | 95 } // namespace |
| 96 | 96 |
| 97 namespace syncer { | 97 namespace syncer { |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 116 public JsBackend, | 116 public JsBackend, |
| 117 public SyncEngineEventListener, | 117 public SyncEngineEventListener, |
| 118 public ServerConnectionEventListener, | 118 public ServerConnectionEventListener, |
| 119 public syncable::DirectoryChangeDelegate { | 119 public syncable::DirectoryChangeDelegate { |
| 120 public: | 120 public: |
| 121 explicit SyncInternal(const std::string& name) | 121 explicit SyncInternal(const std::string& name) |
| 122 : name_(name), | 122 : name_(name), |
| 123 weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), | 123 weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), |
| 124 change_delegate_(NULL), | 124 change_delegate_(NULL), |
| 125 initialized_(false), | 125 initialized_(false), |
| 126 testing_mode_(NON_TEST), | |
| 127 observing_ip_address_changes_(false), | 126 observing_ip_address_changes_(false), |
| 128 throttled_data_type_tracker_(&allstatus_), | 127 throttled_data_type_tracker_(&allstatus_), |
| 129 traffic_recorder_(kMaxMessagesToRecord, kMaxMessageSizeToRecord), | 128 traffic_recorder_(kMaxMessagesToRecord, kMaxMessageSizeToRecord), |
| 130 encryptor_(NULL), | 129 encryptor_(NULL), |
| 131 unrecoverable_error_handler_(NULL), | 130 unrecoverable_error_handler_(NULL), |
| 132 report_unrecoverable_error_function_(NULL), | 131 report_unrecoverable_error_function_(NULL), |
| 133 created_on_loop_(MessageLoop::current()), | |
| 134 nigori_overwrite_count_(0) { | 132 nigori_overwrite_count_(0) { |
| 135 // Pre-fill |notification_info_map_|. | 133 // Pre-fill |notification_info_map_|. |
| 136 for (int i = syncer::FIRST_REAL_MODEL_TYPE; | 134 for (int i = syncer::FIRST_REAL_MODEL_TYPE; |
| 137 i < syncer::MODEL_TYPE_COUNT; ++i) { | 135 i < syncer::MODEL_TYPE_COUNT; ++i) { |
| 138 notification_info_map_.insert( | 136 notification_info_map_.insert( |
| 139 std::make_pair(syncer::ModelTypeFromInt(i), NotificationInfo())); | 137 std::make_pair(syncer::ModelTypeFromInt(i), NotificationInfo())); |
| 140 } | 138 } |
| 141 | 139 |
| 142 // Bind message handlers. | 140 // Bind message handlers. |
| 143 BindJsMessageHandler( | 141 BindJsMessageHandler( |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 178 const scoped_refptr<base::TaskRunner>& blocking_task_runner, | 176 const scoped_refptr<base::TaskRunner>& blocking_task_runner, |
| 179 HttpPostProviderFactory* post_factory, | 177 HttpPostProviderFactory* post_factory, |
| 180 const syncer::ModelSafeRoutingInfo& model_safe_routing_info, | 178 const syncer::ModelSafeRoutingInfo& model_safe_routing_info, |
| 181 const std::vector<syncer::ModelSafeWorker*>& workers, | 179 const std::vector<syncer::ModelSafeWorker*>& workers, |
| 182 syncer::ExtensionsActivityMonitor* | 180 syncer::ExtensionsActivityMonitor* |
| 183 extensions_activity_monitor, | 181 extensions_activity_monitor, |
| 184 ChangeDelegate* change_delegate, | 182 ChangeDelegate* change_delegate, |
| 185 const SyncCredentials& credentials, | 183 const SyncCredentials& credentials, |
| 186 syncer::SyncNotifier* sync_notifier, | 184 syncer::SyncNotifier* sync_notifier, |
| 187 const std::string& restored_key_for_bootstrapping, | 185 const std::string& restored_key_for_bootstrapping, |
| 188 TestingMode testing_mode, | 186 scoped_ptr<InternalComponentsFactory> internal_components_factory, |
|
Nicolas Zea
2012/07/18 21:10:12
see comment in SBH about whether this should take
| |
| 189 Encryptor* encryptor, | 187 Encryptor* encryptor, |
| 190 UnrecoverableErrorHandler* unrecoverable_error_handler, | 188 UnrecoverableErrorHandler* unrecoverable_error_handler, |
| 191 ReportUnrecoverableErrorFunction | 189 ReportUnrecoverableErrorFunction |
| 192 report_unrecoverable_error_function); | 190 report_unrecoverable_error_function); |
| 193 | 191 |
| 194 // Sign into sync with given credentials. | 192 // Sign into sync with given credentials. |
| 195 // We do not verify the tokens given. After this call, the tokens are set | 193 // We do not verify the tokens given. After this call, the tokens are set |
| 196 // and the sync DB is open. True if successful, false if something | 194 // and the sync DB is open. True if successful, false if something |
| 197 // went wrong. | 195 // went wrong. |
| 198 bool SignIn(const SyncCredentials& credentials); | 196 bool SignIn(const SyncCredentials& credentials); |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 580 // forwarded to the observer slightly later, at the TRANSACTION_ENDING | 578 // forwarded to the observer slightly later, at the TRANSACTION_ENDING |
| 581 // step by HandleTransactionEndingChangeEvent. The list is cleared in the | 579 // step by HandleTransactionEndingChangeEvent. The list is cleared in the |
| 582 // TRANSACTION_COMPLETE step by HandleTransactionCompleteChangeEvent. | 580 // TRANSACTION_COMPLETE step by HandleTransactionCompleteChangeEvent. |
| 583 ChangeReorderBuffer change_buffers_[syncer::MODEL_TYPE_COUNT]; | 581 ChangeReorderBuffer change_buffers_[syncer::MODEL_TYPE_COUNT]; |
| 584 | 582 |
| 585 SyncManager::ChangeDelegate* change_delegate_; | 583 SyncManager::ChangeDelegate* change_delegate_; |
| 586 | 584 |
| 587 // Set to true once Init has been called. | 585 // Set to true once Init has been called. |
| 588 bool initialized_; | 586 bool initialized_; |
| 589 | 587 |
| 590 // Controls the disabling of certain SyncManager features. | |
| 591 // Can be used to disable communication with the server and the use of an | |
| 592 // on-disk file for maintaining syncer state. | |
| 593 // TODO(117836): Clean up implementation of SyncManager unit tests. | |
| 594 TestingMode testing_mode_; | |
| 595 | |
| 596 bool observing_ip_address_changes_; | 588 bool observing_ip_address_changes_; |
| 597 | 589 |
| 598 // Map used to store the notification info to be displayed in | 590 // Map used to store the notification info to be displayed in |
| 599 // about:sync page. | 591 // about:sync page. |
| 600 NotificationInfoMap notification_info_map_; | 592 NotificationInfoMap notification_info_map_; |
| 601 | 593 |
| 602 // These are for interacting with chrome://sync-internals. | 594 // These are for interacting with chrome://sync-internals. |
| 603 JsMessageHandlerMap js_message_handlers_; | 595 JsMessageHandlerMap js_message_handlers_; |
| 604 WeakHandle<JsEventHandler> js_event_handler_; | 596 WeakHandle<JsEventHandler> js_event_handler_; |
| 605 JsSyncManagerObserver js_sync_manager_observer_; | 597 JsSyncManagerObserver js_sync_manager_observer_; |
| 606 JsMutationEventObserver js_mutation_event_observer_; | 598 JsMutationEventObserver js_mutation_event_observer_; |
| 607 | 599 |
| 608 syncer::ThrottledDataTypeTracker throttled_data_type_tracker_; | 600 syncer::ThrottledDataTypeTracker throttled_data_type_tracker_; |
| 609 | 601 |
| 610 // This is for keeping track of client events to send to the server. | 602 // This is for keeping track of client events to send to the server. |
| 611 DebugInfoEventListener debug_info_event_listener_; | 603 DebugInfoEventListener debug_info_event_listener_; |
| 612 | 604 |
| 613 syncer::TrafficRecorder traffic_recorder_; | 605 syncer::TrafficRecorder traffic_recorder_; |
| 614 | 606 |
| 615 Encryptor* encryptor_; | 607 Encryptor* encryptor_; |
| 616 UnrecoverableErrorHandler* unrecoverable_error_handler_; | 608 UnrecoverableErrorHandler* unrecoverable_error_handler_; |
| 617 ReportUnrecoverableErrorFunction report_unrecoverable_error_function_; | 609 ReportUnrecoverableErrorFunction report_unrecoverable_error_function_; |
| 618 | 610 |
| 619 MessageLoop* const created_on_loop_; | |
| 620 | |
| 621 // The number of times we've automatically (i.e. not via SetPassphrase or | 611 // The number of times we've automatically (i.e. not via SetPassphrase or |
| 622 // conflict resolver) updated the nigori's encryption keys in this chrome | 612 // conflict resolver) updated the nigori's encryption keys in this chrome |
| 623 // instantiation. | 613 // instantiation. |
| 624 int nigori_overwrite_count_; | 614 int nigori_overwrite_count_; |
| 625 }; | 615 }; |
| 626 | 616 |
| 627 // A class to calculate nudge delays for types. | 617 // A class to calculate nudge delays for types. |
| 628 class NudgeStrategy { | 618 class NudgeStrategy { |
| 629 public: | 619 public: |
| 630 static TimeDelta GetNudgeDelayTimeDelta(const ModelType& model_type, | 620 static TimeDelta GetNudgeDelayTimeDelta(const ModelType& model_type, |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 715 bool use_ssl, | 705 bool use_ssl, |
| 716 const scoped_refptr<base::TaskRunner>& blocking_task_runner, | 706 const scoped_refptr<base::TaskRunner>& blocking_task_runner, |
| 717 HttpPostProviderFactory* post_factory, | 707 HttpPostProviderFactory* post_factory, |
| 718 const syncer::ModelSafeRoutingInfo& model_safe_routing_info, | 708 const syncer::ModelSafeRoutingInfo& model_safe_routing_info, |
| 719 const std::vector<syncer::ModelSafeWorker*>& workers, | 709 const std::vector<syncer::ModelSafeWorker*>& workers, |
| 720 syncer::ExtensionsActivityMonitor* extensions_activity_monitor, | 710 syncer::ExtensionsActivityMonitor* extensions_activity_monitor, |
| 721 ChangeDelegate* change_delegate, | 711 ChangeDelegate* change_delegate, |
| 722 const SyncCredentials& credentials, | 712 const SyncCredentials& credentials, |
| 723 syncer::SyncNotifier* sync_notifier, | 713 syncer::SyncNotifier* sync_notifier, |
| 724 const std::string& restored_key_for_bootstrapping, | 714 const std::string& restored_key_for_bootstrapping, |
| 725 TestingMode testing_mode, | 715 scoped_ptr<InternalComponentsFactory> internal_components_factory, |
| 726 Encryptor* encryptor, | 716 Encryptor* encryptor, |
| 727 UnrecoverableErrorHandler* unrecoverable_error_handler, | 717 UnrecoverableErrorHandler* unrecoverable_error_handler, |
| 728 ReportUnrecoverableErrorFunction report_unrecoverable_error_function) { | 718 ReportUnrecoverableErrorFunction report_unrecoverable_error_function) { |
| 729 DCHECK(thread_checker_.CalledOnValidThread()); | 719 DCHECK(thread_checker_.CalledOnValidThread()); |
| 730 DCHECK(post_factory); | 720 DCHECK(post_factory); |
| 731 DVLOG(1) << "SyncManager starting Init..."; | 721 DVLOG(1) << "SyncManager starting Init..."; |
| 732 std::string server_string(sync_server_and_path); | 722 std::string server_string(sync_server_and_path); |
| 733 return data_->Init(database_location, | 723 return data_->Init(database_location, |
| 734 event_handler, | 724 event_handler, |
| 735 server_string, | 725 server_string, |
| 736 sync_server_port, | 726 sync_server_port, |
| 737 use_ssl, | 727 use_ssl, |
| 738 blocking_task_runner, | 728 blocking_task_runner, |
| 739 post_factory, | 729 post_factory, |
| 740 model_safe_routing_info, | 730 model_safe_routing_info, |
| 741 workers, | 731 workers, |
| 742 extensions_activity_monitor, | 732 extensions_activity_monitor, |
| 743 change_delegate, | 733 change_delegate, |
| 744 credentials, | 734 credentials, |
| 745 sync_notifier, | 735 sync_notifier, |
| 746 restored_key_for_bootstrapping, | 736 restored_key_for_bootstrapping, |
| 747 testing_mode, | 737 internal_components_factory.Pass(), |
| 748 encryptor, | 738 encryptor, |
| 749 unrecoverable_error_handler, | 739 unrecoverable_error_handler, |
| 750 report_unrecoverable_error_function); | 740 report_unrecoverable_error_function); |
| 751 } | 741 } |
| 752 | 742 |
| 753 void SyncManager::UpdateCredentials(const SyncCredentials& credentials) { | 743 void SyncManager::UpdateCredentials(const SyncCredentials& credentials) { |
| 754 DCHECK(thread_checker_.CalledOnValidThread()); | 744 DCHECK(thread_checker_.CalledOnValidThread()); |
| 755 data_->UpdateCredentials(credentials); | 745 data_->UpdateCredentials(credentials); |
| 756 } | 746 } |
| 757 | 747 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 867 bool use_ssl, | 857 bool use_ssl, |
| 868 const scoped_refptr<base::TaskRunner>& blocking_task_runner, | 858 const scoped_refptr<base::TaskRunner>& blocking_task_runner, |
| 869 HttpPostProviderFactory* post_factory, | 859 HttpPostProviderFactory* post_factory, |
| 870 const syncer::ModelSafeRoutingInfo& model_safe_routing_info, | 860 const syncer::ModelSafeRoutingInfo& model_safe_routing_info, |
| 871 const std::vector<syncer::ModelSafeWorker*>& workers, | 861 const std::vector<syncer::ModelSafeWorker*>& workers, |
| 872 syncer::ExtensionsActivityMonitor* extensions_activity_monitor, | 862 syncer::ExtensionsActivityMonitor* extensions_activity_monitor, |
| 873 ChangeDelegate* change_delegate, | 863 ChangeDelegate* change_delegate, |
| 874 const SyncCredentials& credentials, | 864 const SyncCredentials& credentials, |
| 875 syncer::SyncNotifier* sync_notifier, | 865 syncer::SyncNotifier* sync_notifier, |
| 876 const std::string& restored_key_for_bootstrapping, | 866 const std::string& restored_key_for_bootstrapping, |
| 877 TestingMode testing_mode, | 867 scoped_ptr<InternalComponentsFactory> internal_components_factory, |
| 878 Encryptor* encryptor, | 868 Encryptor* encryptor, |
| 879 UnrecoverableErrorHandler* unrecoverable_error_handler, | 869 UnrecoverableErrorHandler* unrecoverable_error_handler, |
| 880 ReportUnrecoverableErrorFunction report_unrecoverable_error_function) { | 870 ReportUnrecoverableErrorFunction report_unrecoverable_error_function) { |
| 881 CHECK(!initialized_); | 871 CHECK(!initialized_); |
| 882 | 872 |
| 883 DCHECK(thread_checker_.CalledOnValidThread()); | 873 DCHECK(thread_checker_.CalledOnValidThread()); |
| 884 | 874 |
| 885 DVLOG(1) << "Starting SyncInternal initialization."; | 875 DVLOG(1) << "Starting SyncInternal initialization."; |
| 886 | 876 |
| 887 weak_handle_this_ = MakeWeakHandle(weak_ptr_factory_.GetWeakPtr()); | 877 weak_handle_this_ = MakeWeakHandle(weak_ptr_factory_.GetWeakPtr()); |
| 888 | 878 |
| 889 blocking_task_runner_ = blocking_task_runner; | 879 blocking_task_runner_ = blocking_task_runner; |
| 890 | 880 |
| 891 change_delegate_ = change_delegate; | 881 change_delegate_ = change_delegate; |
| 892 testing_mode_ = testing_mode; | |
| 893 | 882 |
| 894 sync_notifier_.reset(sync_notifier); | 883 sync_notifier_.reset(sync_notifier); |
| 895 | 884 |
| 896 AddObserver(&js_sync_manager_observer_); | 885 AddObserver(&js_sync_manager_observer_); |
| 897 SetJsEventHandler(event_handler); | 886 SetJsEventHandler(event_handler); |
| 898 | 887 |
| 899 AddObserver(&debug_info_event_listener_); | 888 AddObserver(&debug_info_event_listener_); |
| 900 | 889 |
| 901 database_path_ = database_location.Append( | 890 database_path_ = database_location.Append( |
| 902 syncable::Directory::kSyncDatabaseFilename); | 891 syncable::Directory::kSyncDatabaseFilename); |
| 903 encryptor_ = encryptor; | 892 encryptor_ = encryptor; |
| 904 unrecoverable_error_handler_ = unrecoverable_error_handler; | 893 unrecoverable_error_handler_ = unrecoverable_error_handler; |
| 905 report_unrecoverable_error_function_ = report_unrecoverable_error_function; | 894 report_unrecoverable_error_function_ = report_unrecoverable_error_function; |
| 906 | 895 |
| 907 syncable::DirectoryBackingStore* backing_store = NULL; | 896 FilePath absolute_db_path(database_path_); |
| 908 if (testing_mode_ == TEST_IN_MEMORY) { | 897 file_util::AbsolutePath(&absolute_db_path); |
| 909 // TODO(tim): 117836. Use a factory or delegate to create this and don't | 898 syncable::DirectoryBackingStore* backing_store = |
| 910 // depend on TEST_IN_MEMORY here. | 899 internal_components_factory->BuildDirectoryBackingStore( |
| 911 backing_store = | 900 credentials.email, absolute_db_path); |
| 912 new syncable::InMemoryDirectoryBackingStore(credentials.email); | |
| 913 } else { | |
| 914 FilePath absolute_db_path(database_path_); | |
| 915 file_util::AbsolutePath(&absolute_db_path); | |
| 916 backing_store = new syncable::OnDiskDirectoryBackingStore( | |
| 917 credentials.email, absolute_db_path); | |
| 918 } | |
| 919 | 901 |
| 920 DCHECK(backing_store); | 902 DCHECK(backing_store); |
| 921 share_.directory.reset( | 903 share_.directory.reset( |
| 922 new syncable::Directory(encryptor_, | 904 new syncable::Directory(encryptor_, |
| 923 unrecoverable_error_handler_, | 905 unrecoverable_error_handler_, |
| 924 report_unrecoverable_error_function_, | 906 report_unrecoverable_error_function_, |
| 925 backing_store)); | 907 backing_store)); |
| 926 | 908 |
| 927 connection_manager_.reset(new SyncAPIServerConnectionManager( | 909 connection_manager_.reset(new SyncAPIServerConnectionManager( |
| 928 sync_server_and_path, port, use_ssl, post_factory)); | 910 sync_server_and_path, port, use_ssl, post_factory)); |
| 929 | 911 |
| 930 net::NetworkChangeNotifier::AddIPAddressObserver(this); | 912 net::NetworkChangeNotifier::AddIPAddressObserver(this); |
| 931 observing_ip_address_changes_ = true; | 913 observing_ip_address_changes_ = true; |
| 932 | 914 |
| 933 connection_manager()->AddListener(this); | 915 connection_manager()->AddListener(this); |
| 934 | 916 |
| 935 // Test mode does not use a syncer context or syncer thread. | 917 // Build a SyncSessionContext and store the worker in it. |
| 936 if (testing_mode_ == NON_TEST) { | 918 DVLOG(1) << "Sync is bringing up SyncSessionContext."; |
| 937 // Build a SyncSessionContext and store the worker in it. | 919 std::vector<SyncEngineEventListener*> listeners; |
| 938 DVLOG(1) << "Sync is bringing up SyncSessionContext."; | 920 listeners.push_back(&allstatus_); |
| 939 std::vector<SyncEngineEventListener*> listeners; | 921 listeners.push_back(this); |
| 940 listeners.push_back(&allstatus_); | 922 session_context_.reset(internal_components_factory->BuildContext( |
| 941 listeners.push_back(this); | 923 connection_manager_.get(), |
| 942 session_context_.reset(new SyncSessionContext( | 924 directory(), |
| 943 connection_manager_.get(), | 925 model_safe_routing_info, |
| 944 directory(), | 926 workers, |
| 945 model_safe_routing_info, | 927 extensions_activity_monitor, |
| 946 workers, | 928 &throttled_data_type_tracker_, |
| 947 extensions_activity_monitor, | 929 listeners, |
| 948 &throttled_data_type_tracker_, | 930 &debug_info_event_listener_, |
| 949 listeners, | 931 &traffic_recorder_)); |
| 950 &debug_info_event_listener_, | 932 session_context()->set_account_name(credentials.email); |
| 951 &traffic_recorder_)); | 933 scheduler_.reset(internal_components_factory->BuildScheduler( |
| 952 session_context()->set_account_name(credentials.email); | 934 name_, session_context())); |
| 953 scheduler_.reset(new SyncScheduler(name_, session_context(), new Syncer())); | |
| 954 } | |
| 955 | 935 |
| 956 bool success = SignIn(credentials); | 936 bool success = SignIn(credentials); |
| 957 | 937 |
| 958 if (success) { | 938 if (success) { |
| 959 if (scheduler()) { | 939 scheduler()->Start(syncer::SyncScheduler::CONFIGURATION_MODE); |
| 960 scheduler()->Start(syncer::SyncScheduler::CONFIGURATION_MODE); | |
| 961 } | |
| 962 | 940 |
| 963 initialized_ = true; | 941 initialized_ = true; |
| 964 | 942 |
| 965 // Unapplied datatypes (those that do not have initial sync ended set) get | 943 // Unapplied datatypes (those that do not have initial sync ended set) get |
| 966 // re-downloaded during any configuration. But, it's possible for a datatype | 944 // re-downloaded during any configuration. But, it's possible for a datatype |
| 967 // to have a progress marker but not have initial sync ended yet, making | 945 // to have a progress marker but not have initial sync ended yet, making |
| 968 // it a candidate for migration. This is a problem, as the DataTypeManager | 946 // it a candidate for migration. This is a problem, as the DataTypeManager |
| 969 // does not support a migration while it's already in the middle of a | 947 // does not support a migration while it's already in the middle of a |
| 970 // configuration. As a result, any partially synced datatype can stall the | 948 // configuration. As a result, any partially synced datatype can stall the |
| 971 // DTM, waiting for the configuration to complete, which it never will due | 949 // DTM, waiting for the configuration to complete, which it never will due |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 987 | 965 |
| 988 // Notify that initialization is complete. Note: This should be the last to | 966 // Notify that initialization is complete. Note: This should be the last to |
| 989 // execute if |signed_in| is false. Reason being in that case we would | 967 // execute if |signed_in| is false. Reason being in that case we would |
| 990 // post a task to shutdown sync. But if this function posts any other tasks | 968 // post a task to shutdown sync. But if this function posts any other tasks |
| 991 // on the UI thread and if shutdown wins then that tasks would execute on | 969 // on the UI thread and if shutdown wins then that tasks would execute on |
| 992 // a freed pointer. This is because UI thread is not shut down. | 970 // a freed pointer. This is because UI thread is not shut down. |
| 993 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, | 971 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, |
| 994 OnInitializationComplete( | 972 OnInitializationComplete( |
| 995 MakeWeakHandle(weak_ptr_factory_.GetWeakPtr()), | 973 MakeWeakHandle(weak_ptr_factory_.GetWeakPtr()), |
| 996 success)); | 974 success)); |
| 997 | 975 if (!success) |
| 998 if (!success && testing_mode_ == NON_TEST) | |
| 999 return false; | 976 return false; |
| 1000 | 977 |
| 1001 sync_notifier_->AddObserver(this); | 978 sync_notifier_->AddObserver(this); |
| 1002 | 979 |
| 1003 return success; | 980 return success; |
| 1004 } | 981 } |
| 1005 | 982 |
| 1006 void SyncManager::SyncInternal::UpdateCryptographerAndNigori( | 983 void SyncManager::SyncInternal::UpdateCryptographerAndNigori( |
| 1007 const std::string& chrome_version, | 984 const std::string& chrome_version, |
| 1008 const base::Closure& done_callback) { | 985 const base::Closure& done_callback) { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1070 Cryptographer::UpdateResult result = cryptographer->Update(nigori); | 1047 Cryptographer::UpdateResult result = cryptographer->Update(nigori); |
| 1071 if (result == Cryptographer::NEEDS_PASSPHRASE) { | 1048 if (result == Cryptographer::NEEDS_PASSPHRASE) { |
| 1072 sync_pb::EncryptedData pending_keys; | 1049 sync_pb::EncryptedData pending_keys; |
| 1073 if (cryptographer->has_pending_keys()) | 1050 if (cryptographer->has_pending_keys()) |
| 1074 pending_keys = cryptographer->GetPendingKeys(); | 1051 pending_keys = cryptographer->GetPendingKeys(); |
| 1075 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, | 1052 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, |
| 1076 OnPassphraseRequired(syncer::REASON_DECRYPTION, | 1053 OnPassphraseRequired(syncer::REASON_DECRYPTION, |
| 1077 pending_keys)); | 1054 pending_keys)); |
| 1078 } | 1055 } |
| 1079 | 1056 |
| 1080 | |
| 1081 // Add or update device information. | 1057 // Add or update device information. |
| 1082 bool contains_this_device = false; | 1058 bool contains_this_device = false; |
| 1083 for (int i = 0; i < nigori.device_information_size(); ++i) { | 1059 for (int i = 0; i < nigori.device_information_size(); ++i) { |
| 1084 const sync_pb::DeviceInformation& device_information = | 1060 const sync_pb::DeviceInformation& device_information = |
| 1085 nigori.device_information(i); | 1061 nigori.device_information(i); |
| 1086 if (device_information.cache_guid() == directory()->cache_guid()) { | 1062 if (device_information.cache_guid() == directory()->cache_guid()) { |
| 1087 // Update the version number in case it changed due to an update. | 1063 // Update the version number in case it changed due to an update. |
| 1088 if (device_information.chrome_version() != chrome_version) { | 1064 if (device_information.chrome_version() != chrome_version) { |
| 1089 sync_pb::DeviceInformation* mutable_device_information = | 1065 sync_pb::DeviceInformation* mutable_device_information = |
| 1090 nigori.mutable_device_information(i); | 1066 nigori.mutable_device_information(i); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1138 allstatus_.SetCryptographerReady(cryptographer->is_ready()); | 1114 allstatus_.SetCryptographerReady(cryptographer->is_ready()); |
| 1139 allstatus_.SetCryptoHasPendingKeys(cryptographer->has_pending_keys()); | 1115 allstatus_.SetCryptoHasPendingKeys(cryptographer->has_pending_keys()); |
| 1140 debug_info_event_listener_.SetCryptographerReady(cryptographer->is_ready()); | 1116 debug_info_event_listener_.SetCryptographerReady(cryptographer->is_ready()); |
| 1141 debug_info_event_listener_.SetCrytographerHasPendingKeys( | 1117 debug_info_event_listener_.SetCrytographerHasPendingKeys( |
| 1142 cryptographer->has_pending_keys()); | 1118 cryptographer->has_pending_keys()); |
| 1143 } | 1119 } |
| 1144 | 1120 |
| 1145 void SyncManager::SyncInternal::StartSyncingNormally( | 1121 void SyncManager::SyncInternal::StartSyncingNormally( |
| 1146 const syncer::ModelSafeRoutingInfo& routing_info) { | 1122 const syncer::ModelSafeRoutingInfo& routing_info) { |
| 1147 // Start the sync scheduler. | 1123 // Start the sync scheduler. |
| 1148 if (scheduler()) { // NULL during certain unittests. | 1124 // TODO(sync): We always want the newest set of routes when we switch back |
| 1149 // TODO(sync): We always want the newest set of routes when we switch back | 1125 // to normal mode. Figure out how to enforce set_routing_info is always |
| 1150 // to normal mode. Figure out how to enforce set_routing_info is always | 1126 // appropriately set and that it's only modified when switching to normal |
| 1151 // appropriately set and that it's only modified when switching to normal | 1127 // mode. |
| 1152 // mode. | 1128 session_context()->set_routing_info(routing_info); |
| 1153 session_context()->set_routing_info(routing_info); | 1129 scheduler()->Start(SyncScheduler::NORMAL_MODE); |
| 1154 scheduler()->Start(SyncScheduler::NORMAL_MODE); | |
| 1155 } | |
| 1156 } | 1130 } |
| 1157 | 1131 |
| 1158 bool SyncManager::SyncInternal::OpenDirectory() { | 1132 bool SyncManager::SyncInternal::OpenDirectory() { |
| 1159 DCHECK(!initialized_) << "Should only happen once"; | 1133 DCHECK(!initialized_) << "Should only happen once"; |
| 1160 | 1134 |
| 1161 // Set before Open(). | 1135 // Set before Open(). |
| 1162 change_observer_ = | 1136 change_observer_ = |
| 1163 syncer::MakeWeakHandle(js_mutation_event_observer_.AsWeakPtr()); | 1137 syncer::MakeWeakHandle(js_mutation_event_observer_.AsWeakPtr()); |
| 1164 WeakHandle<syncable::TransactionObserver> transaction_observer( | 1138 WeakHandle<syncable::TransactionObserver> transaction_observer( |
| 1165 syncer::MakeWeakHandle(js_mutation_event_observer_.AsWeakPtr())); | 1139 syncer::MakeWeakHandle(js_mutation_event_observer_.AsWeakPtr())); |
| (...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1687 data_->RemoveObserver(observer); | 1661 data_->RemoveObserver(observer); |
| 1688 } | 1662 } |
| 1689 | 1663 |
| 1690 void SyncManager::StopSyncingForShutdown(const base::Closure& callback) { | 1664 void SyncManager::StopSyncingForShutdown(const base::Closure& callback) { |
| 1691 data_->StopSyncingForShutdown(callback); | 1665 data_->StopSyncingForShutdown(callback); |
| 1692 } | 1666 } |
| 1693 | 1667 |
| 1694 void SyncManager::SyncInternal::StopSyncingForShutdown( | 1668 void SyncManager::SyncInternal::StopSyncingForShutdown( |
| 1695 const base::Closure& callback) { | 1669 const base::Closure& callback) { |
| 1696 DVLOG(2) << "StopSyncingForShutdown"; | 1670 DVLOG(2) << "StopSyncingForShutdown"; |
| 1697 if (scheduler()) // May be null in tests. | 1671 scheduler()->RequestStop(callback); |
| 1698 scheduler()->RequestStop(callback); | |
| 1699 else | |
| 1700 created_on_loop_->PostTask(FROM_HERE, callback); | |
| 1701 | |
| 1702 if (connection_manager_.get()) | 1672 if (connection_manager_.get()) |
| 1703 connection_manager_->TerminateAllIO(); | 1673 connection_manager_->TerminateAllIO(); |
| 1704 } | 1674 } |
| 1705 | 1675 |
| 1706 void SyncManager::ShutdownOnSyncThread() { | 1676 void SyncManager::ShutdownOnSyncThread() { |
| 1707 DCHECK(thread_checker_.CalledOnValidThread()); | 1677 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1708 data_->ShutdownOnSyncThread(); | 1678 data_->ShutdownOnSyncThread(); |
| 1709 } | 1679 } |
| 1710 | 1680 |
| 1711 void SyncManager::SyncInternal::ShutdownOnSyncThread() { | 1681 void SyncManager::SyncInternal::ShutdownOnSyncThread() { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1764 if (!observing_ip_address_changes_) { | 1734 if (!observing_ip_address_changes_) { |
| 1765 DVLOG(1) << "IP address change dropped."; | 1735 DVLOG(1) << "IP address change dropped."; |
| 1766 return; | 1736 return; |
| 1767 } | 1737 } |
| 1768 | 1738 |
| 1769 OnIPAddressChangedImpl(); | 1739 OnIPAddressChangedImpl(); |
| 1770 } | 1740 } |
| 1771 | 1741 |
| 1772 void SyncManager::SyncInternal::OnIPAddressChangedImpl() { | 1742 void SyncManager::SyncInternal::OnIPAddressChangedImpl() { |
| 1773 DCHECK(thread_checker_.CalledOnValidThread()); | 1743 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1774 if (scheduler()) | 1744 scheduler()->OnConnectionStatusChange(); |
| 1775 scheduler()->OnConnectionStatusChange(); | |
| 1776 } | 1745 } |
| 1777 | 1746 |
| 1778 void SyncManager::SyncInternal::OnServerConnectionEvent( | 1747 void SyncManager::SyncInternal::OnServerConnectionEvent( |
| 1779 const ServerConnectionEvent& event) { | 1748 const ServerConnectionEvent& event) { |
| 1780 DCHECK(thread_checker_.CalledOnValidThread()); | 1749 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1781 if (event.connection_code == | 1750 if (event.connection_code == |
| 1782 syncer::HttpResponse::SERVER_CONNECTION_OK) { | 1751 syncer::HttpResponse::SERVER_CONNECTION_OK) { |
| 1783 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, | 1752 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, |
| 1784 OnConnectionStatusChange(CONNECTION_OK)); | 1753 OnConnectionStatusChange(CONNECTION_OK)); |
| 1785 } | 1754 } |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1972 it->second.original, existed_before, exists_now); | 1941 it->second.original, existed_before, exists_now); |
| 1973 } | 1942 } |
| 1974 } | 1943 } |
| 1975 | 1944 |
| 1976 SyncStatus SyncManager::SyncInternal::GetStatus() { | 1945 SyncStatus SyncManager::SyncInternal::GetStatus() { |
| 1977 return allstatus_.status(); | 1946 return allstatus_.status(); |
| 1978 } | 1947 } |
| 1979 | 1948 |
| 1980 void SyncManager::SyncInternal::RequestNudge( | 1949 void SyncManager::SyncInternal::RequestNudge( |
| 1981 const tracked_objects::Location& location) { | 1950 const tracked_objects::Location& location) { |
| 1982 if (scheduler()) { | 1951 scheduler()->ScheduleNudgeAsync( |
| 1983 scheduler()->ScheduleNudgeAsync( | 1952 TimeDelta::FromMilliseconds(0), syncer::NUDGE_SOURCE_LOCAL, |
| 1984 TimeDelta::FromMilliseconds(0), syncer::NUDGE_SOURCE_LOCAL, | 1953 ModelTypeSet(), location); |
| 1985 ModelTypeSet(), location); | |
| 1986 } | |
| 1987 } | 1954 } |
| 1988 | 1955 |
| 1989 TimeDelta SyncManager::SyncInternal::GetNudgeDelayTimeDelta( | 1956 TimeDelta SyncManager::SyncInternal::GetNudgeDelayTimeDelta( |
| 1990 const ModelType& model_type) { | 1957 const ModelType& model_type) { |
| 1991 return NudgeStrategy::GetNudgeDelayTimeDelta(model_type, this); | 1958 return NudgeStrategy::GetNudgeDelayTimeDelta(model_type, this); |
| 1992 } | 1959 } |
| 1993 | 1960 |
| 1994 void SyncManager::SyncInternal::RequestNudgeForDataTypes( | 1961 void SyncManager::SyncInternal::RequestNudgeForDataTypes( |
| 1995 const tracked_objects::Location& nudge_location, | 1962 const tracked_objects::Location& nudge_location, |
| 1996 ModelTypeSet types) { | 1963 ModelTypeSet types) { |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2304 it != type_payloads.end(); ++it) { | 2271 it != type_payloads.end(); ++it) { |
| 2305 NotificationInfo* info = ¬ification_info_map_[it->first]; | 2272 NotificationInfo* info = ¬ification_info_map_[it->first]; |
| 2306 info->total_count++; | 2273 info->total_count++; |
| 2307 info->payload = it->second; | 2274 info->payload = it->second; |
| 2308 } | 2275 } |
| 2309 } | 2276 } |
| 2310 | 2277 |
| 2311 void SyncManager::SyncInternal::OnNotificationsEnabled() { | 2278 void SyncManager::SyncInternal::OnNotificationsEnabled() { |
| 2312 DVLOG(1) << "Notifications enabled"; | 2279 DVLOG(1) << "Notifications enabled"; |
| 2313 allstatus_.SetNotificationsEnabled(true); | 2280 allstatus_.SetNotificationsEnabled(true); |
| 2314 if (scheduler()) { | 2281 scheduler()->SetNotificationsEnabled(true); |
| 2315 scheduler()->set_notifications_enabled(true); | 2282 |
| 2316 } | |
| 2317 // TODO(akalin): Separate onNotificationStateChange into | 2283 // TODO(akalin): Separate onNotificationStateChange into |
| 2318 // enabled/disabled events. | 2284 // enabled/disabled events. |
| 2319 if (js_event_handler_.IsInitialized()) { | 2285 if (js_event_handler_.IsInitialized()) { |
| 2320 DictionaryValue details; | 2286 DictionaryValue details; |
| 2321 details.Set("enabled", Value::CreateBooleanValue(true)); | 2287 details.Set("enabled", Value::CreateBooleanValue(true)); |
| 2322 js_event_handler_.Call(FROM_HERE, | 2288 js_event_handler_.Call(FROM_HERE, |
| 2323 &JsEventHandler::HandleJsEvent, | 2289 &JsEventHandler::HandleJsEvent, |
| 2324 "onNotificationStateChange", | 2290 "onNotificationStateChange", |
| 2325 JsEventDetails(&details)); | 2291 JsEventDetails(&details)); |
| 2326 } | 2292 } |
| 2327 } | 2293 } |
| 2328 | 2294 |
| 2329 void SyncManager::SyncInternal::OnNotificationsDisabled( | 2295 void SyncManager::SyncInternal::OnNotificationsDisabled( |
| 2330 syncer::NotificationsDisabledReason reason) { | 2296 syncer::NotificationsDisabledReason reason) { |
| 2331 DVLOG(1) << "Notifications disabled with reason " | 2297 DVLOG(1) << "Notifications disabled with reason " |
| 2332 << syncer::NotificationsDisabledReasonToString(reason); | 2298 << syncer::NotificationsDisabledReasonToString(reason); |
| 2333 allstatus_.SetNotificationsEnabled(false); | 2299 allstatus_.SetNotificationsEnabled(false); |
| 2334 if (scheduler()) { | 2300 scheduler()->SetNotificationsEnabled(false); |
| 2335 scheduler()->set_notifications_enabled(false); | |
| 2336 } | |
| 2337 if (js_event_handler_.IsInitialized()) { | 2301 if (js_event_handler_.IsInitialized()) { |
| 2338 DictionaryValue details; | 2302 DictionaryValue details; |
| 2339 details.Set("enabled", Value::CreateBooleanValue(false)); | 2303 details.Set("enabled", Value::CreateBooleanValue(false)); |
| 2340 js_event_handler_.Call(FROM_HERE, | 2304 js_event_handler_.Call(FROM_HERE, |
| 2341 &JsEventHandler::HandleJsEvent, | 2305 &JsEventHandler::HandleJsEvent, |
| 2342 "onNotificationStateChange", | 2306 "onNotificationStateChange", |
| 2343 JsEventDetails(&details)); | 2307 JsEventDetails(&details)); |
| 2344 } | 2308 } |
| 2345 // TODO(akalin): Treat a CREDENTIALS_REJECTED state as an auth | 2309 // TODO(akalin): Treat a CREDENTIALS_REJECTED state as an auth |
| 2346 // error. | 2310 // error. |
| 2347 } | 2311 } |
| 2348 | 2312 |
| 2349 void SyncManager::SyncInternal::OnIncomingNotification( | 2313 void SyncManager::SyncInternal::OnIncomingNotification( |
| 2350 const syncer::ModelTypePayloadMap& type_payloads, | 2314 const syncer::ModelTypePayloadMap& type_payloads, |
| 2351 syncer::IncomingNotificationSource source) { | 2315 syncer::IncomingNotificationSource source) { |
| 2352 DCHECK(thread_checker_.CalledOnValidThread()); | 2316 DCHECK(thread_checker_.CalledOnValidThread()); |
| 2353 if (source == syncer::LOCAL_NOTIFICATION) { | 2317 if (source == syncer::LOCAL_NOTIFICATION) { |
| 2354 if (scheduler()) { | 2318 scheduler()->ScheduleNudgeWithPayloadsAsync( |
| 2355 scheduler()->ScheduleNudgeWithPayloadsAsync( | 2319 TimeDelta::FromMilliseconds(kSyncRefreshDelayMsec), |
| 2356 TimeDelta::FromMilliseconds(kSyncRefreshDelayMsec), | 2320 syncer::NUDGE_SOURCE_LOCAL_REFRESH, |
| 2357 syncer::NUDGE_SOURCE_LOCAL_REFRESH, | 2321 type_payloads, FROM_HERE); |
| 2358 type_payloads, FROM_HERE); | |
| 2359 } | |
| 2360 } else if (!type_payloads.empty()) { | 2322 } else if (!type_payloads.empty()) { |
| 2361 if (scheduler()) { | 2323 scheduler()->ScheduleNudgeWithPayloadsAsync( |
| 2362 scheduler()->ScheduleNudgeWithPayloadsAsync( | 2324 TimeDelta::FromMilliseconds(kSyncSchedulerDelayMsec), |
| 2363 TimeDelta::FromMilliseconds(kSyncSchedulerDelayMsec), | 2325 syncer::NUDGE_SOURCE_NOTIFICATION, |
| 2364 syncer::NUDGE_SOURCE_NOTIFICATION, | 2326 type_payloads, FROM_HERE); |
| 2365 type_payloads, FROM_HERE); | |
| 2366 } | |
| 2367 allstatus_.IncrementNotificationsReceived(); | 2327 allstatus_.IncrementNotificationsReceived(); |
| 2368 UpdateNotificationInfo(type_payloads); | 2328 UpdateNotificationInfo(type_payloads); |
| 2369 debug_info_event_listener_.OnIncomingNotification(type_payloads); | 2329 debug_info_event_listener_.OnIncomingNotification(type_payloads); |
| 2370 } else { | 2330 } else { |
| 2371 LOG(WARNING) << "Sync received notification without any type information."; | 2331 LOG(WARNING) << "Sync received notification without any type information."; |
| 2372 } | 2332 } |
| 2373 | 2333 |
| 2374 if (js_event_handler_.IsInitialized()) { | 2334 if (js_event_handler_.IsInitialized()) { |
| 2375 DictionaryValue details; | 2335 DictionaryValue details; |
| 2376 ListValue* changed_types = new ListValue(); | 2336 ListValue* changed_types = new ListValue(); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2523 syncer::UserShare* share) { | 2483 syncer::UserShare* share) { |
| 2524 for (syncer::ModelTypeSet::Iterator i = types.First(); | 2484 for (syncer::ModelTypeSet::Iterator i = types.First(); |
| 2525 i.Good(); i.Inc()) { | 2485 i.Good(); i.Inc()) { |
| 2526 if (!share->directory->initial_sync_ended_for_type(i.Get())) | 2486 if (!share->directory->initial_sync_ended_for_type(i.Get())) |
| 2527 return false; | 2487 return false; |
| 2528 } | 2488 } |
| 2529 return true; | 2489 return true; |
| 2530 } | 2490 } |
| 2531 | 2491 |
| 2532 } // namespace syncer | 2492 } // namespace syncer |
| OLD | NEW |