| 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 | 10 |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 BookmarkNode::MetaInfoMap* meta_info_map, | 375 BookmarkNode::MetaInfoMap* meta_info_map, |
| 376 int64_t* sync_transaction_version) { | 376 int64_t* sync_transaction_version) { |
| 377 DCHECK(meta_info_map); | 377 DCHECK(meta_info_map); |
| 378 DCHECK(sync_transaction_version); | 378 DCHECK(sync_transaction_version); |
| 379 meta_info_map->clear(); | 379 meta_info_map->clear(); |
| 380 | 380 |
| 381 const base::Value* meta_info; | 381 const base::Value* meta_info; |
| 382 if (!value.Get(kMetaInfo, &meta_info)) | 382 if (!value.Get(kMetaInfo, &meta_info)) |
| 383 return true; | 383 return true; |
| 384 | 384 |
| 385 scoped_ptr<base::Value> deserialized_holder; | 385 std::unique_ptr<base::Value> deserialized_holder; |
| 386 | 386 |
| 387 // Meta info used to be stored as a serialized dictionary, so attempt to | 387 // Meta info used to be stored as a serialized dictionary, so attempt to |
| 388 // parse the value as one. | 388 // parse the value as one. |
| 389 if (meta_info->IsType(base::Value::TYPE_STRING)) { | 389 if (meta_info->IsType(base::Value::TYPE_STRING)) { |
| 390 std::string meta_info_str; | 390 std::string meta_info_str; |
| 391 meta_info->GetAsString(&meta_info_str); | 391 meta_info->GetAsString(&meta_info_str); |
| 392 JSONStringValueDeserializer deserializer(meta_info_str); | 392 JSONStringValueDeserializer deserializer(meta_info_str); |
| 393 deserialized_holder = deserializer.Deserialize(nullptr, nullptr); | 393 deserialized_holder = deserializer.Deserialize(nullptr, nullptr); |
| 394 if (!deserialized_holder) | 394 if (!deserialized_holder) |
| 395 return false; | 395 return false; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 base::MD5Init(&md5_context_); | 483 base::MD5Init(&md5_context_); |
| 484 } | 484 } |
| 485 | 485 |
| 486 void BookmarkCodec::FinalizeChecksum() { | 486 void BookmarkCodec::FinalizeChecksum() { |
| 487 base::MD5Digest digest; | 487 base::MD5Digest digest; |
| 488 base::MD5Final(&digest, &md5_context_); | 488 base::MD5Final(&digest, &md5_context_); |
| 489 computed_checksum_ = base::MD5DigestToBase16(digest); | 489 computed_checksum_ = base::MD5DigestToBase16(digest); |
| 490 } | 490 } |
| 491 | 491 |
| 492 } // namespace bookmarks | 492 } // namespace bookmarks |
| OLD | NEW |