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> |
11 | 11 |
12 #include "base/json/json_string_value_serializer.h" | 12 #include "base/json/json_string_value_serializer.h" |
13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
16 #include "base/sys_info.h" | |
16 #include "base/values.h" | 17 #include "base/values.h" |
17 #include "components/bookmarks/browser/bookmark_model.h" | 18 #include "components/bookmarks/browser/bookmark_model.h" |
18 #include "components/strings/grit/components_strings.h" | 19 #include "components/strings/grit/components_strings.h" |
19 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
20 #include "url/gurl.h" | 21 #include "url/gurl.h" |
21 | 22 |
22 using base::Time; | 23 using base::Time; |
23 | 24 |
24 namespace bookmarks { | 25 namespace bookmarks { |
25 | 26 |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
426 } | 427 } |
427 | 428 |
428 return true; | 429 return true; |
429 } | 430 } |
430 | 431 |
431 void BookmarkCodec::DecodeMetaInfoHelper( | 432 void BookmarkCodec::DecodeMetaInfoHelper( |
432 const base::DictionaryValue& dict, | 433 const base::DictionaryValue& dict, |
433 const std::string& prefix, | 434 const std::string& prefix, |
434 BookmarkNode::MetaInfoMap* meta_info_map) { | 435 BookmarkNode::MetaInfoMap* meta_info_map) { |
435 for (base::DictionaryValue::Iterator it(dict); !it.IsAtEnd(); it.Advance()) { | 436 for (base::DictionaryValue::Iterator it(dict); !it.IsAtEnd(); it.Advance()) { |
437 // Do not load the image and page data into memory for low-end devices. | |
438 if (base::SysInfo::IsLowEndDevice() && | |
sky
2017/05/12 20:00:13
If we're going to support disabling this feature I
ssid
2017/05/25 00:27:27
So, I moved the strings to storage.cc and passed i
| |
439 (it.key().find("imageData") != std::string::npos || | |
440 it.key().find("pageData") != std::string::npos)) { | |
441 continue; | |
442 } | |
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 |