| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #include "chrome/browser/sync/glue/sync_backend_host.h" | 7 #include "chrome/browser/sync/glue/sync_backend_host.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/file_util.h" | 15 #include "base/file_util.h" |
| 16 #include "base/task.h" | 16 #include "base/task.h" |
| 17 #include "base/threading/thread_restrictions.h" | 17 #include "base/threading/thread_restrictions.h" |
| 18 #include "base/tracked.h" | 18 #include "base/tracked.h" |
| 19 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
| 20 #include "chrome/browser/net/gaia/token_service.h" | 20 #include "chrome/browser/net/gaia/token_service.h" |
| 21 #include "chrome/browser/prefs/pref_service.h" | 21 #include "chrome/browser/prefs/pref_service.h" |
| 22 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
| 23 #include "chrome/browser/sync/glue/change_processor.h" | 23 #include "chrome/browser/sync/glue/change_processor.h" |
| 24 #include "chrome/browser/sync/glue/http_bridge.h" | 24 #include "chrome/browser/sync/glue/http_bridge.h" |
| 25 #include "chrome/browser/sync/internal_api/base_transaction.h" | 25 #include "chrome/browser/sync/internal_api/base_transaction.h" |
| 26 #include "chrome/browser/sync/internal_api/read_transaction.h" | 26 #include "chrome/browser/sync/internal_api/read_transaction.h" |
| 27 #include "chrome/browser/sync/internal_api/sync_manager.h" | |
| 28 #include "chrome/browser/sync/glue/sync_backend_registrar.h" | 27 #include "chrome/browser/sync/glue/sync_backend_registrar.h" |
| 29 #include "chrome/browser/sync/notifier/sync_notifier.h" | 28 #include "chrome/browser/sync/notifier/sync_notifier.h" |
| 30 #include "chrome/browser/sync/protocol/sync.pb.h" | 29 #include "chrome/browser/sync/protocol/sync.pb.h" |
| 31 #include "chrome/browser/sync/sessions/session_state.h" | 30 #include "chrome/browser/sync/sessions/session_state.h" |
| 32 // TODO(tim): Remove this! We should have a syncapi pass-thru instead. | 31 // TODO(tim): Remove this! We should have a syncapi pass-thru instead. |
| 33 #include "chrome/browser/sync/syncable/directory_manager.h" // Cryptographer. | 32 #include "chrome/browser/sync/syncable/directory_manager.h" // Cryptographer. |
| 34 #include "chrome/common/chrome_notification_types.h" | 33 #include "chrome/common/chrome_notification_types.h" |
| 35 #include "chrome/common/chrome_version_info.h" | 34 #include "chrome/common/chrome_version_info.h" |
| 36 #include "chrome/common/net/gaia/gaia_constants.h" | 35 #include "chrome/common/net/gaia/gaia_constants.h" |
| 37 #include "chrome/common/pref_names.h" | 36 #include "chrome/common/pref_names.h" |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 DCHECK(host_); | 363 DCHECK(host_); |
| 365 } | 364 } |
| 366 | 365 |
| 367 SyncBackendHost::Core::~Core() { | 366 SyncBackendHost::Core::~Core() { |
| 368 DCHECK(!sync_manager_.get()); | 367 DCHECK(!sync_manager_.get()); |
| 369 } | 368 } |
| 370 | 369 |
| 371 void SyncBackendHost::Core::OnChangesApplied( | 370 void SyncBackendHost::Core::OnChangesApplied( |
| 372 syncable::ModelType model_type, | 371 syncable::ModelType model_type, |
| 373 const sync_api::BaseTransaction* trans, | 372 const sync_api::BaseTransaction* trans, |
| 374 const sync_api::SyncManager::ChangeRecord* changes, | 373 const sync_api::ImmutableChangeRecordList& changes) { |
| 375 int change_count) { | |
| 376 if (!host_ || !host_->frontend_) { | 374 if (!host_ || !host_->frontend_) { |
| 377 DCHECK(false) << "OnChangesApplied called after Shutdown?"; | 375 DCHECK(false) << "OnChangesApplied called after Shutdown?"; |
| 378 return; | 376 return; |
| 379 } | 377 } |
| 380 ChangeProcessor* processor = registrar_->GetProcessor(model_type); | 378 ChangeProcessor* processor = registrar_->GetProcessor(model_type); |
| 381 if (!processor) | 379 if (!processor) |
| 382 return; | 380 return; |
| 383 | 381 |
| 384 processor->ApplyChangesFromSyncModel(trans, changes, change_count); | 382 processor->ApplyChangesFromSyncModel(trans, changes); |
| 385 } | 383 } |
| 386 | 384 |
| 387 void SyncBackendHost::Core::OnChangesComplete( | 385 void SyncBackendHost::Core::OnChangesComplete( |
| 388 syncable::ModelType model_type) { | 386 syncable::ModelType model_type) { |
| 389 if (!host_ || !host_->frontend_) { | 387 if (!host_ || !host_->frontend_) { |
| 390 DCHECK(false) << "OnChangesComplete called after Shutdown?"; | 388 DCHECK(false) << "OnChangesComplete called after Shutdown?"; |
| 391 return; | 389 return; |
| 392 } | 390 } |
| 393 | 391 |
| 394 ChangeProcessor* processor = registrar_->GetProcessor(model_type); | 392 ChangeProcessor* processor = registrar_->GetProcessor(model_type); |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 914 : reason(sync_api::CONFIGURE_REASON_UNKNOWN) {} | 912 : reason(sync_api::CONFIGURE_REASON_UNKNOWN) {} |
| 915 | 913 |
| 916 SyncBackendHost::PendingConfigureDataTypesState:: | 914 SyncBackendHost::PendingConfigureDataTypesState:: |
| 917 ~PendingConfigureDataTypesState() {} | 915 ~PendingConfigureDataTypesState() {} |
| 918 | 916 |
| 919 #undef SVLOG | 917 #undef SVLOG |
| 920 | 918 |
| 921 #undef SLOG | 919 #undef SLOG |
| 922 | 920 |
| 923 } // namespace browser_sync | 921 } // namespace browser_sync |
| OLD | NEW |