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/translate/core/browser/translate_prefs.h" | 5 #include "components/translate/core/browser/translate_prefs.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 | 533 |
534 void TranslatePrefs::BlacklistValue(const char* pref_id, | 534 void TranslatePrefs::BlacklistValue(const char* pref_id, |
535 const std::string& value) { | 535 const std::string& value) { |
536 { | 536 { |
537 ListPrefUpdate update(prefs_, pref_id); | 537 ListPrefUpdate update(prefs_, pref_id); |
538 base::ListValue* blacklist = update.Get(); | 538 base::ListValue* blacklist = update.Get(); |
539 if (!blacklist) { | 539 if (!blacklist) { |
540 NOTREACHED() << "Unregistered translate blacklist pref"; | 540 NOTREACHED() << "Unregistered translate blacklist pref"; |
541 return; | 541 return; |
542 } | 542 } |
543 blacklist->Append(new base::StringValue(value)); | 543 blacklist->AppendString(value); |
544 } | 544 } |
545 } | 545 } |
546 | 546 |
547 void TranslatePrefs::RemoveValueFromBlacklist(const char* pref_id, | 547 void TranslatePrefs::RemoveValueFromBlacklist(const char* pref_id, |
548 const std::string& value) { | 548 const std::string& value) { |
549 ListPrefUpdate update(prefs_, pref_id); | 549 ListPrefUpdate update(prefs_, pref_id); |
550 base::ListValue* blacklist = update.Get(); | 550 base::ListValue* blacklist = update.Get(); |
551 if (!blacklist) { | 551 if (!blacklist) { |
552 NOTREACHED() << "Unregistered translate blacklist pref"; | 552 NOTREACHED() << "Unregistered translate blacklist pref"; |
553 return; | 553 return; |
554 } | 554 } |
555 base::StringValue string_value(value); | 555 base::StringValue string_value(value); |
556 blacklist->Remove(string_value, NULL); | 556 blacklist->Remove(string_value, NULL); |
557 } | 557 } |
558 | 558 |
559 bool TranslatePrefs::IsListEmpty(const char* pref_id) const { | 559 bool TranslatePrefs::IsListEmpty(const char* pref_id) const { |
560 const base::ListValue* blacklist = prefs_->GetList(pref_id); | 560 const base::ListValue* blacklist = prefs_->GetList(pref_id); |
561 return (blacklist == NULL || blacklist->empty()); | 561 return (blacklist == NULL || blacklist->empty()); |
562 } | 562 } |
563 | 563 |
564 bool TranslatePrefs::IsDictionaryEmpty(const char* pref_id) const { | 564 bool TranslatePrefs::IsDictionaryEmpty(const char* pref_id) const { |
565 const base::DictionaryValue* dict = prefs_->GetDictionary(pref_id); | 565 const base::DictionaryValue* dict = prefs_->GetDictionary(pref_id); |
566 return (dict == NULL || dict->empty()); | 566 return (dict == NULL || dict->empty()); |
567 } | 567 } |
568 | 568 |
569 } // namespace translate | 569 } // namespace translate |
OLD | NEW |