| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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" |
| 11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
| 12 #include "chrome/browser/infobars/infobar_service.h" | 12 #include "chrome/browser/infobars/infobar_service.h" |
| 13 #include "chrome/browser/translate/translate_tab_helper.h" | 13 #include "chrome/browser/translate/translate_tab_helper.h" |
| 14 #include "components/infobars/core/infobar.h" | 14 #include "components/infobars/core/infobar.h" |
| 15 #include "components/translate/core/browser/translate_accept_languages.h" | 15 #include "components/translate/core/browser/translate_accept_languages.h" |
| 16 #include "components/translate/core/browser/translate_download_manager.h" | 16 #include "components/translate/core/browser/translate_download_manager.h" |
| 17 #include "components/translate/core/browser/translate_manager.h" | 17 #include "components/translate/core/browser/translate_manager.h" |
| 18 #include "components/translate/core/common/translate_constants.h" | 18 #include "components/translate/core/common/translate_constants.h" |
| 19 #include "content/public/browser/browser_context.h" | 19 #include "content/public/browser/browser_context.h" |
| 20 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
| 21 #include "grit/generated_resources.h" | 21 #include "grit/component_strings.h" |
| 22 #include "grit/theme_resources.h" | 22 #include "grit/theme_resources.h" |
| 23 #include "third_party/icu/source/i18n/unicode/coll.h" | 23 #include "third_party/icu/source/i18n/unicode/coll.h" |
| 24 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
| 25 | 25 |
| 26 namespace { | 26 namespace { |
| 27 | 27 |
| 28 // Counts used to decide whether infobars should be shown. | 28 // Counts used to decide whether infobars should be shown. |
| 29 // Android and iOS implementations do not offer a drop down (for space reasons), | 29 // Android and iOS implementations do not offer a drop down (for space reasons), |
| 30 // so we are more aggressive about showing the shortcut to never translate. | 30 // so we are more aggressive about showing the shortcut to never translate. |
| 31 // The "Always Translate" option is always shown on iOS and Android. | 31 // The "Always Translate" option is always shown on iOS and Android. |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 if (!details.is_navigation_to_different_page && !details.is_main_frame) | 370 if (!details.is_navigation_to_different_page && !details.is_main_frame) |
| 371 return false; | 371 return false; |
| 372 | 372 |
| 373 return infobars::InfoBarDelegate::ShouldExpireInternal(details); | 373 return infobars::InfoBarDelegate::ShouldExpireInternal(details); |
| 374 } | 374 } |
| 375 | 375 |
| 376 TranslateInfoBarDelegate* | 376 TranslateInfoBarDelegate* |
| 377 TranslateInfoBarDelegate::AsTranslateInfoBarDelegate() { | 377 TranslateInfoBarDelegate::AsTranslateInfoBarDelegate() { |
| 378 return this; | 378 return this; |
| 379 } | 379 } |
| OLD | NEW |