| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/bookmarks/browser/bookmark_codec.h" | 5 #include "components/bookmarks/browser/bookmark_codec.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 BookmarkNode::kInvalidSyncTransactionVersion) { | 82 BookmarkNode::kInvalidSyncTransactionVersion) { |
| 83 roots->SetString(kSyncTransactionVersion, | 83 roots->SetString(kSyncTransactionVersion, |
| 84 base::Int64ToString(sync_transaction_version)); | 84 base::Int64ToString(sync_transaction_version)); |
| 85 } | 85 } |
| 86 base::DictionaryValue* main = new base::DictionaryValue(); | 86 base::DictionaryValue* main = new base::DictionaryValue(); |
| 87 main->SetInteger(kVersionKey, kCurrentVersion); | 87 main->SetInteger(kVersionKey, kCurrentVersion); |
| 88 FinalizeChecksum(); | 88 FinalizeChecksum(); |
| 89 // We are going to store the computed checksum. So set stored checksum to be | 89 // We are going to store the computed checksum. So set stored checksum to be |
| 90 // the same as computed checksum. | 90 // the same as computed checksum. |
| 91 stored_checksum_ = computed_checksum_; | 91 stored_checksum_ = computed_checksum_; |
| 92 main->Set(kChecksumKey, new base::StringValue(computed_checksum_)); | 92 main->Set(kChecksumKey, new base::Value(computed_checksum_)); |
| 93 main->Set(kRootsKey, roots); | 93 main->Set(kRootsKey, roots); |
| 94 return main; | 94 return main; |
| 95 } | 95 } |
| 96 | 96 |
| 97 bool BookmarkCodec::Decode(BookmarkNode* bb_node, | 97 bool BookmarkCodec::Decode(BookmarkNode* bb_node, |
| 98 BookmarkNode* other_folder_node, | 98 BookmarkNode* other_folder_node, |
| 99 BookmarkNode* mobile_folder_node, | 99 BookmarkNode* mobile_folder_node, |
| 100 int64_t* max_id, | 100 int64_t* max_id, |
| 101 const base::Value& value) { | 101 const base::Value& value) { |
| 102 ids_.clear(); | 102 ids_.clear(); |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 base::MD5Init(&md5_context_); | 492 base::MD5Init(&md5_context_); |
| 493 } | 493 } |
| 494 | 494 |
| 495 void BookmarkCodec::FinalizeChecksum() { | 495 void BookmarkCodec::FinalizeChecksum() { |
| 496 base::MD5Digest digest; | 496 base::MD5Digest digest; |
| 497 base::MD5Final(&digest, &md5_context_); | 497 base::MD5Final(&digest, &md5_context_); |
| 498 computed_checksum_ = base::MD5DigestToBase16(digest); | 498 computed_checksum_ = base::MD5DigestToBase16(digest); |
| 499 } | 499 } |
| 500 | 500 |
| 501 } // namespace bookmarks | 501 } // namespace bookmarks |
| OLD | NEW |