| 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 "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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 base::android::ConvertUTF16ToJavaString( | 87 base::android::ConvertUTF16ToJavaString( |
| 88 env, controller_->GetElidedLabelAt(i)); | 88 env, controller_->GetElidedLabelAt(i)); |
| 89 int android_icon_id = 0; | 89 int android_icon_id = 0; |
| 90 | 90 |
| 91 const Suggestion& suggestion = controller_->GetSuggestionAt(i); | 91 const Suggestion& suggestion = controller_->GetSuggestionAt(i); |
| 92 if (!suggestion.icon.empty()) { | 92 if (!suggestion.icon.empty()) { |
| 93 android_icon_id = ResourceMapper::MapFromChromiumId( | 93 android_icon_id = ResourceMapper::MapFromChromiumId( |
| 94 controller_->layout_model().GetIconResourceID(suggestion.icon)); | 94 controller_->layout_model().GetIconResourceID(suggestion.icon)); |
| 95 } | 95 } |
| 96 | 96 |
| 97 bool deletable = | 97 bool is_deletable = |
| 98 controller_->GetRemovalConfirmationText(i, nullptr, nullptr); | 98 controller_->GetRemovalConfirmationText(i, nullptr, nullptr); |
| 99 bool is_label_multiline = | 99 bool is_label_multiline = |
| 100 suggestion.frontend_id == | 100 suggestion.frontend_id == |
| 101 POPUP_ITEM_ID_INSECURE_CONTEXT_PAYMENT_DISABLED_MESSAGE || | 101 POPUP_ITEM_ID_INSECURE_CONTEXT_PAYMENT_DISABLED_MESSAGE || |
| 102 suggestion.frontend_id == POPUP_ITEM_ID_CREDIT_CARD_SIGNIN_PROMO; | 102 suggestion.frontend_id == POPUP_ITEM_ID_CREDIT_CARD_SIGNIN_PROMO; |
| 103 Java_AutofillPopupBridge_addToAutofillSuggestionArray( | 103 Java_AutofillPopupBridge_addToAutofillSuggestionArray( |
| 104 env, data_array, i, value, label, android_icon_id, | 104 env, data_array, i, value, label, android_icon_id, |
| 105 suggestion.frontend_id, deletable, is_label_multiline); | 105 controller_->layout_model().IsIconAtStart(suggestion.frontend_id), |
| 106 suggestion.frontend_id, is_deletable, is_label_multiline, |
| 107 suggestion.is_value_bold); |
| 106 } | 108 } |
| 107 | 109 |
| 108 Java_AutofillPopupBridge_show(env, java_object_, data_array, | 110 Java_AutofillPopupBridge_show( |
| 109 controller_->IsRTL()); | 111 env, java_object_, data_array, controller_->IsRTL(), |
| 112 controller_->layout_model().GetBackgroundColor(), |
| 113 controller_->layout_model().GetDividerColor(), |
| 114 controller_->layout_model().GetDropdownItemHeight()); |
| 110 } | 115 } |
| 111 | 116 |
| 112 void AutofillPopupViewAndroid::SuggestionSelected( | 117 void AutofillPopupViewAndroid::SuggestionSelected( |
| 113 JNIEnv* env, | 118 JNIEnv* env, |
| 114 const JavaParamRef<jobject>& obj, | 119 const JavaParamRef<jobject>& obj, |
| 115 jint list_index) { | 120 jint list_index) { |
| 116 // Race: Hide() may have already run. | 121 // Race: Hide() may have already run. |
| 117 if (controller_) | 122 if (controller_) |
| 118 controller_->AcceptSuggestion(list_index); | 123 controller_->AcceptSuggestion(list_index); |
| 119 } | 124 } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 // static | 172 // static |
| 168 AutofillPopupView* AutofillPopupView::Create( | 173 AutofillPopupView* AutofillPopupView::Create( |
| 169 AutofillPopupController* controller) { | 174 AutofillPopupController* controller) { |
| 170 if (IsKeyboardAccessoryEnabled()) | 175 if (IsKeyboardAccessoryEnabled()) |
| 171 return new AutofillKeyboardAccessoryView(controller); | 176 return new AutofillKeyboardAccessoryView(controller); |
| 172 | 177 |
| 173 return new AutofillPopupViewAndroid(controller); | 178 return new AutofillPopupViewAndroid(controller); |
| 174 } | 179 } |
| 175 | 180 |
| 176 } // namespace autofill | 181 } // namespace autofill |
| OLD | NEW |