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

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

Issue 2919313003: Reset counters for all language when reset translate settings (Closed)
Patch Set: sync and merge Created 3 years, 6 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
« no previous file with comments | « no previous file | 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 #include <utility> 8 #include <utility>
9 9
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 } 179 }
180 180
181 std::string TranslatePrefs::GetCountry() const { 181 std::string TranslatePrefs::GetCountry() const {
182 return country_; 182 return country_;
183 } 183 }
184 184
185 void TranslatePrefs::ResetToDefaults() { 185 void TranslatePrefs::ResetToDefaults() {
186 ClearBlockedLanguages(); 186 ClearBlockedLanguages();
187 ClearBlacklistedSites(); 187 ClearBlacklistedSites();
188 ClearWhitelistedLanguagePairs(); 188 ClearWhitelistedLanguagePairs();
189 prefs_->ClearPref(kPrefTranslateDeniedCount);
190 prefs_->ClearPref(kPrefTranslateIgnoredCount);
191 prefs_->ClearPref(kPrefTranslateAcceptedCount);
189 192
190 std::vector<std::string> languages;
191 GetLanguageList(&languages);
192 for (std::vector<std::string>::const_iterator it = languages.begin();
193 it != languages.end(); ++it) {
194 const std::string& language = *it;
195 ResetTranslationAcceptedCount(language);
196 ResetTranslationDeniedCount(language);
197 ResetTranslationIgnoredCount(language);
198 }
199 #if defined(OS_ANDROID) 193 #if defined(OS_ANDROID)
200 prefs_->ClearPref(kPrefTranslateAutoAlwaysCount); 194 prefs_->ClearPref(kPrefTranslateAutoAlwaysCount);
201 prefs_->ClearPref(kPrefTranslateAutoNeverCount); 195 prefs_->ClearPref(kPrefTranslateAutoNeverCount);
202 #endif 196 #endif
203 197
204 prefs_->ClearPref(kPrefTranslateLastDeniedTimeForLanguage); 198 prefs_->ClearPref(kPrefTranslateLastDeniedTimeForLanguage);
205 prefs_->ClearPref(kPrefTranslateTooOftenDeniedForLanguage); 199 prefs_->ClearPref(kPrefTranslateTooOftenDeniedForLanguage);
206 } 200 }
207 201
208 bool TranslatePrefs::IsBlockedLanguage( 202 bool TranslatePrefs::IsBlockedLanguage(
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 out_value->push_back(it); 699 out_value->push_back(it);
706 std::sort(out_value->begin(), out_value->end(), 700 std::sort(out_value->begin(), out_value->end(),
707 [](const LanguageAndProbability& left, 701 [](const LanguageAndProbability& left,
708 const LanguageAndProbability& right) { 702 const LanguageAndProbability& right) {
709 return left.second > right.second; 703 return left.second > right.second;
710 }); 704 });
711 return confidence; 705 return confidence;
712 } 706 }
713 707
714 } // namespace translate 708 } // namespace translate
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698