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

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

Issue 10696087: [Sync] Move ModelType and related classes to 'syncer' namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sort headers, update copyrights Created 8 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « sync/api/fake_syncable_service.cc ('k') | sync/api/sync_change_unittest.cc » ('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 "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 } 12 }
13 13
14 SyncChange::SyncChange(SyncChangeType change_type, const SyncData& sync_data) 14 SyncChange::SyncChange(SyncChangeType change_type, const SyncData& sync_data)
15 : change_type_(change_type), 15 : change_type_(change_type),
16 sync_data_(sync_data) { 16 sync_data_(sync_data) {
17 DCHECK(IsValid()); 17 DCHECK(IsValid());
18 } 18 }
19 19
20 SyncChange::~SyncChange() {} 20 SyncChange::~SyncChange() {}
21 21
22 bool SyncChange::IsValid() const { 22 bool SyncChange::IsValid() const {
23 if (change_type_ == ACTION_INVALID || !sync_data_.IsValid()) 23 if (change_type_ == ACTION_INVALID || !sync_data_.IsValid())
24 return false; 24 return false;
25 25
26 // Data from the syncer must always have valid specifics. 26 // Data from the syncer must always have valid specifics.
27 if (!sync_data_.IsLocal()) 27 if (!sync_data_.IsLocal())
28 return syncable::IsRealDataType(sync_data_.GetDataType()); 28 return syncer::IsRealDataType(sync_data_.GetDataType());
29 29
30 // Local changes must always have a tag and specify a valid datatype. 30 // Local changes must always have a tag and specify a valid datatype.
31 if (sync_data_.GetTag().empty() || 31 if (sync_data_.GetTag().empty() ||
32 !syncable::IsRealDataType(sync_data_.GetDataType())) { 32 !syncer::IsRealDataType(sync_data_.GetDataType())) {
33 return false; 33 return false;
34 } 34 }
35 35
36 // Adds and updates must have a non-unique-title. 36 // Adds and updates must have a non-unique-title.
37 if (change_type_ == ACTION_ADD || change_type_ == ACTION_UPDATE) 37 if (change_type_ == ACTION_ADD || change_type_ == ACTION_UPDATE)
38 return (!sync_data_.GetTitle().empty()); 38 return (!sync_data_.GetTitle().empty());
39 39
40 return true; 40 return true;
41 } 41 }
42 42
(...skipping 25 matching lines...) Expand all
68 std::string SyncChange::ToString() const { 68 std::string SyncChange::ToString() const {
69 return "{ changeType: " + ChangeTypeToString(change_type_) + 69 return "{ changeType: " + ChangeTypeToString(change_type_) +
70 ", syncData: " + sync_data_.ToString() + "}"; 70 ", syncData: " + sync_data_.ToString() + "}";
71 } 71 }
72 72
73 void PrintTo(const SyncChange& sync_change, std::ostream* os) { 73 void PrintTo(const SyncChange& sync_change, std::ostream* os) {
74 *os << sync_change.ToString(); 74 *os << sync_change.ToString();
75 } 75 }
76 76
77 } // namespace syncer 77 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/api/fake_syncable_service.cc ('k') | sync/api/sync_change_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698