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