OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 | 150 |
151 DecodeNode(*static_cast<DictionaryValue*>(root_folder_value), NULL, | 151 DecodeNode(*static_cast<DictionaryValue*>(root_folder_value), NULL, |
152 bb_node); | 152 bb_node); |
153 DecodeNode(*static_cast<DictionaryValue*>(other_folder_value), NULL, | 153 DecodeNode(*static_cast<DictionaryValue*>(other_folder_value), NULL, |
154 other_folder_node); | 154 other_folder_node); |
155 // Need to reset the type as decoding resets the type to FOLDER. Similarly | 155 // Need to reset the type as decoding resets the type to FOLDER. Similarly |
156 // we need to reset the title as the title is persisted and restored from | 156 // we need to reset the title as the title is persisted and restored from |
157 // the file. | 157 // the file. |
158 bb_node->set_type(BookmarkNode::BOOKMARK_BAR); | 158 bb_node->set_type(BookmarkNode::BOOKMARK_BAR); |
159 other_folder_node->set_type(BookmarkNode::OTHER_NODE); | 159 other_folder_node->set_type(BookmarkNode::OTHER_NODE); |
160 bb_node->SetTitle(l10n_util::GetString(IDS_BOOMARK_BAR_FOLDER_NAME)); | 160 bb_node->SetTitle(l10n_util::GetStringUTF16(IDS_BOOMARK_BAR_FOLDER_NAME)); |
161 other_folder_node->SetTitle( | 161 other_folder_node->SetTitle( |
162 l10n_util::GetString(IDS_BOOMARK_BAR_OTHER_FOLDER_NAME)); | 162 l10n_util::GetStringUTF16(IDS_BOOMARK_BAR_OTHER_FOLDER_NAME)); |
163 | 163 |
164 return true; | 164 return true; |
165 } | 165 } |
166 | 166 |
167 bool BookmarkCodec::DecodeChildren(const ListValue& child_value_list, | 167 bool BookmarkCodec::DecodeChildren(const ListValue& child_value_list, |
168 BookmarkNode* parent) { | 168 BookmarkNode* parent) { |
169 for (size_t i = 0; i < child_value_list.GetSize(); ++i) { | 169 for (size_t i = 0; i < child_value_list.GetSize(); ++i) { |
170 Value* child_value; | 170 Value* child_value; |
171 if (!child_value_list.Get(i, &child_value)) | 171 if (!child_value_list.Get(i, &child_value)) |
172 return false; | 172 return false; |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 | 328 |
329 void BookmarkCodec::InitializeChecksum() { | 329 void BookmarkCodec::InitializeChecksum() { |
330 MD5Init(&md5_context_); | 330 MD5Init(&md5_context_); |
331 } | 331 } |
332 | 332 |
333 void BookmarkCodec::FinalizeChecksum() { | 333 void BookmarkCodec::FinalizeChecksum() { |
334 MD5Digest digest; | 334 MD5Digest digest; |
335 MD5Final(&digest, &md5_context_); | 335 MD5Final(&digest, &md5_context_); |
336 computed_checksum_ = MD5DigestToBase16(digest); | 336 computed_checksum_ = MD5DigestToBase16(digest); |
337 } | 337 } |
OLD | NEW |