| 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/feature_list.h" | 10 #include "base/feature_list.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "components/translate/core/browser/translate_download_manager.h" | 21 #include "components/translate/core/browser/translate_download_manager.h" |
| 22 #include "components/translate/core/browser/translate_driver.h" | 22 #include "components/translate/core/browser/translate_driver.h" |
| 23 #include "components/translate/core/browser/translate_manager.h" | 23 #include "components/translate/core/browser/translate_manager.h" |
| 24 #include "components/translate/core/common/translate_constants.h" | 24 #include "components/translate/core/common/translate_constants.h" |
| 25 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
| 26 | 26 |
| 27 namespace translate { | 27 namespace translate { |
| 28 | 28 |
| 29 namespace { | 29 namespace { |
| 30 | 30 |
| 31 // Feature flag for "Translate UI Redesign" project. | |
| 32 const base::Feature kTranslateCompactUI{"TranslateCompactUI", | |
| 33 base::FEATURE_DISABLED_BY_DEFAULT}; | |
| 34 | |
| 35 // Counts used to decide whether infobars should be shown. | 31 // Counts used to decide whether infobars should be shown. |
| 36 // Android and iOS implementations do not offer a drop down (for space reasons), | 32 // Android and iOS implementations do not offer a drop down (for space reasons), |
| 37 // so we are more aggressive about showing the shortcut to never translate. | 33 // so we are more aggressive about showing the shortcut to never translate. |
| 38 // The "Always Translate" option is always shown on iOS and Android. | 34 // The "Always Translate" option is always shown on iOS and Android. |
| 39 #if defined(OS_ANDROID) | 35 #if defined(OS_ANDROID) |
| 40 const int kAlwaysTranslateMinCount = 1; | 36 const int kAlwaysTranslateMinCount = 1; |
| 41 const int kNeverTranslateMinCount = 1; | 37 const int kNeverTranslateMinCount = 1; |
| 42 #elif defined(OS_IOS) | 38 #elif defined(OS_IOS) |
| 43 // The iOS implementation, like the Android implementation, shows the "Never | 39 // The iOS implementation, like the Android implementation, shows the "Never |
| 44 // translate" infobar after two denials. There is an offset of one because on | 40 // translate" infobar after two denials. There is an offset of one because on |
| 45 // Android the last event is not counted. | 41 // Android the last event is not counted. |
| 46 const int kAlwaysTranslateMinCount = 1; | 42 const int kAlwaysTranslateMinCount = 1; |
| 47 const int kNeverTranslateMinCount = 2; | 43 const int kNeverTranslateMinCount = 2; |
| 48 #else | 44 #else |
| 49 const int kAlwaysTranslateMinCount = 3; | 45 const int kAlwaysTranslateMinCount = 3; |
| 50 const int kNeverTranslateMinCount = 3; | 46 const int kNeverTranslateMinCount = 3; |
| 51 #endif | 47 #endif |
| 52 | 48 |
| 53 } // namespace | 49 } // namespace |
| 54 | 50 |
| 51 const base::Feature kTranslateCompactUI{"TranslateCompactUI", |
| 52 base::FEATURE_DISABLED_BY_DEFAULT}; |
| 53 |
| 55 const size_t TranslateInfoBarDelegate::kNoIndex = TranslateUIDelegate::kNoIndex; | 54 const size_t TranslateInfoBarDelegate::kNoIndex = TranslateUIDelegate::kNoIndex; |
| 56 | 55 |
| 57 TranslateInfoBarDelegate::~TranslateInfoBarDelegate() { | 56 TranslateInfoBarDelegate::~TranslateInfoBarDelegate() { |
| 58 } | 57 } |
| 59 | 58 |
| 60 infobars::InfoBarDelegate::InfoBarIdentifier | 59 infobars::InfoBarDelegate::InfoBarIdentifier |
| 61 TranslateInfoBarDelegate::GetIdentifier() const { | 60 TranslateInfoBarDelegate::GetIdentifier() const { |
| 62 return TRANSLATE_INFOBAR_DELEGATE; | 61 return TRANSLATE_INFOBAR_DELEGATE; |
| 63 } | 62 } |
| 64 | 63 |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 TranslationDeclined(); | 383 TranslationDeclined(); |
| 385 UMA_HISTOGRAM_BOOLEAN("Translate.DeclineTranslateCloseInfobar", true); | 384 UMA_HISTOGRAM_BOOLEAN("Translate.DeclineTranslateCloseInfobar", true); |
| 386 } | 385 } |
| 387 | 386 |
| 388 TranslateInfoBarDelegate* | 387 TranslateInfoBarDelegate* |
| 389 TranslateInfoBarDelegate::AsTranslateInfoBarDelegate() { | 388 TranslateInfoBarDelegate::AsTranslateInfoBarDelegate() { |
| 390 return this; | 389 return this; |
| 391 } | 390 } |
| 392 | 391 |
| 393 } // namespace translate | 392 } // namespace translate |
| OLD | NEW |