| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/android/infobars/translate_infobar.h" | 5 #include "chrome/browser/ui/android/infobars/translate_infobar.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/android/jni_android.h" | 11 #include "base/android/jni_android.h" |
| 12 #include "base/android/jni_array.h" | 12 #include "base/android/jni_array.h" |
| 13 #include "base/android/jni_string.h" | 13 #include "base/android/jni_string.h" |
| 14 #include "base/android/jni_weak_ref.h" | 14 #include "base/android/jni_weak_ref.h" |
| 15 #include "base/feature_list.h" |
| 15 #include "base/memory/ptr_util.h" | 16 #include "base/memory/ptr_util.h" |
| 16 #include "chrome/browser/translate/android/translate_utils.h" | 17 #include "chrome/browser/translate/android/translate_utils.h" |
| 17 #include "chrome/browser/translate/chrome_translate_client.h" | 18 #include "chrome/browser/translate/chrome_translate_client.h" |
| 18 #include "chrome/browser/ui/android/infobars/translate_compact_infobar.h" | 19 #include "chrome/browser/ui/android/infobars/translate_compact_infobar.h" |
| 19 #include "components/translate/core/browser/translate_infobar_delegate.h" | 20 #include "components/translate/core/browser/translate_infobar_delegate.h" |
| 20 #include "jni/TranslateInfoBar_jni.h" | 21 #include "jni/TranslateInfoBar_jni.h" |
| 21 | 22 |
| 22 using base::android::JavaParamRef; | 23 using base::android::JavaParamRef; |
| 23 using base::android::ScopedJavaLocalRef; | 24 using base::android::ScopedJavaLocalRef; |
| 24 | 25 |
| 25 // ChromeTranslateClient | 26 // ChromeTranslateClient |
| 26 // ---------------------------------------------------------- | 27 // ---------------------------------------------------------- |
| 27 | 28 |
| 28 std::unique_ptr<infobars::InfoBar> ChromeTranslateClient::CreateInfoBar( | 29 std::unique_ptr<infobars::InfoBar> ChromeTranslateClient::CreateInfoBar( |
| 29 std::unique_ptr<translate::TranslateInfoBarDelegate> delegate) const { | 30 std::unique_ptr<translate::TranslateInfoBarDelegate> delegate) const { |
| 30 if (translate::TranslateInfoBarDelegate::IsCompactUIEnabled()) | 31 if (base::FeatureList::IsEnabled(translate::kTranslateCompactUI)) |
| 31 return base::MakeUnique<TranslateCompactInfoBar>(std::move(delegate)); | 32 return base::MakeUnique<TranslateCompactInfoBar>(std::move(delegate)); |
| 32 else | 33 else |
| 33 return base::MakeUnique<TranslateInfoBar>(std::move(delegate)); | 34 return base::MakeUnique<TranslateInfoBar>(std::move(delegate)); |
| 34 } | 35 } |
| 35 | 36 |
| 36 | 37 |
| 37 // TranslateInfoBar ----------------------------------------------------------- | 38 // TranslateInfoBar ----------------------------------------------------------- |
| 38 | 39 |
| 39 TranslateInfoBar::TranslateInfoBar( | 40 TranslateInfoBar::TranslateInfoBar( |
| 40 std::unique_ptr<translate::TranslateInfoBarDelegate> delegate) | 41 std::unique_ptr<translate::TranslateInfoBarDelegate> delegate) |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 translate::TranslateInfoBarDelegate* TranslateInfoBar::GetDelegate() { | 150 translate::TranslateInfoBarDelegate* TranslateInfoBar::GetDelegate() { |
| 150 return delegate()->AsTranslateInfoBarDelegate(); | 151 return delegate()->AsTranslateInfoBarDelegate(); |
| 151 } | 152 } |
| 152 | 153 |
| 153 | 154 |
| 154 // Native JNI methods --------------------------------------------------------- | 155 // Native JNI methods --------------------------------------------------------- |
| 155 | 156 |
| 156 bool RegisterTranslateInfoBarDelegate(JNIEnv* env) { | 157 bool RegisterTranslateInfoBarDelegate(JNIEnv* env) { |
| 157 return RegisterNativesImpl(env); | 158 return RegisterNativesImpl(env); |
| 158 } | 159 } |
| OLD | NEW |