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

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

Issue 2779893005: Continue to clean c_str() calls. (Closed)
Patch Set: Revert changes in font_service_app.cc Created 3 years, 8 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/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/strings/string_piece.h" 10 #include "base/strings/string_piece.h"
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 std::string languages_str = base::JoinString(languages, ","); 414 std::string languages_str = base::JoinString(languages, ",");
415 prefs_->SetString(preferred_languages_pref_.c_str(), languages_str); 415 prefs_->SetString(preferred_languages_pref_.c_str(), languages_str);
416 #endif 416 #endif
417 417
418 // Save the same language list as accept languages preference as well, but we 418 // Save the same language list as accept languages preference as well, but we
419 // need to expand the language list, to make it more acceptable. For instance, 419 // need to expand the language list, to make it more acceptable. For instance,
420 // some web sites don't understand 'en-US' but 'en'. See crosbug.com/9884. 420 // some web sites don't understand 'en-US' but 'en'. See crosbug.com/9884.
421 std::vector<base::StringPiece> accept_languages; 421 std::vector<base::StringPiece> accept_languages;
422 ExpandLanguageCodes(languages, &accept_languages); 422 ExpandLanguageCodes(languages, &accept_languages);
423 std::string accept_languages_str = base::JoinString(accept_languages, ","); 423 std::string accept_languages_str = base::JoinString(accept_languages, ",");
424 prefs_->SetString(accept_languages_pref_.c_str(), accept_languages_str); 424 prefs_->SetString(accept_languages_pref_, accept_languages_str);
425 } 425 }
426 426
427 bool TranslatePrefs::CanTranslateLanguage( 427 bool TranslatePrefs::CanTranslateLanguage(
428 TranslateAcceptLanguages* accept_languages, 428 TranslateAcceptLanguages* accept_languages,
429 const std::string& language) { 429 const std::string& language) {
430 bool can_be_accept_language = 430 bool can_be_accept_language =
431 TranslateAcceptLanguages::CanBeAcceptLanguage(language); 431 TranslateAcceptLanguages::CanBeAcceptLanguage(language);
432 bool is_accept_language = accept_languages->IsAcceptLanguage(language); 432 bool is_accept_language = accept_languages->IsAcceptLanguage(language);
433 433
434 // For the translate language experiment, blocklists can be overridden. 434 // For the translate language experiment, blocklists can be overridden.
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 out_value->push_back(it); 632 out_value->push_back(it);
633 std::sort(out_value->begin(), out_value->end(), 633 std::sort(out_value->begin(), out_value->end(),
634 [](const LanguageAndProbability& left, 634 [](const LanguageAndProbability& left,
635 const LanguageAndProbability& right) { 635 const LanguageAndProbability& right) {
636 return left.second > right.second; 636 return left.second > right.second;
637 }); 637 });
638 return confidence; 638 return confidence;
639 } 639 }
640 640
641 } // namespace translate 641 } // namespace translate
OLDNEW
« no previous file with comments | « components/sync_preferences/synced_pref_change_registrar.cc ('k') | components/webcrypto/algorithms/test_helpers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698