Chromium Code Reviews| 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 #include <utility> | 10 #include <utility> |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 426 } | 426 } |
| 427 | 427 |
| 428 return true; | 428 return true; |
| 429 } | 429 } |
| 430 | 430 |
| 431 void BookmarkCodec::DecodeMetaInfoHelper( | 431 void BookmarkCodec::DecodeMetaInfoHelper( |
| 432 const base::DictionaryValue& dict, | 432 const base::DictionaryValue& dict, |
| 433 const std::string& prefix, | 433 const std::string& prefix, |
| 434 BookmarkNode::MetaInfoMap* meta_info_map) { | 434 BookmarkNode::MetaInfoMap* meta_info_map) { |
| 435 for (base::DictionaryValue::Iterator it(dict); !it.IsAtEnd(); it.Advance()) { | 435 for (base::DictionaryValue::Iterator it(dict); !it.IsAtEnd(); it.Advance()) { |
| 436 bool is_excluded = false; | |
| 437 for (const auto& excluded : excluded_meta_info_keys_) { | |
|
sky
2017/05/31 21:29:14
Sorry if I wasn't clear. I'm suggesting you harcod
ssid
2017/05/31 21:44:52
No problem. fixed it. Made it a single string. if
| |
| 438 if (it.key().find(excluded) != std::string::npos) | |
|
sky
2017/05/31 21:29:13
You don't want a find, you want a starts with, rig
ssid
2017/05/31 21:44:52
Done.
| |
| 439 is_excluded = true; | |
| 440 } | |
| 441 if (is_excluded) | |
| 442 continue; | |
| 443 | |
| 436 if (it.value().IsType(base::Value::Type::DICTIONARY)) { | 444 if (it.value().IsType(base::Value::Type::DICTIONARY)) { |
| 437 const base::DictionaryValue* subdict; | 445 const base::DictionaryValue* subdict; |
| 438 it.value().GetAsDictionary(&subdict); | 446 it.value().GetAsDictionary(&subdict); |
| 439 DecodeMetaInfoHelper(*subdict, prefix + it.key() + ".", meta_info_map); | 447 DecodeMetaInfoHelper(*subdict, prefix + it.key() + ".", meta_info_map); |
| 440 } else if (it.value().IsType(base::Value::Type::STRING)) { | 448 } else if (it.value().IsType(base::Value::Type::STRING)) { |
| 441 it.value().GetAsString(&(*meta_info_map)[prefix + it.key()]); | 449 it.value().GetAsString(&(*meta_info_map)[prefix + it.key()]); |
| 442 } | 450 } |
| 443 } | 451 } |
| 444 } | 452 } |
| 445 | 453 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 492 base::MD5Init(&md5_context_); | 500 base::MD5Init(&md5_context_); |
| 493 } | 501 } |
| 494 | 502 |
| 495 void BookmarkCodec::FinalizeChecksum() { | 503 void BookmarkCodec::FinalizeChecksum() { |
| 496 base::MD5Digest digest; | 504 base::MD5Digest digest; |
| 497 base::MD5Final(&digest, &md5_context_); | 505 base::MD5Final(&digest, &md5_context_); |
| 498 computed_checksum_ = base::MD5DigestToBase16(digest); | 506 computed_checksum_ = base::MD5DigestToBase16(digest); |
| 499 } | 507 } |
| 500 | 508 |
| 501 } // namespace bookmarks | 509 } // namespace bookmarks |
| OLD | NEW |