OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/bookmarks/bookmark_codec.h" | 5 #include "chrome/browser/bookmarks/bookmark_codec.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 roots->Set(kRootFolderNameKey, EncodeNode(bookmark_bar_node)); | 58 roots->Set(kRootFolderNameKey, EncodeNode(bookmark_bar_node)); |
59 roots->Set(kOtherBookmarkFolderNameKey, EncodeNode(other_folder_node)); | 59 roots->Set(kOtherBookmarkFolderNameKey, EncodeNode(other_folder_node)); |
60 roots->Set(kSyncedBookmarkFolderNameKey, EncodeNode(synced_folder_node)); | 60 roots->Set(kSyncedBookmarkFolderNameKey, EncodeNode(synced_folder_node)); |
61 | 61 |
62 DictionaryValue* main = new DictionaryValue(); | 62 DictionaryValue* main = new DictionaryValue(); |
63 main->SetInteger(kVersionKey, kCurrentVersion); | 63 main->SetInteger(kVersionKey, kCurrentVersion); |
64 FinalizeChecksum(); | 64 FinalizeChecksum(); |
65 // We are going to store the computed checksum. So set stored checksum to be | 65 // We are going to store the computed checksum. So set stored checksum to be |
66 // the same as computed checksum. | 66 // the same as computed checksum. |
67 stored_checksum_ = computed_checksum_; | 67 stored_checksum_ = computed_checksum_; |
68 main->Set(kChecksumKey, Value::CreateStringValue(computed_checksum_)); | 68 main->Set(kChecksumKey, base::StringValue::New(computed_checksum_)); |
69 main->Set(kRootsKey, roots); | 69 main->Set(kRootsKey, roots); |
70 return main; | 70 return main; |
71 } | 71 } |
72 | 72 |
73 bool BookmarkCodec::Decode(BookmarkNode* bb_node, | 73 bool BookmarkCodec::Decode(BookmarkNode* bb_node, |
74 BookmarkNode* other_folder_node, | 74 BookmarkNode* other_folder_node, |
75 BookmarkNode* synced_folder_node, | 75 BookmarkNode* synced_folder_node, |
76 int64* max_id, | 76 int64* max_id, |
77 const Value& value) { | 77 const Value& value) { |
78 ids_.clear(); | 78 ids_.clear(); |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 | 367 |
368 void BookmarkCodec::InitializeChecksum() { | 368 void BookmarkCodec::InitializeChecksum() { |
369 base::MD5Init(&md5_context_); | 369 base::MD5Init(&md5_context_); |
370 } | 370 } |
371 | 371 |
372 void BookmarkCodec::FinalizeChecksum() { | 372 void BookmarkCodec::FinalizeChecksum() { |
373 base::MD5Digest digest; | 373 base::MD5Digest digest; |
374 base::MD5Final(&digest, &md5_context_); | 374 base::MD5Final(&digest, &md5_context_); |
375 computed_checksum_ = base::MD5DigestToBase16(digest); | 375 computed_checksum_ = base::MD5DigestToBase16(digest); |
376 } | 376 } |
OLD | NEW |