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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 ReassignIDsHelper(synced_folder_node); | 182 ReassignIDsHelper(synced_folder_node); |
183 } | 183 } |
184 } | 184 } |
185 | 185 |
186 // Need to reset the type as decoding resets the type to FOLDER. Similarly | 186 // Need to reset the type as decoding resets the type to FOLDER. Similarly |
187 // we need to reset the title as the title is persisted and restored from | 187 // we need to reset the title as the title is persisted and restored from |
188 // the file. | 188 // the file. |
189 bb_node->set_type(BookmarkNode::BOOKMARK_BAR); | 189 bb_node->set_type(BookmarkNode::BOOKMARK_BAR); |
190 other_folder_node->set_type(BookmarkNode::OTHER_NODE); | 190 other_folder_node->set_type(BookmarkNode::OTHER_NODE); |
191 synced_folder_node->set_type(BookmarkNode::SYNCED); | 191 synced_folder_node->set_type(BookmarkNode::SYNCED); |
192 bb_node->set_title(l10n_util::GetStringUTF16(IDS_BOOMARK_BAR_FOLDER_NAME)); | 192 bb_node->set_title(l10n_util::GetStringUTF16(IDS_BOOKMARK_BAR_FOLDER_NAME)); |
193 other_folder_node->set_title( | 193 other_folder_node->set_title( |
194 l10n_util::GetStringUTF16(IDS_BOOMARK_BAR_OTHER_FOLDER_NAME)); | 194 l10n_util::GetStringUTF16(IDS_BOOKMARK_BAR_OTHER_FOLDER_NAME)); |
195 synced_folder_node->set_title( | 195 synced_folder_node->set_title( |
196 l10n_util::GetStringUTF16(IDS_BOOMARK_BAR_SYNCED_FOLDER_NAME)); | 196 l10n_util::GetStringUTF16(IDS_BOOKMARK_BAR_SYNCED_FOLDER_NAME)); |
197 | 197 |
198 return true; | 198 return true; |
199 } | 199 } |
200 | 200 |
201 bool BookmarkCodec::DecodeChildren(const ListValue& child_value_list, | 201 bool BookmarkCodec::DecodeChildren(const ListValue& child_value_list, |
202 BookmarkNode* parent) { | 202 BookmarkNode* parent) { |
203 for (size_t i = 0; i < child_value_list.GetSize(); ++i) { | 203 for (size_t i = 0; i < child_value_list.GetSize(); ++i) { |
204 Value* child_value; | 204 Value* child_value; |
205 if (!child_value_list.Get(i, &child_value)) | 205 if (!child_value_list.Get(i, &child_value)) |
206 return false; | 206 return false; |
(...skipping 160 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 |