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

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

Issue 1525203003: [Translate] Factor out access to Accept-Languages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@translate-manager-unit
Patch Set: Fix CrOS build Created 5 years 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
« no previous file with comments | « components/translate/core/browser/translate_prefs.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 prefs_->GetDictionary(kPrefTranslateTooOftenDeniedForLanguage); 351 prefs_->GetDictionary(kPrefTranslateTooOftenDeniedForLanguage);
352 bool result = false; 352 bool result = false;
353 return dict->GetBoolean(language, &result) ? result : false; 353 return dict->GetBoolean(language, &result) ? result : false;
354 } 354 }
355 355
356 void TranslatePrefs::ResetDenialState() { 356 void TranslatePrefs::ResetDenialState() {
357 prefs_->ClearPref(kPrefTranslateLastDeniedTimeForLanguage); 357 prefs_->ClearPref(kPrefTranslateLastDeniedTimeForLanguage);
358 prefs_->ClearPref(kPrefTranslateTooOftenDeniedForLanguage); 358 prefs_->ClearPref(kPrefTranslateTooOftenDeniedForLanguage);
359 } 359 }
360 360
361 void TranslatePrefs::GetLanguageList(std::vector<std::string>* languages) { 361 void TranslatePrefs::GetLanguageList(
362 std::vector<std::string>* languages) const {
362 DCHECK(languages); 363 DCHECK(languages);
363 DCHECK(languages->empty()); 364 DCHECK(languages->empty());
364 365
365 #if defined(OS_CHROMEOS) 366 #if defined(OS_CHROMEOS)
366 const char* key = preferred_languages_pref_.c_str(); 367 const char* key = preferred_languages_pref_.c_str();
367 #else 368 #else
368 const char* key = accept_languages_pref_.c_str(); 369 const char* key = accept_languages_pref_.c_str();
369 #endif 370 #endif
370 371
371 *languages = base::SplitString(prefs_->GetString(key), ",", 372 *languages = base::SplitString(prefs_->GetString(key), ",",
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 const base::ListValue* blacklist = prefs_->GetList(pref_id); 625 const base::ListValue* blacklist = prefs_->GetList(pref_id);
625 return (blacklist == NULL || blacklist->empty()); 626 return (blacklist == NULL || blacklist->empty());
626 } 627 }
627 628
628 bool TranslatePrefs::IsDictionaryEmpty(const char* pref_id) const { 629 bool TranslatePrefs::IsDictionaryEmpty(const char* pref_id) const {
629 const base::DictionaryValue* dict = prefs_->GetDictionary(pref_id); 630 const base::DictionaryValue* dict = prefs_->GetDictionary(pref_id);
630 return (dict == NULL || dict->empty()); 631 return (dict == NULL || dict->empty());
631 } 632 }
632 633
633 } // namespace translate 634 } // namespace translate
OLDNEW
« no previous file with comments | « components/translate/core/browser/translate_prefs.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698