Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 138 Java_AutofillDialogGlue_addToAutofillDialogFieldArray( | 138 Java_AutofillDialogGlue_addToAutofillDialogFieldArray( |
| 139 env, | 139 env, |
| 140 field_array.obj(), | 140 field_array.obj(), |
| 141 i, | 141 i, |
| 142 reinterpret_cast<jint>(&input), | 142 reinterpret_cast<jint>(&input), |
| 143 input.type, | 143 input.type, |
| 144 placeholder.obj(), | 144 placeholder.obj(), |
| 145 autofilled.obj()); | 145 autofilled.obj()); |
| 146 } | 146 } |
| 147 | 147 |
| 148 ui::MenuModel* menuModel = controller_->MenuModelForSection(section); | 148 ui::MenuModel* menuModel = controller_->MenuModelForSectionHack(section); |
| 149 const int itemCount = menuModel->GetItemCount(); | 149 const int itemCount = menuModel->GetItemCount(); |
| 150 ScopedJavaLocalRef<jobjectArray> menu_array = | 150 ScopedJavaLocalRef<jobjectArray> menu_array = |
| 151 Java_AutofillDialogGlue_createAutofillDialogMenuItemArray(env, | 151 Java_AutofillDialogGlue_createAutofillDialogMenuItemArray(env, |
| 152 itemCount); | 152 itemCount); |
| 153 | 153 |
| 154 int checkedItem = -1; | 154 int checkedItem = -1; |
| 155 | 155 |
| 156 for (int i = 0; i < itemCount; ++i) { | 156 for (int i = 0; i < itemCount; ++i) { |
| 157 if (menuModel->IsItemCheckedAt(i)) | 157 if (menuModel->IsItemCheckedAt(i)) |
| 158 checkedItem = i; | 158 checkedItem = i; |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 271 base::android::AppendJavaStringArrayToStringVector( | 271 base::android::AppendJavaStringArrayToStringVector( |
| 272 env, jaccount_names.obj(), &account_names); | 272 env, jaccount_names.obj(), &account_names); |
| 273 return account_names; | 273 return account_names; |
| 274 } | 274 } |
| 275 | 275 |
| 276 // Calls from Java to C++ | 276 // Calls from Java to C++ |
| 277 | 277 |
| 278 void AutofillDialogViewAndroid::ItemSelected(JNIEnv* env, jobject obj, | 278 void AutofillDialogViewAndroid::ItemSelected(JNIEnv* env, jobject obj, |
| 279 jint section, jint index) { | 279 jint section, jint index) { |
| 280 ui::MenuModel* menuModel = | 280 ui::MenuModel* menuModel = |
| 281 controller_->MenuModelForSection(static_cast<DialogSection>(section)); | 281 controller_->MenuModelForSection(static_cast<DialogSection>(section)); |
|
aruslan
2013/04/30 21:46:57
Please change this as well.
| |
| 282 menuModel->ActivatedAt(index); | 282 menuModel->ActivatedAt(index); |
| 283 } | 283 } |
| 284 | 284 |
| 285 ScopedJavaLocalRef<jobject> AutofillDialogViewAndroid::GetIconForField( | 285 ScopedJavaLocalRef<jobject> AutofillDialogViewAndroid::GetIconForField( |
| 286 JNIEnv* env, | 286 JNIEnv* env, |
| 287 jobject obj, | 287 jobject obj, |
| 288 jint field_id, | 288 jint field_id, |
| 289 jstring jinput) { | 289 jstring jinput) { |
| 290 string16 input = base::android::ConvertJavaStringToUTF16(env, jinput); | 290 string16 input = base::android::ConvertJavaStringToUTF16(env, jinput); |
| 291 gfx::Image icon = controller_-> | 291 gfx::Image icon = controller_-> |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 501 } | 501 } |
| 502 | 502 |
| 503 void AutofillDialogViewAndroid::UpdateSaveLocallyCheckBox() { | 503 void AutofillDialogViewAndroid::UpdateSaveLocallyCheckBox() { |
| 504 // TODO(aruslan) : Call this when at least one section is being edited. | 504 // TODO(aruslan) : Call this when at least one section is being edited. |
| 505 JNIEnv* env = base::android::AttachCurrentThread(); | 505 JNIEnv* env = base::android::AttachCurrentThread(); |
| 506 Java_AutofillDialogGlue_updateSaveLocallyCheckBox( | 506 Java_AutofillDialogGlue_updateSaveLocallyCheckBox( |
| 507 env, java_object_.obj(), controller_->ShouldOfferToSaveInChrome()); | 507 env, java_object_.obj(), controller_->ShouldOfferToSaveInChrome()); |
| 508 } | 508 } |
| 509 | 509 |
| 510 } // namespace autofill | 510 } // namespace autofill |
| OLD | NEW |