OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/translate/translate_infobar_delegate.h" | 5 #include "chrome/browser/translate/translate_infobar_delegate.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/i18n/string_compare.h" | 9 #include "base/i18n/string_compare.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 TranslateInfoBarDelegate* previous_infobar) { | 273 TranslateInfoBarDelegate* previous_infobar) { |
274 if (!previous_infobar || previous_infobar->IsError() == IsError()) | 274 if (!previous_infobar || previous_infobar->IsError() == IsError()) |
275 background_animation_ = NONE; | 275 background_animation_ = NONE; |
276 else | 276 else |
277 background_animation_ = IsError() ? NORMAL_TO_ERROR : ERROR_TO_NORMAL; | 277 background_animation_ = IsError() ? NORMAL_TO_ERROR : ERROR_TO_NORMAL; |
278 } | 278 } |
279 | 279 |
280 // static | 280 // static |
281 string16 TranslateInfoBarDelegate::GetLanguageDisplayableName( | 281 string16 TranslateInfoBarDelegate::GetLanguageDisplayableName( |
282 const std::string& language_code) { | 282 const std::string& language_code) { |
283 return l10n_util::GetDisplayNameForLocale( | 283 string16 name = l10n_util::GetDisplayNameForLocale( |
284 language_code, g_browser_process->GetApplicationLocale(), true); | 284 language_code, g_browser_process->GetApplicationLocale(), true); |
| 285 if (!TranslateManager::IsAlphaLanguage(language_code)) |
| 286 return name; |
| 287 return l10n_util::GetStringFUTF16(IDS_TRANSLATE_INFOBAR_ALPHA_LANGUAGE, |
| 288 name); |
285 } | 289 } |
286 | 290 |
287 // static | 291 // static |
288 void TranslateInfoBarDelegate::GetAfterTranslateStrings( | 292 void TranslateInfoBarDelegate::GetAfterTranslateStrings( |
289 std::vector<string16>* strings, | 293 std::vector<string16>* strings, |
290 bool* swap_languages, | 294 bool* swap_languages, |
291 bool autodetermined_source_language) { | 295 bool autodetermined_source_language) { |
292 DCHECK(strings); | 296 DCHECK(strings); |
293 | 297 |
294 if (autodetermined_source_language) { | 298 if (autodetermined_source_language) { |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 | 410 |
407 TranslateInfoBarDelegate* | 411 TranslateInfoBarDelegate* |
408 TranslateInfoBarDelegate::AsTranslateInfoBarDelegate() { | 412 TranslateInfoBarDelegate::AsTranslateInfoBarDelegate() { |
409 return this; | 413 return this; |
410 } | 414 } |
411 | 415 |
412 std::string TranslateInfoBarDelegate::GetPageHost() { | 416 std::string TranslateInfoBarDelegate::GetPageHost() { |
413 NavigationEntry* entry = web_contents()->GetController().GetActiveEntry(); | 417 NavigationEntry* entry = web_contents()->GetController().GetActiveEntry(); |
414 return entry ? entry->GetURL().HostNoBrackets() : std::string(); | 418 return entry ? entry->GetURL().HostNoBrackets() : std::string(); |
415 } | 419 } |
OLD | NEW |