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. 4 5 #include "components/sync_driver/proxy_data_type_controller.h" 6 7 namespace sync_driver { 8 9 ProxyDataTypeController::ProxyDataTypeController( 10 scoped_refptr<base::MessageLoopProxy> ui_thread, 11 syncer::ModelType type) 12 : DataTypeController(ui_thread, base::Closure()), 13 state_(NOT_RUNNING), 14 type_(type) { 15 DCHECK(syncer::ProxyTypes().Has(type_)); 16 } 17 18 ProxyDataTypeController::~ProxyDataTypeController() { 19 } 20 21 void ProxyDataTypeController::LoadModels( 22 const ModelLoadCallback& model_load_callback) { 23 state_ = MODEL_LOADED; 24 model_load_callback.Run(type(), syncer::SyncError()); 25 } 26 27 void ProxyDataTypeController::StartAssociating( 28 const StartCallback& start_callback) { 29 syncer::SyncMergeResult local_merge_result(type_); 30 syncer::SyncMergeResult syncer_merge_result(type_); 31 state_ = RUNNING; 32 start_callback.Run(DataTypeController::OK, 33 local_merge_result, 34 syncer_merge_result); 35 } 36 37 void ProxyDataTypeController::Stop() { 38 state_ = NOT_RUNNING; 39 } 40 41 syncer::ModelType ProxyDataTypeController::type() const { 42 DCHECK(syncer::ProxyTypes().Has(type_)); 43 return type_; 44 } 45 46 syncer::ModelSafeGroup ProxyDataTypeController::model_safe_group() const { 47 DCHECK(syncer::ProxyTypes().Has(type_)); 48 return syncer::GROUP_PASSIVE; 49 } 50 51 ChangeProcessor* ProxyDataTypeController::GetChangeProcessor() const { 52 return NULL; 53 } 54 55 std::string ProxyDataTypeController::name() const { 56 // For logging only. 57 return syncer::ModelTypeToString(type()); 58 } 59 60 DataTypeController::State ProxyDataTypeController::state() const { 61 return state_; 62 } 63 64 void ProxyDataTypeController::OnSingleDataTypeUnrecoverableError( 65 const syncer::SyncError& error) { 66 NOTIMPLEMENTED(); 67 } 68 69 void ProxyDataTypeController::OnModelLoaded() { 70 NOTIMPLEMENTED(); 71 } 72 73 } // namespace sync_driver 74