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 28153739c9e37cdd9019315c614ba94482922a2a..1b58616e2ca7dbb8dbfdda167180d804535c76af 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 |
@@ -19,6 +19,7 @@ public class OmniboxSuggestion { |
private final String mDescription; |
private final String mAnswerContents; |
private final String mAnswerType; |
+ private final SuggestionAnswer mAnswer; |
private final String mFillIntoEdit; |
private final String mUrl; |
private final String mFormattedUrl; |
@@ -104,6 +105,14 @@ public class OmniboxSuggestion { |
mFormattedUrl = formattedUrl; |
mIsStarred = isStarred; |
mIsDeletable = isDeletable; |
+ |
+ if (!TextUtils.isEmpty(mAnswerContents)) { |
+ // If any errors are encountered parsing the answer contents, this will return null and |
+ // hasAnswer will return false, just as if there were no answer contents at all. |
+ mAnswer = SuggestionAnswer.parseAnswerContents(mAnswerContents); |
+ } else { |
+ mAnswer = null; |
+ } |
} |
/* TODO(groby): Remove - see http://crbug.com/375482 */ |
@@ -138,6 +147,14 @@ public class OmniboxSuggestion { |
return mAnswerType; |
} |
+ public SuggestionAnswer getAnswer() { |
+ return mAnswer; |
+ } |
+ |
+ public boolean hasAnswer() { |
+ return mAnswer != null; |
+ } |
+ |
public String getFillIntoEdit() { |
return mFillIntoEdit; |
} |