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

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

Issue 217063005: Separate SyncData methods into three groups, local, remote, and common. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@syncapi
Patch Set: Remove AsLocal and AsRemote methods from SyncData. Created 6 years, 8 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
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
(...skipping 13 matching lines...) Expand all
24 SyncChange::~SyncChange() {} 24 SyncChange::~SyncChange() {}
25 25
26 bool SyncChange::IsValid() const { 26 bool SyncChange::IsValid() const {
27 if (change_type_ == ACTION_INVALID || !sync_data_.IsValid()) 27 if (change_type_ == ACTION_INVALID || !sync_data_.IsValid())
28 return false; 28 return false;
29 29
30 // Data from the syncer must always have valid specifics. 30 // Data from the syncer must always have valid specifics.
31 if (!sync_data_.IsLocal()) 31 if (!sync_data_.IsLocal())
32 return IsRealDataType(sync_data_.GetDataType()); 32 return IsRealDataType(sync_data_.GetDataType());
33 33
34 SyncDataLocal sync_data_local(sync_data_);
35
34 // Local changes must always have a tag and specify a valid datatype. 36 // Local changes must always have a tag and specify a valid datatype.
35 if (sync_data_.GetTag().empty() || 37 if (sync_data_local.GetTag().empty() ||
tim (not reviewing) 2014/03/31 23:24:24 SyncDataLocal(sync_data_).GetTag() ?
maniscalco 2014/03/31 23:33:54 Done.
36 !IsRealDataType(sync_data_.GetDataType())) { 38 !IsRealDataType(sync_data_.GetDataType())) {
37 return false; 39 return false;
38 } 40 }
39 41
40 // Adds and updates must have a non-unique-title. 42 // Adds and updates must have a non-unique-title.
41 if (change_type_ == ACTION_ADD || change_type_ == ACTION_UPDATE) 43 if (change_type_ == ACTION_ADD || change_type_ == ACTION_UPDATE)
42 return (!sync_data_.GetTitle().empty()); 44 return (!sync_data_.GetTitle().empty());
43 45
44 return true; 46 return true;
45 } 47 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 return "{ " + location_.ToString() + ", changeType: " + 79 return "{ " + location_.ToString() + ", changeType: " +
78 ChangeTypeToString(change_type_) + ", syncData: " + 80 ChangeTypeToString(change_type_) + ", syncData: " +
79 sync_data_.ToString() + "}"; 81 sync_data_.ToString() + "}";
80 } 82 }
81 83
82 void PrintTo(const SyncChange& sync_change, std::ostream* os) { 84 void PrintTo(const SyncChange& sync_change, std::ostream* os) {
83 *os << sync_change.ToString(); 85 *os << sync_change.ToString();
84 } 86 }
85 87
86 } // namespace syncer 88 } // namespace syncer
OLDNEW
« no previous file with comments | « chrome/browser/sync/sessions2/sessions_sync_manager_unittest.cc ('k') | sync/api/sync_change_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698