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

Unified Diff: components/autofill/android/java/src/org/chromium/components/autofill/AutofillSuggestion.java

Issue 2496683003: Http Bad: Add a PopupItemId to identify http warning message (Closed)
Patch Set: address review comments Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: components/autofill/android/java/src/org/chromium/components/autofill/AutofillSuggestion.java
diff --git a/components/autofill/android/java/src/org/chromium/components/autofill/AutofillSuggestion.java b/components/autofill/android/java/src/org/chromium/components/autofill/AutofillSuggestion.java
index cfe248c61ac5de25b3877cc29d0a1842fc9a85ae..ed1f0b76d99ab2cbd2c8b51915aefab803edb480 100644
--- a/components/autofill/android/java/src/org/chromium/components/autofill/AutofillSuggestion.java
+++ b/components/autofill/android/java/src/org/chromium/components/autofill/AutofillSuggestion.java
@@ -10,6 +10,12 @@ import org.chromium.ui.DropdownItem;
* Autofill suggestion container used to store information needed for each Autofill popup entry.
*/
public class AutofillSuggestion implements DropdownItem {
+ /**
+ * The constant used to specify a http warning message in a list of Autofill suggestions.
+ * Has to be kept in sync with enum in popup_item_ids.h
+ */
+ private static final int ITEM_ID_HTTP_NOT_SECURE_WARNING_MESSAGE = -10;
+
private final String mLabel;
private final String mSublabel;
private final int mIconId;
@@ -65,6 +71,24 @@ public class AutofillSuggestion implements DropdownItem {
return mIsMultilineLabel;
}
+ @Override
+ public int getLabelFontColor() {
+ if (mSuggestionId == ITEM_ID_HTTP_NOT_SECURE_WARNING_MESSAGE) {
+ return R.color.http_bad_warning_message_text;
+ } else {
Mathieu 2016/11/14 14:40:15 no else needed when you have returned
lshang 2016/11/15 04:36:41 Done.
+ return R.drawable.dropdown_label_color;
Mathieu 2016/11/14 14:40:15 perhaps you can call the super class's getLabelFon
lshang 2016/11/15 04:36:40 Done. I added a class which implements DropdownIte
+ }
+ }
+
+ @Override
+ public int getLabelFontSize() {
+ if (mSuggestionId == ITEM_ID_HTTP_NOT_SECURE_WARNING_MESSAGE) {
+ return R.dimen.dropdown_item_smaller_label_size;
Mathieu 2016/11/14 14:40:15 This you would have to copy in your own dimens.xml
lshang 2016/11/15 04:36:40 Done.
+ } else {
Mathieu 2016/11/14 14:40:15 no else needed
lshang 2016/11/15 04:36:41 Done.
+ return R.dimen.dropdown_item_label_size;
Mathieu 2016/11/14 14:40:15 could we call the super class here?
lshang 2016/11/15 04:36:41 Done.
+ }
+ }
+
public int getSuggestionId() {
return mSuggestionId;
}

Powered by Google App Engine
This is Rietveld 408576698