OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "chrome/browser/sync/glue/bookmark_change_processor.h" | 5 #include "chrome/browser/sync/glue/bookmark_change_processor.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <stack> | 8 #include <stack> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 syncer::WriteTransaction trans(FROM_HERE, share_handle(), &new_version); | 142 syncer::WriteTransaction trans(FROM_HERE, share_handle(), &new_version); |
143 | 143 |
144 RemoveAllChildNodes(&trans, bookmark_model_->bookmark_bar_node()->id()); | 144 RemoveAllChildNodes(&trans, bookmark_model_->bookmark_bar_node()->id()); |
145 RemoveAllChildNodes(&trans, bookmark_model_->other_node()->id()); | 145 RemoveAllChildNodes(&trans, bookmark_model_->other_node()->id()); |
146 // Remove mobile bookmarks node only if it is present. | 146 // Remove mobile bookmarks node only if it is present. |
147 const int64 mobile_bookmark_id = bookmark_model_->mobile_node()->id(); | 147 const int64 mobile_bookmark_id = bookmark_model_->mobile_node()->id(); |
148 if (model_associator_->GetSyncIdFromChromeId(mobile_bookmark_id) != | 148 if (model_associator_->GetSyncIdFromChromeId(mobile_bookmark_id) != |
149 syncer::kInvalidId) { | 149 syncer::kInvalidId) { |
150 RemoveAllChildNodes(&trans, bookmark_model_->mobile_node()->id()); | 150 RemoveAllChildNodes(&trans, bookmark_model_->mobile_node()->id()); |
151 } | 151 } |
| 152 // Note: the root node may have additional extra nodes. Currently none of |
| 153 // them are meant to sync. |
152 } | 154 } |
153 | 155 |
154 // Don't need to update versions of deleted nodes. | 156 // Don't need to update versions of deleted nodes. |
155 UpdateTransactionVersion(new_version, bookmark_model_, | 157 UpdateTransactionVersion(new_version, bookmark_model_, |
156 std::vector<const BookmarkNode*>()); | 158 std::vector<const BookmarkNode*>()); |
157 } | 159 } |
158 | 160 |
159 void BookmarkChangeProcessor::RemoveAllChildNodes( | 161 void BookmarkChangeProcessor::RemoveAllChildNodes( |
160 syncer::WriteTransaction* trans, const int64& topmost_node_id) { | 162 syncer::WriteTransaction* trans, const int64& topmost_node_id) { |
161 syncer::WriteNode topmost_node(trans); | 163 syncer::WriteNode topmost_node(trans); |
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
836 sync_pb::BookmarkSpecifics updated_specifics( | 838 sync_pb::BookmarkSpecifics updated_specifics( |
837 sync_node->GetBookmarkSpecifics()); | 839 sync_node->GetBookmarkSpecifics()); |
838 updated_specifics.set_favicon(favicon_bytes->front(), | 840 updated_specifics.set_favicon(favicon_bytes->front(), |
839 favicon_bytes->size()); | 841 favicon_bytes->size()); |
840 updated_specifics.set_icon_url(bookmark_node->icon_url().spec()); | 842 updated_specifics.set_icon_url(bookmark_node->icon_url().spec()); |
841 sync_node->SetBookmarkSpecifics(updated_specifics); | 843 sync_node->SetBookmarkSpecifics(updated_specifics); |
842 } | 844 } |
843 } | 845 } |
844 | 846 |
845 } // namespace browser_sync | 847 } // namespace browser_sync |
OLD | NEW |