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

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

Issue 2920953002: Auto-always/never can at most triggered twice (new translate infobar) (Closed)
Patch Set: 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
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_infobar_delegate.h" 5 #include "components/translate/core/browser/translate_infobar_delegate.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/i18n/string_compare.h" 10 #include "base/i18n/string_compare.h"
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 #endif 303 #endif
304 304
305 int TranslateInfoBarDelegate::GetTranslationAcceptedCount() { 305 int TranslateInfoBarDelegate::GetTranslationAcceptedCount() {
306 return prefs_->GetTranslationAcceptedCount(original_language_code()); 306 return prefs_->GetTranslationAcceptedCount(original_language_code());
307 } 307 }
308 308
309 int TranslateInfoBarDelegate::GetTranslationDeniedCount() { 309 int TranslateInfoBarDelegate::GetTranslationDeniedCount() {
310 return prefs_->GetTranslationDeniedCount(original_language_code()); 310 return prefs_->GetTranslationDeniedCount(original_language_code());
311 } 311 }
312 312
313 void TranslateInfoBarDelegate::ResetTranslationAcceptedCount() {
314 prefs_->ResetTranslationAcceptedCount(original_language_code());
315 }
316
317 void TranslateInfoBarDelegate::ResetTranslationDeniedCount() {
318 prefs_->ResetTranslationDeniedCount(original_language_code());
319 }
320
321 int TranslateInfoBarDelegate::GetTranslationAutoAlwaysCount() {
322 return prefs_->GetTranslationAutoAlwaysCount(original_language_code());
323 }
324
325 int TranslateInfoBarDelegate::GetTranslationAutoNeverCount() {
326 return prefs_->GetTranslationAutoNeverCount(original_language_code());
327 }
328
329 void TranslateInfoBarDelegate::IncrementTranslationAutoAlwaysCount() {
330 prefs_->IncrementTranslationAutoAlwaysCount(original_language_code());
331 }
332
333 void TranslateInfoBarDelegate::IncrementTranslationAutoNeverCount() {
334 prefs_->IncrementTranslationAutoNeverCount(original_language_code());
335 }
336
313 // static 337 // static
314 void TranslateInfoBarDelegate::GetAfterTranslateStrings( 338 void TranslateInfoBarDelegate::GetAfterTranslateStrings(
315 std::vector<base::string16>* strings, 339 std::vector<base::string16>* strings,
316 bool* swap_languages, 340 bool* swap_languages,
317 bool autodetermined_source_language) { 341 bool autodetermined_source_language) {
318 DCHECK(strings); 342 DCHECK(strings);
319 343
320 if (autodetermined_source_language) { 344 if (autodetermined_source_language) {
321 size_t offset; 345 size_t offset;
322 base::string16 text = l10n_util::GetStringFUTF16( 346 base::string16 text = l10n_util::GetStringFUTF16(
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 UMA_HISTOGRAM_BOOLEAN("Translate.DeclineTranslateCloseInfobar", true); 418 UMA_HISTOGRAM_BOOLEAN("Translate.DeclineTranslateCloseInfobar", true);
395 } 419 }
396 } 420 }
397 421
398 TranslateInfoBarDelegate* 422 TranslateInfoBarDelegate*
399 TranslateInfoBarDelegate::AsTranslateInfoBarDelegate() { 423 TranslateInfoBarDelegate::AsTranslateInfoBarDelegate() {
400 return this; 424 return this;
401 } 425 }
402 426
403 } // namespace translate 427 } // namespace translate
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698