OLD | NEW |
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 14 matching lines...) Expand all Loading... |
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 // Local changes must always have a tag and specify a valid datatype. | 34 // Local changes must always have a tag and specify a valid datatype. |
35 if (sync_data_.GetTag().empty() || | 35 if (sync_data_.local().GetTag().empty() || |
36 !IsRealDataType(sync_data_.GetDataType())) { | 36 !IsRealDataType(sync_data_.GetDataType())) { |
37 return false; | 37 return false; |
38 } | 38 } |
39 | 39 |
40 // Adds and updates must have a non-unique-title. | 40 // Adds and updates must have a non-unique-title. |
41 if (change_type_ == ACTION_ADD || change_type_ == ACTION_UPDATE) | 41 if (change_type_ == ACTION_ADD || change_type_ == ACTION_UPDATE) |
42 return (!sync_data_.GetTitle().empty()); | 42 return (!sync_data_.GetTitle().empty()); |
43 | 43 |
44 return true; | 44 return true; |
45 } | 45 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 return "{ " + location_.ToString() + ", changeType: " + | 77 return "{ " + location_.ToString() + ", changeType: " + |
78 ChangeTypeToString(change_type_) + ", syncData: " + | 78 ChangeTypeToString(change_type_) + ", syncData: " + |
79 sync_data_.ToString() + "}"; | 79 sync_data_.ToString() + "}"; |
80 } | 80 } |
81 | 81 |
82 void PrintTo(const SyncChange& sync_change, std::ostream* os) { | 82 void PrintTo(const SyncChange& sync_change, std::ostream* os) { |
83 *os << sync_change.ToString(); | 83 *os << sync_change.ToString(); |
84 } | 84 } |
85 | 85 |
86 } // namespace syncer | 86 } // namespace syncer |
OLD | NEW |