OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 l10n_util::GetStringUTF16(IDS_BOOKMARK_BAR_OTHER_FOLDER_NAME)); | 196 l10n_util::GetStringUTF16(IDS_BOOKMARK_BAR_OTHER_FOLDER_NAME)); |
197 mobile_folder_node->SetTitle( | 197 mobile_folder_node->SetTitle( |
198 l10n_util::GetStringUTF16(IDS_BOOKMARK_BAR_MOBILE_FOLDER_NAME)); | 198 l10n_util::GetStringUTF16(IDS_BOOKMARK_BAR_MOBILE_FOLDER_NAME)); |
199 | 199 |
200 return true; | 200 return true; |
201 } | 201 } |
202 | 202 |
203 bool BookmarkCodec::DecodeChildren(const ListValue& child_value_list, | 203 bool BookmarkCodec::DecodeChildren(const ListValue& child_value_list, |
204 BookmarkNode* parent) { | 204 BookmarkNode* parent) { |
205 for (size_t i = 0; i < child_value_list.GetSize(); ++i) { | 205 for (size_t i = 0; i < child_value_list.GetSize(); ++i) { |
206 Value* child_value; | 206 const Value* child_value; |
207 if (!child_value_list.Get(i, &child_value)) | 207 if (!child_value_list.Get(i, &child_value)) |
208 return false; | 208 return false; |
209 | 209 |
210 if (child_value->GetType() != Value::TYPE_DICTIONARY) | 210 if (child_value->GetType() != Value::TYPE_DICTIONARY) |
211 return false; | 211 return false; |
212 | 212 |
213 DecodeNode(*static_cast<DictionaryValue*>(child_value), parent, NULL); | 213 DecodeNode(*static_cast<const DictionaryValue*>(child_value), parent, NULL); |
214 } | 214 } |
215 return true; | 215 return true; |
216 } | 216 } |
217 | 217 |
218 bool BookmarkCodec::DecodeNode(const DictionaryValue& value, | 218 bool BookmarkCodec::DecodeNode(const DictionaryValue& value, |
219 BookmarkNode* parent, | 219 BookmarkNode* parent, |
220 BookmarkNode* node) { | 220 BookmarkNode* node) { |
221 // If no |node| is specified, we'll create one and add it to the |parent|. | 221 // If no |node| is specified, we'll create one and add it to the |parent|. |
222 // Therefore, in that case, |parent| must be non-NULL. | 222 // Therefore, in that case, |parent| must be non-NULL. |
223 if (!node && !parent) { | 223 if (!node && !parent) { |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 | 369 |
370 void BookmarkCodec::InitializeChecksum() { | 370 void BookmarkCodec::InitializeChecksum() { |
371 base::MD5Init(&md5_context_); | 371 base::MD5Init(&md5_context_); |
372 } | 372 } |
373 | 373 |
374 void BookmarkCodec::FinalizeChecksum() { | 374 void BookmarkCodec::FinalizeChecksum() { |
375 base::MD5Digest digest; | 375 base::MD5Digest digest; |
376 base::MD5Final(&digest, &md5_context_); | 376 base::MD5Final(&digest, &md5_context_); |
377 computed_checksum_ = base::MD5DigestToBase16(digest); | 377 computed_checksum_ = base::MD5DigestToBase16(digest); |
378 } | 378 } |
OLD | NEW |