Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/omnibox/OmniboxSuggestion.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/OmniboxSuggestion.java b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/OmniboxSuggestion.java |
| index c4c3a0a16bb798f8ef287cd007655f7833260a59..3a7359088dddbf8e110e7ac06f28cd265c2d825d 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/OmniboxSuggestion.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/OmniboxSuggestion.java |
| @@ -17,6 +17,8 @@ public class OmniboxSuggestion { |
| private final Type mType; |
| private final String mDisplayText; |
| private final String mDescription; |
| + private final String mAnswerContents; |
| + private final String mAnswerType; |
| private final String mFillIntoEdit; |
| private final String mUrl; |
| private final String mFormattedUrl; |
| @@ -86,13 +88,16 @@ public class OmniboxSuggestion { |
| } |
| public OmniboxSuggestion(int nativeType, int relevance, int transition, |
| - String text, String description, String fillIntoEdit, String url, |
| + String text, String description, String answerContents, |
| + String answerType, String fillIntoEdit, String url, |
| String formattedUrl, boolean isStarred, boolean isDeletable) { |
| mType = Type.getTypeFromNativeType(nativeType); |
| mRelevance = relevance; |
| mTransition = transition; |
| mDisplayText = text; |
| mDescription = description; |
| + mAnswerContents = answerContents; |
| + mAnswerType = answerType; |
| mFillIntoEdit = TextUtils.isEmpty(fillIntoEdit) ? text : fillIntoEdit; |
| mUrl = url; |
| mFormattedUrl = formattedUrl; |
| @@ -100,6 +105,13 @@ public class OmniboxSuggestion { |
| mIsDeletable = isDeletable; |
| } |
| + public OmniboxSuggestion(int nativeType, int relevance, int transition, |
| + String text, String description, String fillIntoEdit, String url, |
| + String formattedUrl, boolean isStarred, boolean isDeletable) { |
|
Maria
2014/05/20 01:05:00
Please delete this constructor after after submitt
groby-ooo-7-16
2014/05/20 22:32:14
That was the plan. Filed crbug/375482 to track, ad
|
| + this(nativeType, relevance, transition, text, description, null, null, fillIntoEdit, url, |
| + formattedUrl, isStarred, isDeletable); |
| + } |
| + |
| public Type getType() { |
| return mType; |
| } |
| @@ -116,6 +128,14 @@ public class OmniboxSuggestion { |
| return mDescription; |
| } |
| + public String getAnswerContents() { |
| + return mAnswerContents; |
| + } |
| + |
| + public String getAnswerType() { |
| + return mAnswerType; |
| + } |
| + |
| public String getFillIntoEdit() { |
| return mFillIntoEdit; |
| } |
| @@ -150,8 +170,11 @@ public class OmniboxSuggestion { |
| @Override |
| public int hashCode() { |
| - return 37 * mType.mNativeType + mDisplayText.hashCode() + mFillIntoEdit.hashCode() + |
| + int hash = 37 * mType.mNativeType + mDisplayText.hashCode() + mFillIntoEdit.hashCode() + |
| (mIsStarred ? 1 : 0) + (mIsDeletable ? 1 : 0); |
| + if (mAnswerContents != null) |
| + hash = hash + mAnswerContents.hashCode(); |
|
David Trainor- moved to gerrit
2014/05/20 18:13:56
{} around if block or put on same line.
groby-ooo-7-16
2014/05/20 22:32:14
Done.
|
| + return hash; |
| } |
| @Override |
| @@ -161,9 +184,17 @@ public class OmniboxSuggestion { |
| } |
| OmniboxSuggestion suggestion = (OmniboxSuggestion) obj; |
| + |
| + boolean answersAreEqual = |
| + (mAnswerContents == null && suggestion.mAnswerContents == null) || |
| + (mAnswerContents != null && |
| + suggestion.mAnswerContents != null && |
| + mAnswerContents.equals(suggestion.mAnswerContents)); |
| return mType == suggestion.mType |
| && mFillIntoEdit.equals(suggestion.mFillIntoEdit) |
| && mDisplayText.equals(suggestion.mDisplayText) |
| + && answersAreEqual |
| + && mAnswerContents.equals(suggestion.mAnswerContents) |
|
Maria
2014/05/20 01:05:00
this line seems unnecessary since we already check
groby-ooo-7-16
2014/05/20 22:32:14
Forgot to delete - thanks for catching!
|
| && mIsStarred == suggestion.mIsStarred |
| && mIsDeletable == suggestion.mIsDeletable; |
| } |