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

Side by Side Diff: chrome/browser/sync/engine/syncproto.h

Issue 2844037: Fix handling of undeletion within the syncer. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Whitespace. Created 10 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 // Wrappers to help us work with ids and protobuffers. 5 // Wrappers to help us work with ids and protobuffers.
6 6
7 #ifndef CHROME_BROWSER_SYNC_ENGINE_SYNCPROTO_H_ 7 #ifndef CHROME_BROWSER_SYNC_ENGINE_SYNCPROTO_H_
8 #define CHROME_BROWSER_SYNC_ENGINE_SYNCPROTO_H_ 8 #define CHROME_BROWSER_SYNC_ENGINE_SYNCPROTO_H_
9 9
10 #include "chrome/browser/sync/protocol/bookmark_specifics.pb.h" 10 #include "chrome/browser/sync/protocol/bookmark_specifics.pb.h"
11 #include "chrome/browser/sync/protocol/password_specifics.pb.h" 11 #include "chrome/browser/sync/protocol/password_specifics.pb.h"
12 #include "chrome/browser/sync/protocol/preference_specifics.pb.h" 12 #include "chrome/browser/sync/protocol/preference_specifics.pb.h"
13 #include "chrome/browser/sync/protocol/sync.pb.h" 13 #include "chrome/browser/sync/protocol/sync.pb.h"
14 #include "chrome/browser/sync/syncable/model_type.h" 14 #include "chrome/browser/sync/syncable/model_type.h"
15 #include "chrome/browser/sync/syncable/syncable_id.h" 15 #include "chrome/browser/sync/syncable/syncable_id.h"
16 16
17 namespace browser_sync { 17 namespace browser_sync {
18 18
19 template<class Base> 19 template<class Base>
20 class IdWrapper : public Base { 20 class IdWrapper : public Base {
21 public: 21 public:
22 IdWrapper() {}
23 explicit IdWrapper(const Base& other) : Base(other) {
24 }
22 syncable::Id id() const { 25 syncable::Id id() const {
23 return syncable::Id::CreateFromServerId(Base::id_string()); 26 return syncable::Id::CreateFromServerId(Base::id_string());
24 } 27 }
25 void set_id(const syncable::Id& id) { 28 void set_id(const syncable::Id& id) {
26 Base::set_id_string(id.GetServerId()); 29 Base::set_id_string(id.GetServerId());
27 } 30 }
28 }; 31 };
29 32
30 // These wrapper classes contain no data, so their super classes can be cast to 33 // These wrapper classes contain no data, so their super classes can be cast to
31 // them directly. 34 // them directly.
32 class SyncEntity : public IdWrapper<sync_pb::SyncEntity> { 35 class SyncEntity : public IdWrapper<sync_pb::SyncEntity> {
33 public: 36 public:
37 SyncEntity() {}
38 explicit SyncEntity(const sync_pb::SyncEntity& other)
39 : IdWrapper<sync_pb::SyncEntity>(other) {
40 }
41
34 void set_parent_id(const syncable::Id& id) { 42 void set_parent_id(const syncable::Id& id) {
35 set_parent_id_string(id.GetServerId()); 43 set_parent_id_string(id.GetServerId());
36 } 44 }
37 syncable::Id parent_id() const { 45 syncable::Id parent_id() const {
38 return syncable::Id::CreateFromServerId(parent_id_string()); 46 return syncable::Id::CreateFromServerId(parent_id_string());
39 } 47 }
40 void set_old_parent_id(const syncable::Id& id) { 48 void set_old_parent_id(const syncable::Id& id) {
41 IdWrapper<sync_pb::SyncEntity>::set_old_parent_id( 49 IdWrapper<sync_pb::SyncEntity>::set_old_parent_id(
42 id.GetServerId()); 50 id.GetServerId());
43 } 51 }
(...skipping 28 matching lines...) Expand all
72 80
73 typedef sync_pb::CommitMessage CommitMessage; 81 typedef sync_pb::CommitMessage CommitMessage;
74 typedef sync_pb::ClientToServerResponse ClientToServerResponse; 82 typedef sync_pb::ClientToServerResponse ClientToServerResponse;
75 typedef sync_pb::CommitResponse CommitResponse; 83 typedef sync_pb::CommitResponse CommitResponse;
76 typedef sync_pb::GetUpdatesResponse GetUpdatesResponse; 84 typedef sync_pb::GetUpdatesResponse GetUpdatesResponse;
77 typedef sync_pb::GetUpdatesMessage GetUpdatesMessage; 85 typedef sync_pb::GetUpdatesMessage GetUpdatesMessage;
78 86
79 } // namespace browser_sync 87 } // namespace browser_sync
80 88
81 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCPROTO_H_ 89 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCPROTO_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/syncer_util.cc ('k') | chrome/browser/sync/engine/verify_updates_command.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698