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

Unified Diff: components/translate/core/browser/language_model.cc

Issue 2649163003: [LanguageModel] Clear the model when clearing full history (Closed)
Patch Set: Rachel's comments Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: components/translate/core/browser/language_model.cc
diff --git a/components/translate/core/browser/language_model.cc b/components/translate/core/browser/language_model.cc
index 6c575499ed3f12cbcce8ee10fd5e2b9fe31da825..6899b3872e80ff7dc35ffd6c13cbc0973c00d901 100644
--- a/components/translate/core/browser/language_model.cc
+++ b/components/translate/core/browser/language_model.cc
@@ -132,4 +132,14 @@ void LanguageModel::OnPageVisited(const std::string& language_code) {
DiscountAndCleanCounters(dict);
}
+void LanguageModel::ClearHistory(base::Time begin, base::Time end) {
+ // Ignore all partial removals and react only to "entire" history removal.
+ bool is_entire_history = (begin == base::Time() && end == base::Time::Max());
+ if (!is_entire_history) {
+ return;
+ }
+
+ pref_service_->ClearPref(kLanguageModelCounters);
+}
+
} // namespace translate
« no previous file with comments | « components/translate/core/browser/language_model.h ('k') | components/translate/core/browser/language_model_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698