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

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

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 4 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/sync_change.h ('k') | components/sync/api/sync_change_processor.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "sync/api/sync_change.h" 5 #include "components/sync/api/sync_change.h"
6 6
7 #include <ostream> 7 #include <ostream>
8 8
9 namespace syncer { 9 namespace syncer {
10 10
11 SyncChange::SyncChange() : change_type_(ACTION_INVALID) { 11 SyncChange::SyncChange() : change_type_(ACTION_INVALID) {}
12 }
13 12
14 SyncChange::SyncChange( 13 SyncChange::SyncChange(const tracked_objects::Location& from_here,
15 const tracked_objects::Location& from_here, 14 SyncChangeType change_type,
16 SyncChangeType change_type, 15 const SyncData& sync_data)
17 const SyncData& sync_data) 16 : location_(from_here), change_type_(change_type), sync_data_(sync_data) {
18 : location_(from_here),
19 change_type_(change_type),
20 sync_data_(sync_data) {
21 DCHECK(IsValid()); 17 DCHECK(IsValid());
22 } 18 }
23 19
24 SyncChange::~SyncChange() {} 20 SyncChange::~SyncChange() {}
25 21
26 bool SyncChange::IsValid() const { 22 bool SyncChange::IsValid() const {
27 if (change_type_ == ACTION_INVALID || !sync_data_.IsValid()) 23 if (change_type_ == ACTION_INVALID || !sync_data_.IsValid())
28 return false; 24 return false;
29 25
30 // Data from the syncer must always have valid specifics. 26 // Data from the syncer must always have valid specifics.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 case ACTION_DELETE: 64 case ACTION_DELETE:
69 return "ACTION_DELETE"; 65 return "ACTION_DELETE";
70 default: 66 default:
71 NOTREACHED(); 67 NOTREACHED();
72 } 68 }
73 return std::string(); 69 return std::string();
74 } 70 }
75 71
76 std::string SyncChange::ToString() const { 72 std::string SyncChange::ToString() const {
77 return "{ " + location_.ToString() + ", changeType: " + 73 return "{ " + location_.ToString() + ", changeType: " +
78 ChangeTypeToString(change_type_) + ", syncData: " + 74 ChangeTypeToString(change_type_) + ", syncData: " +
79 sync_data_.ToString() + "}"; 75 sync_data_.ToString() + "}";
80 } 76 }
81 77
82 void PrintTo(const SyncChange& sync_change, std::ostream* os) { 78 void PrintTo(const SyncChange& sync_change, std::ostream* os) {
83 *os << sync_change.ToString(); 79 *os << sync_change.ToString();
84 } 80 }
85 81
86 } // namespace syncer 82 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/api/sync_change.h ('k') | components/sync/api/sync_change_processor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698