| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #include "chrome/browser/ui/android/autofill/autofill_popup_view_android.h" | 5 #include "chrome/browser/ui/android/autofill/autofill_popup_view_android.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 9 #include "chrome/browser/ui/android/window_android_helper.h" | 9 #include "chrome/browser/ui/android/window_android_helper.h" |
| 10 #include "chrome/browser/ui/autofill/autofill_popup_controller.h" | 10 #include "chrome/browser/ui/autofill/autofill_popup_controller.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 content_view_core->GetWindowAndroid()->GetJavaObject().obj(), | 31 content_view_core->GetWindowAndroid()->GetJavaObject().obj(), |
| 32 content_view_core->GetContainerViewDelegate().obj())); | 32 content_view_core->GetContainerViewDelegate().obj())); |
| 33 | 33 |
| 34 UpdateBoundsAndRedrawPopup(); | 34 UpdateBoundsAndRedrawPopup(); |
| 35 } | 35 } |
| 36 | 36 |
| 37 void AutofillPopupViewAndroid::Hide() { | 37 void AutofillPopupViewAndroid::Hide() { |
| 38 AutofillPopupView::Hide(); | 38 AutofillPopupView::Hide(); |
| 39 | 39 |
| 40 JNIEnv* env = base::android::AttachCurrentThread(); | 40 JNIEnv* env = base::android::AttachCurrentThread(); |
| 41 Java_AutofillPopupGlue_dismiss(env, java_object_.obj()); | 41 Java_AutofillPopupGlue_hide(env, java_object_.obj()); |
| 42 delete this; |
| 42 } | 43 } |
| 43 | 44 |
| 44 void AutofillPopupViewAndroid::UpdateBoundsAndRedrawPopup() { | 45 void AutofillPopupViewAndroid::UpdateBoundsAndRedrawPopup() { |
| 45 JNIEnv* env = base::android::AttachCurrentThread(); | 46 JNIEnv* env = base::android::AttachCurrentThread(); |
| 46 Java_AutofillPopupGlue_setAnchorRect(env, | 47 Java_AutofillPopupGlue_setAnchorRect(env, |
| 47 java_object_.obj(), | 48 java_object_.obj(), |
| 48 controller_->element_bounds().x(), | 49 controller_->element_bounds().x(), |
| 49 controller_->element_bounds().y(), | 50 controller_->element_bounds().y(), |
| 50 controller_->element_bounds().width(), | 51 controller_->element_bounds().width(), |
| 51 controller_->element_bounds().height()); | 52 controller_->element_bounds().height()); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 77 | 78 |
| 78 Java_AutofillPopupGlue_show(env, java_object_.obj(), data_array.obj()); | 79 Java_AutofillPopupGlue_show(env, java_object_.obj(), data_array.obj()); |
| 79 } | 80 } |
| 80 | 81 |
| 81 void AutofillPopupViewAndroid::SuggestionSelected(JNIEnv* env, | 82 void AutofillPopupViewAndroid::SuggestionSelected(JNIEnv* env, |
| 82 jobject obj, | 83 jobject obj, |
| 83 jint list_index) { | 84 jint list_index) { |
| 84 controller_->AcceptSuggestion(list_index); | 85 controller_->AcceptSuggestion(list_index); |
| 85 } | 86 } |
| 86 | 87 |
| 87 void AutofillPopupViewAndroid::Dismissed(JNIEnv* env, jobject obj) { | 88 void AutofillPopupViewAndroid::RequestHide(JNIEnv* env, jobject obj) { |
| 88 delete this; | 89 controller_->Hide(); |
| 89 } | 90 } |
| 90 | 91 |
| 91 void AutofillPopupViewAndroid::InvalidateRow(size_t) {} | 92 void AutofillPopupViewAndroid::InvalidateRow(size_t) {} |
| 92 | 93 |
| 93 // static | 94 // static |
| 94 bool AutofillPopupViewAndroid::RegisterAutofillPopupViewAndroid(JNIEnv* env) { | 95 bool AutofillPopupViewAndroid::RegisterAutofillPopupViewAndroid(JNIEnv* env) { |
| 95 return RegisterNativesImpl(env); | 96 return RegisterNativesImpl(env); |
| 96 } | 97 } |
| 97 | 98 |
| 98 // static | 99 // static |
| 99 AutofillPopupView* AutofillPopupView::Create( | 100 AutofillPopupView* AutofillPopupView::Create( |
| 100 AutofillPopupController* controller) { | 101 AutofillPopupController* controller) { |
| 101 return new AutofillPopupViewAndroid(controller); | 102 return new AutofillPopupViewAndroid(controller); |
| 102 } | 103 } |
| OLD | NEW |