| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/language_model.h" | 5 #include "components/translate/core/browser/language_model.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 base::DictionaryValue* dict = update.Get(); | 125 base::DictionaryValue* dict = update.Get(); |
| 126 int counter_value = 0; | 126 int counter_value = 0; |
| 127 // If the key |language_code| does not exist, |counter_value| stays 0. | 127 // If the key |language_code| does not exist, |counter_value| stays 0. |
| 128 dict->GetInteger(language_code, &counter_value); | 128 dict->GetInteger(language_code, &counter_value); |
| 129 dict->SetInteger(language_code, counter_value + 1); | 129 dict->SetInteger(language_code, counter_value + 1); |
| 130 | 130 |
| 131 if (GetCountersSum(*dict) > kMaxCountersSum) | 131 if (GetCountersSum(*dict) > kMaxCountersSum) |
| 132 DiscountAndCleanCounters(dict); | 132 DiscountAndCleanCounters(dict); |
| 133 } | 133 } |
| 134 | 134 |
| 135 void LanguageModel::ClearHistory(base::Time begin, base::Time end) { |
| 136 // Ignore all partial removals and react only to "entire" history removal. |
| 137 bool is_entire_history = (begin == base::Time() && end == base::Time::Max()); |
| 138 if (!is_entire_history) { |
| 139 return; |
| 140 } |
| 141 |
| 142 pref_service_->ClearPref(kLanguageModelCounters); |
| 143 } |
| 144 |
| 135 } // namespace translate | 145 } // namespace translate |
| OLD | NEW |