| 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/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/prefs/scoped_user_pref_update.h" | 10 #include "base/prefs/scoped_user_pref_update.h" |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 for (std::vector<std::string>::const_iterator it = | 504 for (std::vector<std::string>::const_iterator it = |
| 505 blacklisted_languages.begin(); | 505 blacklisted_languages.begin(); |
| 506 it != blacklisted_languages.end(); ++it) { | 506 it != blacklisted_languages.end(); ++it) { |
| 507 result.insert(*it); | 507 result.insert(*it); |
| 508 } | 508 } |
| 509 | 509 |
| 510 const std::string& app_locale = | 510 const std::string& app_locale = |
| 511 TranslateDownloadManager::GetInstance()->application_locale(); | 511 TranslateDownloadManager::GetInstance()->application_locale(); |
| 512 std::string ui_lang = TranslateDownloadManager::GetLanguageCode(app_locale); | 512 std::string ui_lang = TranslateDownloadManager::GetLanguageCode(app_locale); |
| 513 bool is_ui_english = | 513 bool is_ui_english = |
| 514 ui_lang == "en" || base::StartsWithASCII(ui_lang, "en-", false); | 514 ui_lang == "en" || |
| 515 base::StartsWith(ui_lang, "en-", base::CompareCase::INSENSITIVE_ASCII); |
| 515 | 516 |
| 516 for (std::vector<std::string>::const_iterator it = accept_languages.begin(); | 517 for (std::vector<std::string>::const_iterator it = accept_languages.begin(); |
| 517 it != accept_languages.end(); ++it) { | 518 it != accept_languages.end(); ++it) { |
| 518 std::string lang = *it; | 519 std::string lang = *it; |
| 519 translate::ToTranslateLanguageSynonym(&lang); | 520 translate::ToTranslateLanguageSynonym(&lang); |
| 520 | 521 |
| 521 // Regarding http://crbug.com/36182, even though English exists in Accept | 522 // Regarding http://crbug.com/36182, even though English exists in Accept |
| 522 // language list, English could be translated on non-English locale. | 523 // language list, English could be translated on non-English locale. |
| 523 if (lang == "en" && !is_ui_english) | 524 if (lang == "en" && !is_ui_english) |
| 524 continue; | 525 continue; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 const base::ListValue* blacklist = prefs_->GetList(pref_id); | 576 const base::ListValue* blacklist = prefs_->GetList(pref_id); |
| 576 return (blacklist == NULL || blacklist->empty()); | 577 return (blacklist == NULL || blacklist->empty()); |
| 577 } | 578 } |
| 578 | 579 |
| 579 bool TranslatePrefs::IsDictionaryEmpty(const char* pref_id) const { | 580 bool TranslatePrefs::IsDictionaryEmpty(const char* pref_id) const { |
| 580 const base::DictionaryValue* dict = prefs_->GetDictionary(pref_id); | 581 const base::DictionaryValue* dict = prefs_->GetDictionary(pref_id); |
| 581 return (dict == NULL || dict->empty()); | 582 return (dict == NULL || dict->empty()); |
| 582 } | 583 } |
| 583 | 584 |
| 584 } // namespace translate | 585 } // namespace translate |
| OLD | NEW |