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

Side by Side Diff: components/sync/api/conflict_resolution.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
« no previous file with comments | « components/sync/api/conflict_resolution.h ('k') | components/sync/api/data_batch.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 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/conflict_resolution.h"
6
7 #include <utility>
8
9 namespace syncer {
10
11 // static
12 ConflictResolution ConflictResolution::UseLocal() {
13 return ConflictResolution(USE_LOCAL, nullptr);
14 }
15
16 // static
17 ConflictResolution ConflictResolution::UseRemote() {
18 return ConflictResolution(USE_REMOTE, nullptr);
19 }
20
21 // static
22 ConflictResolution ConflictResolution::UseNew(
23 std::unique_ptr<EntityData> data) {
24 DCHECK(data);
25 return ConflictResolution(USE_NEW, std::move(data));
26 }
27
28 ConflictResolution::ConflictResolution(ConflictResolution&& other)
29 : ConflictResolution(other.type(), other.ExtractData()) {}
30
31 ConflictResolution::~ConflictResolution() {}
32
33 std::unique_ptr<EntityData> ConflictResolution::ExtractData() {
34 // Has data if and only if type is USE_NEW.
35 DCHECK((type_ == USE_NEW) == !!data_);
36 return std::move(data_);
37 }
38
39 ConflictResolution::ConflictResolution(Type type,
40 std::unique_ptr<EntityData> data)
41 : type_(type), data_(std::move(data)) {}
42
43 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/api/conflict_resolution.h ('k') | components/sync/api/data_batch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698