| 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 #ifndef CHROME_BROWSER_UI_ANDROID_INFOBARS_TRANSLATE_INFOBAR_H_ | 5 #ifndef CHROME_BROWSER_UI_ANDROID_INFOBARS_TRANSLATE_INFOBAR_H_ |
| 6 #define CHROME_BROWSER_UI_ANDROID_INFOBARS_TRANSLATE_INFOBAR_H_ | 6 #define CHROME_BROWSER_UI_ANDROID_INFOBARS_TRANSLATE_INFOBAR_H_ |
| 7 | 7 |
| 8 #include "base/android/scoped_java_ref.h" | 8 #include "base/android/scoped_java_ref.h" |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "chrome/browser/translate/chrome_translate_client.h" | 10 #include "chrome/browser/translate/chrome_translate_client.h" |
| 11 #include "chrome/browser/ui/android/infobars/infobar_android.h" | 11 #include "chrome/browser/ui/android/infobars/infobar_android.h" |
| 12 | 12 |
| 13 namespace translate { | 13 namespace translate { |
| 14 class TranslateInfoBarDelegate; | 14 class TranslateInfoBarDelegate; |
| 15 } | 15 } |
| 16 | 16 |
| 17 class TranslateInfoBar : public InfoBarAndroid { | 17 class TranslateInfoBar : public InfoBarAndroid { |
| 18 public: | 18 public: |
| 19 explicit TranslateInfoBar( | 19 explicit TranslateInfoBar( |
| 20 scoped_ptr<translate::TranslateInfoBarDelegate> delegate); | 20 scoped_ptr<translate::TranslateInfoBarDelegate> delegate); |
| 21 virtual ~TranslateInfoBar(); | 21 ~TranslateInfoBar() override; |
| 22 | 22 |
| 23 // JNI methods specific to translate. | 23 // JNI methods specific to translate. |
| 24 void ApplyTranslateOptions(JNIEnv* env, | 24 void ApplyTranslateOptions(JNIEnv* env, |
| 25 jobject obj, | 25 jobject obj, |
| 26 int source_language_index, | 26 int source_language_index, |
| 27 int target_language_index, | 27 int target_language_index, |
| 28 bool always_translate, | 28 bool always_translate, |
| 29 bool never_translate_language, | 29 bool never_translate_language, |
| 30 bool never_translate_site); | 30 bool never_translate_site); |
| 31 | 31 |
| 32 private: | 32 private: |
| 33 // InfoBarAndroid: | 33 // InfoBarAndroid: |
| 34 virtual base::android::ScopedJavaLocalRef<jobject> CreateRenderInfoBar( | 34 base::android::ScopedJavaLocalRef<jobject> CreateRenderInfoBar( |
| 35 JNIEnv* env) override; | 35 JNIEnv* env) override; |
| 36 virtual void ProcessButton(int action, | 36 void ProcessButton(int action, const std::string& action_value) override; |
| 37 const std::string& action_value) override; | 37 void PassJavaInfoBar(InfoBarAndroid* source) override; |
| 38 virtual void PassJavaInfoBar(InfoBarAndroid* source) override; | |
| 39 | 38 |
| 40 void TransferOwnership(TranslateInfoBar* destination, | 39 void TransferOwnership(TranslateInfoBar* destination, |
| 41 translate::TranslateStep new_type); | 40 translate::TranslateStep new_type); |
| 42 void SetJavaDelegate(jobject delegate); | 41 void SetJavaDelegate(jobject delegate); |
| 43 bool ShouldDisplayNeverTranslateInfoBarOnCancel(); | 42 bool ShouldDisplayNeverTranslateInfoBarOnCancel(); |
| 44 | 43 |
| 45 translate::TranslateInfoBarDelegate* GetDelegate(); | 44 translate::TranslateInfoBarDelegate* GetDelegate(); |
| 46 | 45 |
| 47 base::android::ScopedJavaGlobalRef<jobject> java_translate_delegate_; | 46 base::android::ScopedJavaGlobalRef<jobject> java_translate_delegate_; |
| 48 | 47 |
| 49 DISALLOW_COPY_AND_ASSIGN(TranslateInfoBar); | 48 DISALLOW_COPY_AND_ASSIGN(TranslateInfoBar); |
| 50 }; | 49 }; |
| 51 | 50 |
| 52 // Registers the native methods through JNI. | 51 // Registers the native methods through JNI. |
| 53 bool RegisterTranslateInfoBarDelegate(JNIEnv* env); | 52 bool RegisterTranslateInfoBarDelegate(JNIEnv* env); |
| 54 | 53 |
| 55 #endif // CHROME_BROWSER_UI_ANDROID_INFOBARS_TRANSLATE_INFOBAR_H_ | 54 #endif // CHROME_BROWSER_UI_ANDROID_INFOBARS_TRANSLATE_INFOBAR_H_ |
| OLD | NEW |