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 5c5b9af4bc7836a861729ec001a6a3a4d3c20acb..d47bbc154a68e894bd5d7e7cd3517107928d1fce 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; |
@@ -103,6 +104,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 */ |
@@ -137,6 +146,14 @@ public class OmniboxSuggestion { |
return mAnswerType; |
} |
+ public SuggestionAnswer getAnswer() { |
+ return mAnswer; |
+ } |
+ |
+ public boolean hasAnswer() { |
+ return mAnswer != null; |
+ } |
+ |
public String getFillIntoEdit() { |
return mFillIntoEdit; |
} |