| 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 ui_delegate_.RevertTranslation(); | 134 ui_delegate_.RevertTranslation(); |
| 135 infobar()->RemoveSelf(); | 135 infobar()->RemoveSelf(); |
| 136 } | 136 } |
| 137 | 137 |
| 138 void TranslateInfoBarDelegate::ReportLanguageDetectionError() { | 138 void TranslateInfoBarDelegate::ReportLanguageDetectionError() { |
| 139 if (translate_manager_) | 139 if (translate_manager_) |
| 140 translate_manager_->ReportLanguageDetectionError(); | 140 translate_manager_->ReportLanguageDetectionError(); |
| 141 } | 141 } |
| 142 | 142 |
| 143 void TranslateInfoBarDelegate::TranslationDeclined() { | 143 void TranslateInfoBarDelegate::TranslationDeclined() { |
| 144 ui_delegate_.TranslationDeclined(false); | 144 ui_delegate_.TranslationDeclined(true); |
| 145 } | 145 } |
| 146 | 146 |
| 147 bool TranslateInfoBarDelegate::IsTranslatableLanguageByPrefs() { | 147 bool TranslateInfoBarDelegate::IsTranslatableLanguageByPrefs() { |
| 148 TranslateClient* client = translate_manager_->translate_client(); | 148 TranslateClient* client = translate_manager_->translate_client(); |
| 149 scoped_ptr<TranslatePrefs> translate_prefs(client->GetTranslatePrefs()); | 149 scoped_ptr<TranslatePrefs> translate_prefs(client->GetTranslatePrefs()); |
| 150 TranslateAcceptLanguages* accept_languages = | 150 TranslateAcceptLanguages* accept_languages = |
| 151 client->GetTranslateAcceptLanguages(); | 151 client->GetTranslateAcceptLanguages(); |
| 152 return translate_prefs->CanTranslateLanguage(accept_languages, | 152 return translate_prefs->CanTranslateLanguage(accept_languages, |
| 153 original_language_code()); | 153 original_language_code()); |
| 154 } | 154 } |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 TranslationDeclined(); | 371 TranslationDeclined(); |
| 372 UMA_HISTOGRAM_BOOLEAN("Translate.DeclineTranslateCloseInfobar", true); | 372 UMA_HISTOGRAM_BOOLEAN("Translate.DeclineTranslateCloseInfobar", true); |
| 373 } | 373 } |
| 374 | 374 |
| 375 TranslateInfoBarDelegate* | 375 TranslateInfoBarDelegate* |
| 376 TranslateInfoBarDelegate::AsTranslateInfoBarDelegate() { | 376 TranslateInfoBarDelegate::AsTranslateInfoBarDelegate() { |
| 377 return this; | 377 return this; |
| 378 } | 378 } |
| 379 | 379 |
| 380 } // namespace translate | 380 } // namespace translate |
| OLD | NEW |