| 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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_->MenuModelForSection(section); |
| 149 const int itemCount = menuModel->GetItemCount(); | 149 const int itemCount = menuModel ? menuModel->GetItemCount() : 0; |
| 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; |
| 159 | 159 |
| (...skipping 341 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 |