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

Side by Side Diff: sync/internal_api/write_node.cc

Issue 10825137: FYI: Control Data + Per-Device Metadata (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add PER_USER_METADATA, refactor some encryption code Created 8 years, 4 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 | Annotate | Revision Log
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/internal_api/public/write_node.h" 5 #include "sync/internal_api/public/write_node.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "sync/internal_api/public/base_transaction.h" 9 #include "sync/internal_api/public/base_transaction.h"
10 #include "sync/internal_api/public/write_transaction.h" 10 #include "sync/internal_api/public/write_transaction.h"
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 SetEntitySpecifics(entity_specifics); 183 SetEntitySpecifics(entity_specifics);
184 } 184 }
185 185
186 void WriteNode::SetSessionSpecifics( 186 void WriteNode::SetSessionSpecifics(
187 const sync_pb::SessionSpecifics& new_value) { 187 const sync_pb::SessionSpecifics& new_value) {
188 sync_pb::EntitySpecifics entity_specifics; 188 sync_pb::EntitySpecifics entity_specifics;
189 entity_specifics.mutable_session()->CopyFrom(new_value); 189 entity_specifics.mutable_session()->CopyFrom(new_value);
190 SetEntitySpecifics(entity_specifics); 190 SetEntitySpecifics(entity_specifics);
191 } 191 }
192 192
193 void WriteNode::SetPerDeviceSpecifics(
194 const sync_pb::PerDeviceSpecifics& new_value) {
195 sync_pb::EntitySpecifics entity_specifics;
196 entity_specifics.mutable_per_device_metadata()->CopyFrom(new_value);
197 SetEntitySpecifics(entity_specifics);
198 }
199
200 void WriteNode::SetPerUserSpecifics(
201 const sync_pb::PerUserSpecifics& new_value) {
202 sync_pb::EntitySpecifics entity_specifics;
203 entity_specifics.mutable_per_user_metadata()->CopyFrom(new_value);
204 SetEntitySpecifics(entity_specifics);
205 }
206
193 void WriteNode::SetEntitySpecifics( 207 void WriteNode::SetEntitySpecifics(
194 const sync_pb::EntitySpecifics& new_value) { 208 const sync_pb::EntitySpecifics& new_value) {
195 ModelType new_specifics_type = 209 ModelType new_specifics_type =
196 GetModelTypeFromSpecifics(new_value); 210 GetModelTypeFromSpecifics(new_value);
197 DCHECK_NE(new_specifics_type, UNSPECIFIED); 211 DCHECK_NE(new_specifics_type, UNSPECIFIED);
198 DVLOG(1) << "Writing entity specifics of type " 212 DVLOG(1) << "Writing entity specifics of type "
199 << ModelTypeToString(new_specifics_type); 213 << ModelTypeToString(new_specifics_type);
200 // GetModelType() can be unspecified if this is the first time this 214 // GetModelType() can be unspecified if this is the first time this
201 // node is being initialized (see PutModelType()). Otherwise, it 215 // node is being initialized (see PutModelType()). Otherwise, it
202 // should match |new_specifics_type|. 216 // should match |new_specifics_type|.
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 sync_pb::BookmarkSpecifics new_value = GetBookmarkSpecifics(); 517 sync_pb::BookmarkSpecifics new_value = GetBookmarkSpecifics();
504 new_value.set_favicon(bytes.empty() ? NULL : &bytes[0], bytes.size()); 518 new_value.set_favicon(bytes.empty() ? NULL : &bytes[0], bytes.size());
505 SetBookmarkSpecifics(new_value); 519 SetBookmarkSpecifics(new_value);
506 } 520 }
507 521
508 void WriteNode::MarkForSyncing() { 522 void WriteNode::MarkForSyncing() {
509 syncable::MarkForSyncing(entry_); 523 syncable::MarkForSyncing(entry_);
510 } 524 }
511 525
512 } // namespace syncer 526 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698