Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/sync/api/sync_change.h" | 5 #include "chrome/browser/sync/api/sync_change.h" |
| 6 | 6 |
| 7 #include <ostream> | |
| 8 | |
| 7 SyncChange::SyncChange() : change_type_(ACTION_INVALID) { | 9 SyncChange::SyncChange() : change_type_(ACTION_INVALID) { |
| 8 } | 10 } |
| 9 | 11 |
| 10 SyncChange::SyncChange(SyncChangeType change_type, const SyncData& sync_data) | 12 SyncChange::SyncChange(SyncChangeType change_type, const SyncData& sync_data) |
| 11 : change_type_(change_type), | 13 : change_type_(change_type), |
| 12 sync_data_(sync_data) { | 14 sync_data_(sync_data) { |
| 13 DCHECK(IsValid()); | 15 DCHECK(IsValid()); |
| 14 } | 16 } |
| 15 | 17 |
| 16 SyncChange::~SyncChange() {} | 18 SyncChange::~SyncChange() {} |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 return "ACTION_ADD"; | 54 return "ACTION_ADD"; |
| 53 case ACTION_UPDATE: | 55 case ACTION_UPDATE: |
| 54 return "ACTION_UPDATE"; | 56 return "ACTION_UPDATE"; |
| 55 case ACTION_DELETE: | 57 case ACTION_DELETE: |
| 56 return "ACTION_DELETE"; | 58 return "ACTION_DELETE"; |
| 57 default: | 59 default: |
| 58 NOTREACHED(); | 60 NOTREACHED(); |
| 59 } | 61 } |
| 60 return std::string(); | 62 return std::string(); |
| 61 } | 63 } |
| 64 | |
| 65 std::string SyncChange::ToString() const { | |
| 66 return "{" + ChangeTypeToString(change_type_) + | |
|
akalin
2011/09/22 02:59:44
Prefer dictionary-style
return "{ changeType: " +
James Hawkins
2011/09/22 21:01:58
Done.
| |
| 67 ", " + sync_data_.ToString() + "}"; | |
| 68 } | |
| 69 | |
| 70 void PrintTo(const SyncChange& sync_change, std::ostream* os) { | |
| 71 *os << sync_change.ToString(); | |
| 72 } | |
| OLD | NEW |