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/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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 entry_->Put(syncable::NON_UNIQUE_NAME, kEncryptedString); | 97 entry_->Put(syncable::NON_UNIQUE_NAME, kEncryptedString); |
98 else | 98 else |
99 entry_->Put(syncable::NON_UNIQUE_NAME, new_legal_title); | 99 entry_->Put(syncable::NON_UNIQUE_NAME, new_legal_title); |
100 | 100 |
101 DVLOG(1) << "Overwriting title of type " | 101 DVLOG(1) << "Overwriting title of type " |
102 << ModelTypeToString(type) | 102 << ModelTypeToString(type) |
103 << " and marking for syncing."; | 103 << " and marking for syncing."; |
104 MarkForSyncing(); | 104 MarkForSyncing(); |
105 } | 105 } |
106 | 106 |
107 void WriteNode::SetURL(const GURL& url) { | |
108 sync_pb::BookmarkSpecifics new_value = GetBookmarkSpecifics(); | |
109 new_value.set_url(url.spec()); | |
110 SetBookmarkSpecifics(new_value); | |
111 } | |
112 | |
113 void WriteNode::SetAppSpecifics( | 107 void WriteNode::SetAppSpecifics( |
114 const sync_pb::AppSpecifics& new_value) { | 108 const sync_pb::AppSpecifics& new_value) { |
115 sync_pb::EntitySpecifics entity_specifics; | 109 sync_pb::EntitySpecifics entity_specifics; |
116 entity_specifics.mutable_app()->CopyFrom(new_value); | 110 entity_specifics.mutable_app()->CopyFrom(new_value); |
117 SetEntitySpecifics(entity_specifics); | 111 SetEntitySpecifics(entity_specifics); |
118 } | 112 } |
119 | 113 |
120 void WriteNode::SetAutofillSpecifics( | 114 void WriteNode::SetAutofillSpecifics( |
121 const sync_pb::AutofillSpecifics& new_value) { | 115 const sync_pb::AutofillSpecifics& new_value) { |
122 sync_pb::EntitySpecifics entity_specifics; | 116 sync_pb::EntitySpecifics entity_specifics; |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 syncable::Id predecessor_id = predecessor ? | 500 syncable::Id predecessor_id = predecessor ? |
507 predecessor->GetEntry()->Get(syncable::ID) : syncable::Id(); | 501 predecessor->GetEntry()->Get(syncable::ID) : syncable::Id(); |
508 if (!entry_->PutPredecessor(predecessor_id)) | 502 if (!entry_->PutPredecessor(predecessor_id)) |
509 return false; | 503 return false; |
510 // Mark this entry as unsynced, to wake up the syncer. | 504 // Mark this entry as unsynced, to wake up the syncer. |
511 MarkForSyncing(); | 505 MarkForSyncing(); |
512 | 506 |
513 return true; | 507 return true; |
514 } | 508 } |
515 | 509 |
516 void WriteNode::SetFaviconBytes(const vector<unsigned char>& bytes) { | |
517 sync_pb::BookmarkSpecifics new_value = GetBookmarkSpecifics(); | |
518 new_value.set_favicon(bytes.empty() ? NULL : &bytes[0], bytes.size()); | |
519 SetBookmarkSpecifics(new_value); | |
520 } | |
521 | |
522 void WriteNode::MarkForSyncing() { | 510 void WriteNode::MarkForSyncing() { |
523 syncable::MarkForSyncing(entry_); | 511 syncable::MarkForSyncing(entry_); |
524 } | 512 } |
525 | 513 |
526 } // namespace syncer | 514 } // namespace syncer |
OLD | NEW |