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