Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: components/translate/core/browser/translate_prefs.cc

Issue 1242023005: Remove legacy StartsWithASCII function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: y Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « components/suggestions/suggestions_service.cc ('k') | components/translate/core/language_detection/language_detection_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698