| OLD | NEW |
| 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 Loading... |
| 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 #if defined(OS_ANDROID) |
| 322 int TranslateInfoBarDelegate::GetTranslationAutoAlwaysCount() { |
| 323 return prefs_->GetTranslationAutoAlwaysCount(original_language_code()); |
| 324 } |
| 325 |
| 326 int TranslateInfoBarDelegate::GetTranslationAutoNeverCount() { |
| 327 return prefs_->GetTranslationAutoNeverCount(original_language_code()); |
| 328 } |
| 329 |
| 330 void TranslateInfoBarDelegate::IncrementTranslationAutoAlwaysCount() { |
| 331 prefs_->IncrementTranslationAutoAlwaysCount(original_language_code()); |
| 332 } |
| 333 |
| 334 void TranslateInfoBarDelegate::IncrementTranslationAutoNeverCount() { |
| 335 prefs_->IncrementTranslationAutoNeverCount(original_language_code()); |
| 336 } |
| 337 #endif |
| 338 |
| 313 // static | 339 // static |
| 314 void TranslateInfoBarDelegate::GetAfterTranslateStrings( | 340 void TranslateInfoBarDelegate::GetAfterTranslateStrings( |
| 315 std::vector<base::string16>* strings, | 341 std::vector<base::string16>* strings, |
| 316 bool* swap_languages, | 342 bool* swap_languages, |
| 317 bool autodetermined_source_language) { | 343 bool autodetermined_source_language) { |
| 318 DCHECK(strings); | 344 DCHECK(strings); |
| 319 | 345 |
| 320 if (autodetermined_source_language) { | 346 if (autodetermined_source_language) { |
| 321 size_t offset; | 347 size_t offset; |
| 322 base::string16 text = l10n_util::GetStringFUTF16( | 348 base::string16 text = l10n_util::GetStringFUTF16( |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 UMA_HISTOGRAM_BOOLEAN("Translate.DeclineTranslateCloseInfobar", true); | 420 UMA_HISTOGRAM_BOOLEAN("Translate.DeclineTranslateCloseInfobar", true); |
| 395 } | 421 } |
| 396 } | 422 } |
| 397 | 423 |
| 398 TranslateInfoBarDelegate* | 424 TranslateInfoBarDelegate* |
| 399 TranslateInfoBarDelegate::AsTranslateInfoBarDelegate() { | 425 TranslateInfoBarDelegate::AsTranslateInfoBarDelegate() { |
| 400 return this; | 426 return this; |
| 401 } | 427 } |
| 402 | 428 |
| 403 } // namespace translate | 429 } // namespace translate |
| OLD | NEW |