| 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 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 } | 561 } |
| 562 | 562 |
| 563 void TranslatePrefs::RemoveValueFromBlacklist(const char* pref_id, | 563 void TranslatePrefs::RemoveValueFromBlacklist(const char* pref_id, |
| 564 const std::string& value) { | 564 const std::string& value) { |
| 565 ListPrefUpdate update(prefs_, pref_id); | 565 ListPrefUpdate update(prefs_, pref_id); |
| 566 base::ListValue* blacklist = update.Get(); | 566 base::ListValue* blacklist = update.Get(); |
| 567 if (!blacklist) { | 567 if (!blacklist) { |
| 568 NOTREACHED() << "Unregistered translate blacklist pref"; | 568 NOTREACHED() << "Unregistered translate blacklist pref"; |
| 569 return; | 569 return; |
| 570 } | 570 } |
| 571 base::StringValue string_value(value); | 571 base::Value string_value(value); |
| 572 blacklist->Remove(string_value, NULL); | 572 blacklist->Remove(string_value, NULL); |
| 573 } | 573 } |
| 574 | 574 |
| 575 bool TranslatePrefs::IsListEmpty(const char* pref_id) const { | 575 bool TranslatePrefs::IsListEmpty(const char* pref_id) const { |
| 576 const base::ListValue* blacklist = prefs_->GetList(pref_id); | 576 const base::ListValue* blacklist = prefs_->GetList(pref_id); |
| 577 return (blacklist == NULL || blacklist->empty()); | 577 return (blacklist == NULL || blacklist->empty()); |
| 578 } | 578 } |
| 579 | 579 |
| 580 bool TranslatePrefs::IsDictionaryEmpty(const char* pref_id) const { | 580 bool TranslatePrefs::IsDictionaryEmpty(const char* pref_id) const { |
| 581 const base::DictionaryValue* dict = prefs_->GetDictionary(pref_id); | 581 const base::DictionaryValue* dict = prefs_->GetDictionary(pref_id); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 out_value->push_back(it); | 630 out_value->push_back(it); |
| 631 std::sort(out_value->begin(), out_value->end(), | 631 std::sort(out_value->begin(), out_value->end(), |
| 632 [](const LanguageAndProbability& left, | 632 [](const LanguageAndProbability& left, |
| 633 const LanguageAndProbability& right) { | 633 const LanguageAndProbability& right) { |
| 634 return left.second > right.second; | 634 return left.second > right.second; |
| 635 }); | 635 }); |
| 636 return confidence; | 636 return confidence; |
| 637 } | 637 } |
| 638 | 638 |
| 639 } // namespace translate | 639 } // namespace translate |
| OLD | NEW |