| 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 "components/sync/core_impl/sync_manager_impl.h" | 5 #include "components/sync/core_impl/sync_manager_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 845 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, OnProtocolEvent(event)); | 845 FOR_EACH_OBSERVER(SyncManager::Observer, observers_, OnProtocolEvent(event)); |
| 846 } | 846 } |
| 847 | 847 |
| 848 void SyncManagerImpl::SetJsEventHandler( | 848 void SyncManagerImpl::SetJsEventHandler( |
| 849 const WeakHandle<JsEventHandler>& event_handler) { | 849 const WeakHandle<JsEventHandler>& event_handler) { |
| 850 js_sync_manager_observer_.SetJsEventHandler(event_handler); | 850 js_sync_manager_observer_.SetJsEventHandler(event_handler); |
| 851 js_mutation_event_observer_.SetJsEventHandler(event_handler); | 851 js_mutation_event_observer_.SetJsEventHandler(event_handler); |
| 852 js_sync_encryption_handler_observer_.SetJsEventHandler(event_handler); | 852 js_sync_encryption_handler_observer_.SetJsEventHandler(event_handler); |
| 853 } | 853 } |
| 854 | 854 |
| 855 std::unique_ptr<base::ListValue> SyncManagerImpl::GetAllNodesForType( | |
| 856 syncer::ModelType type) { | |
| 857 DirectoryTypeDebugInfoEmitterMap* emitter_map = | |
| 858 model_type_registry_->directory_type_debug_info_emitter_map(); | |
| 859 DirectoryTypeDebugInfoEmitterMap::iterator it = emitter_map->find(type); | |
| 860 | |
| 861 if (it == emitter_map->end()) { | |
| 862 // This can happen in some cases. The UI thread makes requests of us | |
| 863 // when it doesn't really know which types are enabled or disabled. | |
| 864 DLOG(WARNING) << "Asked to return debug info for invalid type " | |
| 865 << ModelTypeToString(type); | |
| 866 return std::unique_ptr<base::ListValue>(new base::ListValue()); | |
| 867 } | |
| 868 | |
| 869 return it->second->GetAllNodes(); | |
| 870 } | |
| 871 | |
| 872 void SyncManagerImpl::SetInvalidatorEnabled(bool invalidator_enabled) { | 855 void SyncManagerImpl::SetInvalidatorEnabled(bool invalidator_enabled) { |
| 873 DCHECK(thread_checker_.CalledOnValidThread()); | 856 DCHECK(thread_checker_.CalledOnValidThread()); |
| 874 | 857 |
| 875 DVLOG(1) << "Invalidator enabled state is now: " << invalidator_enabled; | 858 DVLOG(1) << "Invalidator enabled state is now: " << invalidator_enabled; |
| 876 allstatus_.SetNotificationsEnabled(invalidator_enabled); | 859 allstatus_.SetNotificationsEnabled(invalidator_enabled); |
| 877 scheduler_->SetNotificationsEnabled(invalidator_enabled); | 860 scheduler_->SetNotificationsEnabled(invalidator_enabled); |
| 878 } | 861 } |
| 879 | 862 |
| 880 void SyncManagerImpl::OnIncomingInvalidation( | 863 void SyncManagerImpl::OnIncomingInvalidation( |
| 881 syncer::ModelType type, | 864 syncer::ModelType type, |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1008 } | 991 } |
| 1009 | 992 |
| 1010 void SyncManagerImpl::OnCookieJarChanged(bool account_mismatch, | 993 void SyncManagerImpl::OnCookieJarChanged(bool account_mismatch, |
| 1011 bool empty_jar) { | 994 bool empty_jar) { |
| 1012 DCHECK(thread_checker_.CalledOnValidThread()); | 995 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1013 cycle_context_->set_cookie_jar_mismatch(account_mismatch); | 996 cycle_context_->set_cookie_jar_mismatch(account_mismatch); |
| 1014 cycle_context_->set_cookie_jar_empty(empty_jar); | 997 cycle_context_->set_cookie_jar_empty(empty_jar); |
| 1015 } | 998 } |
| 1016 | 999 |
| 1017 } // namespace syncer | 1000 } // namespace syncer |
| OLD | NEW |