Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(567)

Side by Side Diff: chrome/browser/ui/android/autofill/autofill_popup_view_android.cc

Issue 2727233003: Uses child views in Autofill Popup so we can trigger (Closed)
Patch Set: (int) to NSInteger Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/command_line.h" 9 #include "base/command_line.h"
10 #include "chrome/browser/android/resource_mapper.h" 10 #include "chrome/browser/android/resource_mapper.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 DCHECK(view_android); 42 DCHECK(view_android);
43 popup_view_ = view_android->AcquireAnchorView(); 43 popup_view_ = view_android->AcquireAnchorView();
44 const ScopedJavaLocalRef<jobject> view = popup_view_.view(); 44 const ScopedJavaLocalRef<jobject> view = popup_view_.view();
45 if (view.is_null()) 45 if (view.is_null())
46 return; 46 return;
47 47
48 java_object_.Reset(Java_AutofillPopupBridge_create( 48 java_object_.Reset(Java_AutofillPopupBridge_create(
49 env, view, reinterpret_cast<intptr_t>(this), 49 env, view, reinterpret_cast<intptr_t>(this),
50 view_android->GetWindowAndroid()->GetJavaObject())); 50 view_android->GetWindowAndroid()->GetJavaObject()));
51 51
52 UpdateBoundsAndRedrawPopup(); 52 OnSuggestionsChanged();
53 } 53 }
54 54
55 void AutofillPopupViewAndroid::Hide() { 55 void AutofillPopupViewAndroid::Hide() {
56 controller_ = NULL; 56 controller_ = NULL;
57 JNIEnv* env = base::android::AttachCurrentThread(); 57 JNIEnv* env = base::android::AttachCurrentThread();
58 if (!java_object_.is_null()) { 58 if (!java_object_.is_null()) {
59 Java_AutofillPopupBridge_dismiss(env, java_object_); 59 Java_AutofillPopupBridge_dismiss(env, java_object_);
60 } else { 60 } else {
61 // Hide() should delete |this| either via Java dismiss or directly. 61 // Hide() should delete |this| either via Java dismiss or directly.
62 delete this; 62 delete this;
63 } 63 }
64 } 64 }
65 65
66 void AutofillPopupViewAndroid::UpdateBoundsAndRedrawPopup() { 66 void AutofillPopupViewAndroid::OnSelectedRowChanged(
67 base::Optional<int> previous_row_selection,
68 base::Optional<int> current_row_selection) {}
69
70 void AutofillPopupViewAndroid::OnSuggestionsChanged() {
67 if (java_object_.is_null()) 71 if (java_object_.is_null())
68 return; 72 return;
69 73
70 const ScopedJavaLocalRef<jobject> view = popup_view_.view(); 74 const ScopedJavaLocalRef<jobject> view = popup_view_.view();
71 if (view.is_null()) 75 if (view.is_null())
72 return; 76 return;
73 77
74 ui::ViewAndroid* view_android = controller_->container_view(); 78 ui::ViewAndroid* view_android = controller_->container_view();
75 79
76 DCHECK(view_android); 80 DCHECK(view_android);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 167
164 void AutofillPopupViewAndroid::PopupDismissed( 168 void AutofillPopupViewAndroid::PopupDismissed(
165 JNIEnv* env, 169 JNIEnv* env,
166 const JavaParamRef<jobject>& obj) { 170 const JavaParamRef<jobject>& obj) {
167 if (controller_) 171 if (controller_)
168 controller_->ViewDestroyed(); 172 controller_->ViewDestroyed();
169 173
170 delete this; 174 delete this;
171 } 175 }
172 176
173 void AutofillPopupViewAndroid::InvalidateRow(size_t) {}
174
175 // static 177 // static
176 bool AutofillPopupViewAndroid::RegisterAutofillPopupViewAndroid(JNIEnv* env) { 178 bool AutofillPopupViewAndroid::RegisterAutofillPopupViewAndroid(JNIEnv* env) {
177 return RegisterNativesImpl(env); 179 return RegisterNativesImpl(env);
178 } 180 }
179 181
180 // static 182 // static
181 AutofillPopupView* AutofillPopupView::Create( 183 AutofillPopupView* AutofillPopupView::Create(
182 AutofillPopupController* controller) { 184 AutofillPopupController* controller) {
183 if (IsKeyboardAccessoryEnabled()) 185 if (IsKeyboardAccessoryEnabled())
184 return new AutofillKeyboardAccessoryView(controller); 186 return new AutofillKeyboardAccessoryView(controller);
185 187
186 return new AutofillPopupViewAndroid(controller); 188 return new AutofillPopupViewAndroid(controller);
187 } 189 }
188 190
189 } // namespace autofill 191 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698