| 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..5c5b9af4bc7836a861729ec001a6a3a4d3c20acb 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,14 @@ public class OmniboxSuggestion {
|
| mIsDeletable = isDeletable;
|
| }
|
|
|
| + /* TODO(groby): Remove - see http://crbug.com/375482 */
|
| + public OmniboxSuggestion(int nativeType, int relevance, int transition,
|
| + String text, String description, String fillIntoEdit, String url,
|
| + String formattedUrl, boolean isStarred, boolean isDeletable) {
|
| + this(nativeType, relevance, transition, text, description, null, null, fillIntoEdit, url,
|
| + formattedUrl, isStarred, isDeletable);
|
| + }
|
| +
|
| public Type getType() {
|
| return mType;
|
| }
|
| @@ -116,6 +129,14 @@ public class OmniboxSuggestion {
|
| return mDescription;
|
| }
|
|
|
| + public String getAnswerContents() {
|
| + return mAnswerContents;
|
| + }
|
| +
|
| + public String getAnswerType() {
|
| + return mAnswerType;
|
| + }
|
| +
|
| public String getFillIntoEdit() {
|
| return mFillIntoEdit;
|
| }
|
| @@ -150,8 +171,12 @@ 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();
|
| + }
|
| + return hash;
|
| }
|
|
|
| @Override
|
| @@ -161,9 +186,16 @@ 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
|
| && mIsStarred == suggestion.mIsStarred
|
| && mIsDeletable == suggestion.mIsDeletable;
|
| }
|
|
|