Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: components/sync/api/model_type_service.cc

Issue 2401223002: [Sync] Renaming sync/api* to sync/model*. (Closed)
Patch Set: Missed a comment in a DEPS file, and rebasing. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 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/api/model_type_service.h"
6
7 #include <utility>
8
9 namespace syncer {
10
11 ModelTypeService::ModelTypeService(
12 const ChangeProcessorFactory& change_processor_factory,
13 ModelType type)
14 : change_processor_factory_(change_processor_factory), type_(type) {}
15
16 ModelTypeService::~ModelTypeService() {}
17
18 ConflictResolution ModelTypeService::ResolveConflict(
19 const EntityData& local_data,
20 const EntityData& remote_data) const {
21 // TODO(maxbogue): Add tests once a file exists for them (crbug.com/543407).
22 if (remote_data.is_deleted()) {
23 DCHECK(!local_data.is_deleted());
24 return ConflictResolution::UseLocal();
25 }
26 return ConflictResolution::UseRemote();
27 }
28
29 void ModelTypeService::OnSyncStarting(
30 std::unique_ptr<DataTypeErrorHandler> error_handler,
31 const ModelTypeChangeProcessor::StartCallback& start_callback) {
32 CreateChangeProcessor();
33 change_processor_->OnSyncStarting(std::move(error_handler), start_callback);
34 }
35
36 void ModelTypeService::DisableSync() {
37 DCHECK(change_processor_);
38 change_processor_->DisableSync();
39 change_processor_.reset();
40 }
41
42 void ModelTypeService::CreateChangeProcessor() {
43 if (!change_processor_) {
44 change_processor_ = change_processor_factory_.Run(type_, this);
45 DCHECK(change_processor_);
46 OnChangeProcessorSet();
47 }
48 }
49
50 ModelTypeChangeProcessor* ModelTypeService::change_processor() const {
51 return change_processor_.get();
52 }
53
54 void ModelTypeService::clear_change_processor() {
55 change_processor_.reset();
56 }
57
58 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/api/model_type_service.h ('k') | components/sync/api/model_type_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698