| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 } | 45 } |
| 46 | 46 |
| 47 SyncChange::SyncChangeType SyncChange::change_type() const { | 47 SyncChange::SyncChangeType SyncChange::change_type() const { |
| 48 return change_type_; | 48 return change_type_; |
| 49 } | 49 } |
| 50 | 50 |
| 51 SyncData SyncChange::sync_data() const { | 51 SyncData SyncChange::sync_data() const { |
| 52 return sync_data_; | 52 return sync_data_; |
| 53 } | 53 } |
| 54 | 54 |
| 55 tracked_objects::Location SyncChange::location() const { |
| 56 return location_; |
| 57 } |
| 58 |
| 55 // static | 59 // static |
| 56 std::string SyncChange::ChangeTypeToString(SyncChangeType change_type) { | 60 std::string SyncChange::ChangeTypeToString(SyncChangeType change_type) { |
| 57 switch (change_type) { | 61 switch (change_type) { |
| 58 case ACTION_INVALID: | 62 case ACTION_INVALID: |
| 59 return "ACTION_INVALID"; | 63 return "ACTION_INVALID"; |
| 60 case ACTION_ADD: | 64 case ACTION_ADD: |
| 61 return "ACTION_ADD"; | 65 return "ACTION_ADD"; |
| 62 case ACTION_UPDATE: | 66 case ACTION_UPDATE: |
| 63 return "ACTION_UPDATE"; | 67 return "ACTION_UPDATE"; |
| 64 case ACTION_DELETE: | 68 case ACTION_DELETE: |
| 65 return "ACTION_DELETE"; | 69 return "ACTION_DELETE"; |
| 66 default: | 70 default: |
| 67 NOTREACHED(); | 71 NOTREACHED(); |
| 68 } | 72 } |
| 69 return std::string(); | 73 return std::string(); |
| 70 } | 74 } |
| 71 | 75 |
| 72 std::string SyncChange::ToString() const { | 76 std::string SyncChange::ToString() const { |
| 73 return "{ " + location_.ToString() + ", changeType: " + | 77 return "{ " + location_.ToString() + ", changeType: " + |
| 74 ChangeTypeToString(change_type_) + ", syncData: " + | 78 ChangeTypeToString(change_type_) + ", syncData: " + |
| 75 sync_data_.ToString() + "}"; | 79 sync_data_.ToString() + "}"; |
| 76 } | 80 } |
| 77 | 81 |
| 78 void PrintTo(const SyncChange& sync_change, std::ostream* os) { | 82 void PrintTo(const SyncChange& sync_change, std::ostream* os) { |
| 79 *os << sync_change.ToString(); | 83 *os << sync_change.ToString(); |
| 80 } | 84 } |
| 81 | 85 |
| 82 } // namespace syncer | 86 } // namespace syncer |
| OLD | NEW |