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 | 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 "components/infobars/core/infobar.h" | 11 #include "components/infobars/core/infobar.h" |
12 #include "components/infobars/core/infobar_manager.h" | 12 #include "components/infobars/core/infobar_manager.h" |
13 #include "components/translate/core/browser/language_state.h" | 13 #include "components/translate/core/browser/language_state.h" |
14 #include "components/translate/core/browser/translate_accept_languages.h" | 14 #include "components/translate/core/browser/translate_accept_languages.h" |
15 #include "components/translate/core/browser/translate_client.h" | 15 #include "components/translate/core/browser/translate_client.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_driver.h" | 17 #include "components/translate/core/browser/translate_driver.h" |
18 #include "components/translate/core/browser/translate_manager.h" | 18 #include "components/translate/core/browser/translate_manager.h" |
19 #include "components/translate/core/common/translate_constants.h" | 19 #include "components/translate/core/common/translate_constants.h" |
20 #include "grit/components_strings.h" | 20 #include "grit/components_strings.h" |
21 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
22 | 22 |
| 23 namespace translate { |
23 namespace { | 24 namespace { |
24 | 25 |
25 // Counts used to decide whether infobars should be shown. | 26 // Counts used to decide whether infobars should be shown. |
26 // Android and iOS implementations do not offer a drop down (for space reasons), | 27 // Android and iOS implementations do not offer a drop down (for space reasons), |
27 // so we are more aggressive about showing the shortcut to never translate. | 28 // so we are more aggressive about showing the shortcut to never translate. |
28 // The "Always Translate" option is always shown on iOS and Android. | 29 // The "Always Translate" option is always shown on iOS and Android. |
29 #if defined(OS_ANDROID) | 30 #if defined(OS_ANDROID) |
30 const int kAlwaysTranslateMinCount = 1; | 31 const int kAlwaysTranslateMinCount = 1; |
31 const int kNeverTranslateMinCount = 1; | 32 const int kNeverTranslateMinCount = 1; |
32 #elif defined(OS_IOS) | 33 #elif defined(OS_IOS) |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 if (!details.is_navigation_to_different_page && !details.is_main_frame) | 360 if (!details.is_navigation_to_different_page && !details.is_main_frame) |
360 return false; | 361 return false; |
361 | 362 |
362 return infobars::InfoBarDelegate::ShouldExpireInternal(details); | 363 return infobars::InfoBarDelegate::ShouldExpireInternal(details); |
363 } | 364 } |
364 | 365 |
365 TranslateInfoBarDelegate* | 366 TranslateInfoBarDelegate* |
366 TranslateInfoBarDelegate::AsTranslateInfoBarDelegate() { | 367 TranslateInfoBarDelegate::AsTranslateInfoBarDelegate() { |
367 return this; | 368 return this; |
368 } | 369 } |
| 370 |
| 371 } // namespace translate |
OLD | NEW |