| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/sync/glue/sync_backend_registrar.h" | 5 #include "chrome/browser/sync/glue/sync_backend_registrar.h" |
| 6 | 6 |
| 7 #include <cstddef> | 7 #include <cstddef> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
| 12 #include "chrome/browser/password_manager/password_store.h" |
| 12 #include "chrome/browser/password_manager/password_store_factory.h" | 13 #include "chrome/browser/password_manager/password_store_factory.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/sync/engine/passive_model_worker.h" | 15 #include "chrome/browser/sync/engine/passive_model_worker.h" |
| 15 #include "chrome/browser/sync/glue/browser_thread_model_worker.h" | 16 #include "chrome/browser/sync/glue/browser_thread_model_worker.h" |
| 16 #include "chrome/browser/sync/glue/change_processor.h" | 17 #include "chrome/browser/sync/glue/change_processor.h" |
| 17 #include "chrome/browser/sync/glue/history_model_worker.h" | 18 #include "chrome/browser/sync/glue/history_model_worker.h" |
| 18 #include "chrome/browser/sync/glue/password_model_worker.h" | 19 #include "chrome/browser/sync/glue/password_model_worker.h" |
| 19 #include "chrome/browser/sync/glue/ui_model_worker.h" | 20 #include "chrome/browser/sync/glue/ui_model_worker.h" |
| 20 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
| 21 | 22 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 HistoryService* history_service = profile->GetHistoryService( | 81 HistoryService* history_service = profile->GetHistoryService( |
| 81 Profile::IMPLICIT_ACCESS); | 82 Profile::IMPLICIT_ACCESS); |
| 82 if (history_service) { | 83 if (history_service) { |
| 83 workers_[GROUP_HISTORY] = new HistoryModelWorker(history_service); | 84 workers_[GROUP_HISTORY] = new HistoryModelWorker(history_service); |
| 84 } else { | 85 } else { |
| 85 LOG_IF(WARNING, initial_types.Has(syncable::TYPED_URLS)) | 86 LOG_IF(WARNING, initial_types.Has(syncable::TYPED_URLS)) |
| 86 << "History store disabled, cannot sync Omnibox History"; | 87 << "History store disabled, cannot sync Omnibox History"; |
| 87 routing_info_.erase(syncable::TYPED_URLS); | 88 routing_info_.erase(syncable::TYPED_URLS); |
| 88 } | 89 } |
| 89 | 90 |
| 90 PasswordStore* password_store = | 91 scoped_refptr<PasswordStore> password_store = |
| 91 PasswordStoreFactory::GetForProfile(profile, Profile::IMPLICIT_ACCESS); | 92 PasswordStoreFactory::GetForProfile(profile, Profile::IMPLICIT_ACCESS); |
| 92 if (password_store) { | 93 if (password_store.get()) { |
| 93 workers_[GROUP_PASSWORD] = new PasswordModelWorker(password_store); | 94 workers_[GROUP_PASSWORD] = new PasswordModelWorker(password_store); |
| 94 } else { | 95 } else { |
| 95 LOG_IF(WARNING, initial_types.Has(syncable::PASSWORDS)) | 96 LOG_IF(WARNING, initial_types.Has(syncable::PASSWORDS)) |
| 96 << "Password store not initialized, cannot sync passwords"; | 97 << "Password store not initialized, cannot sync passwords"; |
| 97 routing_info_.erase(syncable::PASSWORDS); | 98 routing_info_.erase(syncable::PASSWORDS); |
| 98 } | 99 } |
| 99 } | 100 } |
| 100 | 101 |
| 101 SyncBackendRegistrar::~SyncBackendRegistrar() { | 102 SyncBackendRegistrar::~SyncBackendRegistrar() { |
| 102 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 103 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 return it->second; | 280 return it->second; |
| 280 } | 281 } |
| 281 | 282 |
| 282 bool SyncBackendRegistrar::IsCurrentThreadSafeForModel( | 283 bool SyncBackendRegistrar::IsCurrentThreadSafeForModel( |
| 283 syncable::ModelType model_type) const { | 284 syncable::ModelType model_type) const { |
| 284 lock_.AssertAcquired(); | 285 lock_.AssertAcquired(); |
| 285 return IsOnThreadForGroup(GetGroupForModelType(model_type, routing_info_)); | 286 return IsOnThreadForGroup(GetGroupForModelType(model_type, routing_info_)); |
| 286 } | 287 } |
| 287 | 288 |
| 288 } // namespace browser_sync | 289 } // namespace browser_sync |
| OLD | NEW |