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

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

Issue 13607006: rAc: don't clobber user input when accepting autofill popup suggestion (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 7 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #include "chrome/browser/ui/android/autofill/autofill_dialog_view_android.h" 5 #include "chrome/browser/ui/android/autofill/autofill_dialog_view_android.h"
6 #include "base/android/jni_android.h" 6 #include "base/android/jni_android.h"
7 #include "base/android/jni_array.h" 7 #include "base/android/jni_array.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/android/scoped_java_ref.h" 9 #include "base/android/scoped_java_ref.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 ScopedJavaLocalRef<jobjectArray> jaccount_names = 97 ScopedJavaLocalRef<jobjectArray> jaccount_names =
98 base::android::ToJavaArrayOfStrings(env, account_names); 98 base::android::ToJavaArrayOfStrings(env, account_names);
99 Java_AutofillDialogGlue_updateAccountChooser( 99 Java_AutofillDialogGlue_updateAccountChooser(
100 env, java_object_.obj(), jaccount_names.obj(), selected_account_index); 100 env, java_object_.obj(), jaccount_names.obj(), selected_account_index);
101 } 101 }
102 102
103 void AutofillDialogViewAndroid::UpdateButtonStrip() { 103 void AutofillDialogViewAndroid::UpdateButtonStrip() {
104 NOTIMPLEMENTED(); 104 NOTIMPLEMENTED();
105 } 105 }
106 106
107 void AutofillDialogViewAndroid::UpdateSection(DialogSection section) { 107 void AutofillDialogViewAndroid::UpdateSection(DialogSection section,
108 UserInputAction action) {
109 // TODO(estade): respect |action|.
110
108 JNIEnv* env = base::android::AttachCurrentThread(); 111 JNIEnv* env = base::android::AttachCurrentThread();
109 const DetailInputs& updated_inputs = 112 const DetailInputs& updated_inputs =
110 controller_->RequestedFieldsForSection(section); 113 controller_->RequestedFieldsForSection(section);
111 114
112 const size_t inputCount = updated_inputs.size(); 115 const size_t inputCount = updated_inputs.size();
113 ScopedJavaLocalRef<jobjectArray> field_array = 116 ScopedJavaLocalRef<jobjectArray> field_array =
114 Java_AutofillDialogGlue_createAutofillDialogFieldArray( 117 Java_AutofillDialogGlue_createAutofillDialogFieldArray(
115 env, inputCount); 118 env, inputCount);
116 119
117 for (size_t i = 0; i < inputCount; ++i) { 120 for (size_t i = 0; i < inputCount; ++i) {
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 void AutofillDialogViewAndroid::UpdateProgressBar(double value) { 247 void AutofillDialogViewAndroid::UpdateProgressBar(double value) {
245 JNIEnv* env = base::android::AttachCurrentThread(); 248 JNIEnv* env = base::android::AttachCurrentThread();
246 Java_AutofillDialogGlue_updateProgressBar(env, java_object_.obj(), value); 249 Java_AutofillDialogGlue_updateProgressBar(env, java_object_.obj(), value);
247 } 250 }
248 251
249 void AutofillDialogViewAndroid::ModelChanged() { 252 void AutofillDialogViewAndroid::ModelChanged() {
250 JNIEnv* env = base::android::AttachCurrentThread(); 253 JNIEnv* env = base::android::AttachCurrentThread();
251 Java_AutofillDialogGlue_modelChanged( 254 Java_AutofillDialogGlue_modelChanged(
252 env, java_object_.obj(), 255 env, java_object_.obj(),
253 controller_->ShouldShowSpinner()); 256 controller_->ShouldShowSpinner());
254 UpdateSection(SECTION_EMAIL); 257 UpdateSection(SECTION_EMAIL, CLEAR_USER_INPUT);
255 UpdateSection(SECTION_CC); 258 UpdateSection(SECTION_CC, CLEAR_USER_INPUT);
256 UpdateSection(SECTION_BILLING); 259 UpdateSection(SECTION_BILLING, CLEAR_USER_INPUT);
257 UpdateSection(SECTION_CC_BILLING); 260 UpdateSection(SECTION_CC_BILLING, CLEAR_USER_INPUT);
258 UpdateSection(SECTION_SHIPPING); 261 UpdateSection(SECTION_SHIPPING, CLEAR_USER_INPUT);
259 } 262 }
260 263
261 void AutofillDialogViewAndroid::SubmitForTesting() { 264 void AutofillDialogViewAndroid::SubmitForTesting() {
262 controller_->OnAccept(); 265 controller_->OnAccept();
263 } 266 }
264 267
265 void AutofillDialogViewAndroid::CancelForTesting() { 268 void AutofillDialogViewAndroid::CancelForTesting() {
266 controller_->OnCancel(); 269 controller_->OnCancel();
267 } 270 }
268 271
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 env, error_array.obj(), i, invalid_inputs[i], error_text.obj()); 446 env, error_array.obj(), i, invalid_inputs[i], error_text.obj());
444 } 447 }
445 Java_AutofillDialogGlue_updateSectionErrors(env, 448 Java_AutofillDialogGlue_updateSectionErrors(env,
446 java_object_.obj(), 449 java_object_.obj(),
447 section, 450 section,
448 error_array.obj()); 451 error_array.obj());
449 return false; 452 return false;
450 } 453 }
451 454
452 } // namespace autofill 455 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698