1 // Copyright (c) 2012 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_AUTOFILL_AUTOFILL_POPUP_VIEW_ANDROID_H_ 6 #define CHROME_BROWSER_UI_ANDROID_AUTOFILL_AUTOFILL_POPUP_VIEW_ANDROID_H_ 7 8 #include <jni.h> 9 10 #include "base/android/scoped_java_ref.h" 11 #include "base/compiler_specific.h" 12 #include "chrome/browser/ui/autofill/autofill_popup_view.h" 13 14 namespace gfx { 15 class Rect; 16 } 17 18 namespace autofill { 19 20 class AutofillPopupController; 21 22 class AutofillPopupViewAndroid : public AutofillPopupView { 23 public: 24 explicit AutofillPopupViewAndroid(AutofillPopupController* controller); 25 26 // -------------------------------------------------------------------------- 27 // Methods called from Java via JNI 28 // -------------------------------------------------------------------------- 29 // Called when an autofill item was selected. 30 void SuggestionSelected(JNIEnv* env, jobject obj, jint list_index); 31 32 void PopupDismissed(JNIEnv* env, jobject obj); 33 34 static bool RegisterAutofillPopupViewAndroid(JNIEnv* env); 35 36 protected: 37 // AutofillPopupView implementation. 38 virtual void Show() OVERRIDE; 39 virtual void Hide() OVERRIDE; 40 virtual void InvalidateRow(size_t row) OVERRIDE; 41 virtual void UpdateBoundsAndRedrawPopup() OVERRIDE; 42 43 private: 44 virtual ~AutofillPopupViewAndroid(); 45 46 AutofillPopupController* controller_; // weak. 47 48 // The corresponding java object. 49 base::android::ScopedJavaGlobalRef<jobject> java_object_; 50 51 DISALLOW_COPY_AND_ASSIGN(AutofillPopupViewAndroid); 52 }; 53 54 } // namespace autofill 55 56 #endif // CHROME_BROWSER_UI_ANDROID_AUTOFILL_AUTOFILL_POPUP_VIEW_ANDROID_H_ 57