desk_sync_service.cc 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Copyright 2019 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "components/desks_storage/core/desk_sync_service.h"
  5. #include <utility>
  6. #include "base/bind.h"
  7. #include "components/desks_storage/core/desk_model.h"
  8. #include "components/desks_storage/core/desk_sync_bridge.h"
  9. #include "components/sync/base/report_unrecoverable_error.h"
  10. #include "components/sync/model/client_tag_based_model_type_processor.h"
  11. #include "components/sync/model/model_type_store.h"
  12. namespace desks_storage {
  13. DeskSyncService::DeskSyncService(
  14. version_info::Channel channel,
  15. syncer::OnceModelTypeStoreFactory create_store_callback,
  16. const AccountId& account_id) {
  17. bridge_ = std::make_unique<desks_storage::DeskSyncBridge>(
  18. std::make_unique<syncer::ClientTagBasedModelTypeProcessor>(
  19. syncer::WORKSPACE_DESK,
  20. base::BindRepeating(&syncer::ReportUnrecoverableError, channel)),
  21. std::move(create_store_callback), account_id);
  22. }
  23. DeskSyncService::~DeskSyncService() = default;
  24. DeskModel* DeskSyncService::GetDeskModel() {
  25. return bridge_.get();
  26. }
  27. base::WeakPtr<syncer::ModelTypeControllerDelegate>
  28. DeskSyncService::GetControllerDelegate() {
  29. return bridge_->change_processor()->GetControllerDelegate();
  30. }
  31. } // namespace desks_storage