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 "components/sync_bookmarks/bookmark_change_processor.h" | 5 #include "components/sync_bookmarks/bookmark_change_processor.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <stack> | 10 #include <stack> |
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
873 sync_node->GetBookmarkSpecifics(); | 873 sync_node->GetBookmarkSpecifics(); |
874 scoped_ptr<BookmarkNode::MetaInfoMap> meta_info_map( | 874 scoped_ptr<BookmarkNode::MetaInfoMap> meta_info_map( |
875 new BookmarkNode::MetaInfoMap); | 875 new BookmarkNode::MetaInfoMap); |
876 for (int i = 0; i < specifics.meta_info_size(); ++i) { | 876 for (int i = 0; i < specifics.meta_info_size(); ++i) { |
877 (*meta_info_map)[specifics.meta_info(i).key()] = | 877 (*meta_info_map)[specifics.meta_info(i).key()] = |
878 specifics.meta_info(i).value(); | 878 specifics.meta_info(i).value(); |
879 } | 879 } |
880 // Verifies that all entries had unique keys. | 880 // Verifies that all entries had unique keys. |
881 DCHECK_EQ(static_cast<size_t>(specifics.meta_info_size()), | 881 DCHECK_EQ(static_cast<size_t>(specifics.meta_info_size()), |
882 meta_info_map->size()); | 882 meta_info_map->size()); |
883 return meta_info_map.Pass(); | 883 return meta_info_map; |
884 } | 884 } |
885 | 885 |
886 // static | 886 // static |
887 void BookmarkChangeProcessor::SetSyncNodeMetaInfo( | 887 void BookmarkChangeProcessor::SetSyncNodeMetaInfo( |
888 const BookmarkNode* node, | 888 const BookmarkNode* node, |
889 syncer::WriteNode* sync_node) { | 889 syncer::WriteNode* sync_node) { |
890 sync_pb::BookmarkSpecifics specifics = sync_node->GetBookmarkSpecifics(); | 890 sync_pb::BookmarkSpecifics specifics = sync_node->GetBookmarkSpecifics(); |
891 const BookmarkNode::MetaInfoMap* meta_info_map = node->GetMetaInfoMap(); | 891 const BookmarkNode::MetaInfoMap* meta_info_map = node->GetMetaInfoMap(); |
892 | 892 |
893 // Compare specifics meta info to node meta info before making the change. | 893 // Compare specifics meta info to node meta info before making the change. |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
966 updated_specifics.set_icon_url(bookmark_node->icon_url().spec()); | 966 updated_specifics.set_icon_url(bookmark_node->icon_url().spec()); |
967 sync_node->SetBookmarkSpecifics(updated_specifics); | 967 sync_node->SetBookmarkSpecifics(updated_specifics); |
968 } | 968 } |
969 } | 969 } |
970 | 970 |
971 bool BookmarkChangeProcessor::CanSyncNode(const BookmarkNode* node) { | 971 bool BookmarkChangeProcessor::CanSyncNode(const BookmarkNode* node) { |
972 return bookmark_model_->client()->CanSyncNode(node); | 972 return bookmark_model_->client()->CanSyncNode(node); |
973 } | 973 } |
974 | 974 |
975 } // namespace browser_sync | 975 } // namespace browser_sync |
OLD | NEW |