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

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

Issue 14571003: Don't display drop down arrows in rAc dialog unless there is a suggestion (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 7 years, 7 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
« no previous file with comments | « no previous file | chrome/browser/ui/autofill/autofill_dialog_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 base::android::AppendJavaStringArrayToStringVector( 198 base::android::AppendJavaStringArrayToStringVector(
199 env, jaccount_names.obj(), &account_names); 199 env, jaccount_names.obj(), &account_names);
200 return account_names; 200 return account_names;
201 } 201 }
202 202
203 // Calls from Java to C++ 203 // Calls from Java to C++
204 204
205 void AutofillDialogViewAndroid::ItemSelected(JNIEnv* env, jobject obj, 205 void AutofillDialogViewAndroid::ItemSelected(JNIEnv* env, jobject obj,
206 jint section, jint index) { 206 jint section, jint index) {
207 ui::MenuModel* menuModel = 207 ui::MenuModel* menuModel =
208 controller_->MenuModelForSection(static_cast<DialogSection>(section)); 208 controller_->MenuModelForSectionHack(static_cast<DialogSection>(section));
209 if (menuModel) 209 if (menuModel)
210 menuModel->ActivatedAt(index); 210 menuModel->ActivatedAt(index);
211 } 211 }
212 212
213 ScopedJavaLocalRef<jobject> AutofillDialogViewAndroid::GetIconForField( 213 ScopedJavaLocalRef<jobject> AutofillDialogViewAndroid::GetIconForField(
214 JNIEnv* env, 214 JNIEnv* env,
215 jobject obj, 215 jobject obj,
216 jint field_id, 216 jint field_id,
217 jstring jinput) { 217 jstring jinput) {
218 string16 input = base::android::ConvertJavaStringToUTF16(env, jinput); 218 string16 input = base::android::ConvertJavaStringToUTF16(env, jinput);
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 Java_AutofillDialogGlue_addToAutofillDialogFieldArray( 482 Java_AutofillDialogGlue_addToAutofillDialogFieldArray(
483 env, 483 env,
484 field_array.obj(), 484 field_array.obj(),
485 i, 485 i,
486 reinterpret_cast<jint>(&input), 486 reinterpret_cast<jint>(&input),
487 input.type, 487 input.type,
488 placeholder.obj(), 488 placeholder.obj(),
489 autofilled.obj()); 489 autofilled.obj());
490 } 490 }
491 491
492 ui::MenuModel* menuModel = controller_->MenuModelForSection(section); 492 ui::MenuModel* menuModel = controller_->MenuModelForSectionHack(section);
493 const int itemCount = menuModel->GetItemCount(); 493 const int itemCount = menuModel->GetItemCount();
494 ScopedJavaLocalRef<jobjectArray> menu_array = 494 ScopedJavaLocalRef<jobjectArray> menu_array =
495 Java_AutofillDialogGlue_createAutofillDialogMenuItemArray(env, 495 Java_AutofillDialogGlue_createAutofillDialogMenuItemArray(env,
496 itemCount); 496 itemCount);
497 497
498 int checkedItem = -1; 498 int checkedItem = -1;
499 499
500 for (int i = 0; i < itemCount; ++i) { 500 for (int i = 0; i < itemCount; ++i) {
501 const bool editable = IsMenuItemEditable(section, i); 501 const bool editable = IsMenuItemEditable(section, i);
502 502
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 bool AutofillDialogViewAndroid::IsMenuItemEditable(DialogSection section, 565 bool AutofillDialogViewAndroid::IsMenuItemEditable(DialogSection section,
566 int index) const { 566 int index) const {
567 // "Use billing for shipping" is not editable and it's always first. 567 // "Use billing for shipping" is not editable and it's always first.
568 if (section == SECTION_SHIPPING && index == 0) 568 if (section == SECTION_SHIPPING && index == 0)
569 return false; 569 return false;
570 570
571 // Any items except the two last ("Add..." and "Manage...") are editable. 571 // Any items except the two last ("Add..." and "Manage...") are editable.
572 // An item is editable if 572 // An item is editable if
573 // - it's not a "Manage..." (the last one), and 573 // - it's not a "Manage..." (the last one), and
574 // - it's a normal item, or it's an "Add..." and it has some data. 574 // - it's a normal item, or it's an "Add..." and it has some data.
575 ui::MenuModel* menuModel = controller_->MenuModelForSection(section); 575 ui::MenuModel* menuModel = controller_->MenuModelForSectionHack(section);
576 string16 label, sublabel; 576 string16 label, sublabel;
577 gfx::Image icon; 577 gfx::Image icon;
578 578
579 return menuModel && 579 return menuModel &&
580 index != menuModel->GetItemCount() - 1 && 580 index != menuModel->GetItemCount() - 1 &&
581 (index < menuModel->GetItemCount() - 2 || 581 (index < menuModel->GetItemCount() - 2 ||
582 CollapseUserDataIntoMenuItem(section, &label, &sublabel, &icon)); 582 CollapseUserDataIntoMenuItem(section, &label, &sublabel, &icon));
583 } 583 }
584 584
585 // TODO(aruslan): Remove/fix this once http://crbug.com/230685 is closed. 585 // TODO(aruslan): Remove/fix this once http://crbug.com/230685 is closed.
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 if (label.empty()) 731 if (label.empty())
732 return false; 732 return false;
733 733
734 *label_to_set = label; 734 *label_to_set = label;
735 *sublabel_to_set = sublabel; 735 *sublabel_to_set = sublabel;
736 *icon_to_set = icon; 736 *icon_to_set = icon;
737 return true; 737 return true;
738 } 738 }
739 739
740 } // namespace autofill 740 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/autofill/autofill_dialog_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698