| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_compact_infobar.h" | 5 #include "chrome/browser/ui/android/infobars/translate_compact_infobar.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
| 10 #include "base/android/jni_array.h" | 10 #include "base/android/jni_array.h" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 JNIEnv* env = base::android::AttachCurrentThread(); | 143 JNIEnv* env = base::android::AttachCurrentThread(); |
| 144 Java_TranslateCompactInfoBar_onPageTranslated(env, GetJavaInfoBar(), | 144 Java_TranslateCompactInfoBar_onPageTranslated(env, GetJavaInfoBar(), |
| 145 error_type); | 145 error_type); |
| 146 } | 146 } |
| 147 | 147 |
| 148 bool TranslateCompactInfoBar::ShouldAutoAlwaysTranslate() { | 148 bool TranslateCompactInfoBar::ShouldAutoAlwaysTranslate() { |
| 149 translate::TranslateInfoBarDelegate* delegate = GetDelegate(); | 149 translate::TranslateInfoBarDelegate* delegate = GetDelegate(); |
| 150 return delegate->ShouldAutoAlwaysTranslate(); | 150 return delegate->ShouldAutoAlwaysTranslate(); |
| 151 } | 151 } |
| 152 | 152 |
| 153 jboolean TranslateCompactInfoBar::ShouldAutoNeverTranslate( |
| 154 JNIEnv* env, |
| 155 const base::android::JavaParamRef<jobject>& obj) { |
| 156 translate::TranslateInfoBarDelegate* delegate = GetDelegate(); |
| 157 return delegate->ShouldAutoNeverTranslate(); |
| 158 } |
| 159 |
| 153 translate::TranslateInfoBarDelegate* TranslateCompactInfoBar::GetDelegate() { | 160 translate::TranslateInfoBarDelegate* TranslateCompactInfoBar::GetDelegate() { |
| 154 return delegate()->AsTranslateInfoBarDelegate(); | 161 return delegate()->AsTranslateInfoBarDelegate(); |
| 155 } | 162 } |
| 156 | 163 |
| 157 // Native JNI methods --------------------------------------------------------- | 164 // Native JNI methods --------------------------------------------------------- |
| 158 | 165 |
| 159 // static | 166 // static |
| 160 bool RegisterTranslateCompactInfoBar(JNIEnv* env) { | 167 bool RegisterTranslateCompactInfoBar(JNIEnv* env) { |
| 161 return RegisterNativesImpl(env); | 168 return RegisterNativesImpl(env); |
| 162 } | 169 } |
| OLD | NEW |