[Sync] Componentize UIModelWorker.
[chromium-blink-merge.git] / components / sync_driver / data_type_controller.cc
blob0e4bc4f10871ffe72dad3458c89753ded639beff
1 // Copyright 2014 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.
5 #include "components/sync_driver/data_type_controller.h"
7 #include "sync/internal_api/public/base/model_type.h"
8 #include "sync/internal_api/public/user_share.h"
9 #include "sync/util/data_type_histogram.h"
11 namespace sync_driver {
13 DataTypeController::DataTypeController(
14 const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread,
15 const base::Closure& error_callback)
16 : base::RefCountedDeleteOnMessageLoop<DataTypeController>(ui_thread),
17 error_callback_(error_callback) {}
19 DataTypeController::~DataTypeController() {
22 bool DataTypeController::IsUnrecoverableResult(ConfigureResult result) {
23 return (result == UNRECOVERABLE_ERROR);
26 bool DataTypeController::IsSuccessfulResult(ConfigureResult result) {
27 return (result == OK || result == OK_FIRST_RUN);
30 syncer::SyncError DataTypeController::CreateAndUploadError(
31 const tracked_objects::Location& location,
32 const std::string& message,
33 syncer::ModelType type) {
34 if (!error_callback_.is_null())
35 error_callback_.Run();
36 return syncer::SyncError(location,
37 syncer::SyncError::DATATYPE_ERROR,
38 message,
39 type);
42 bool DataTypeController::ReadyForStart() const {
43 return true;
46 } // namespace sync_driver