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