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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/omnibox/AutocompleteController.java

Issue 332943002: [AiS] Add a structured representation of Answer JSON. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 months 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: chrome/android/java/src/org/chromium/chrome/browser/omnibox/AutocompleteController.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/AutocompleteController.java b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/AutocompleteController.java
index 2835c612904ac874983f808944c923e87f8e1f31..dba52a053ff25717fd13ebde3ec7b1df78e33803 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/AutocompleteController.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/AutocompleteController.java
@@ -9,6 +9,7 @@ import android.text.TextUtils;
import com.google.common.annotations.VisibleForTesting;
import org.chromium.base.CalledByNative;
+import org.chromium.chrome.browser.omnibox.OmniboxSuggestion.Type;
import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.content_public.browser.WebContents;
@@ -209,6 +210,14 @@ public class AutocompleteController {
@CalledByNative
private static void addOmniboxSuggestionToList(List<OmniboxSuggestion> suggestionList,
OmniboxSuggestion suggestion) {
+ // Don't add answer suggestions if their answer contents were malformed and failed to parse
+ // (and thus populate the answer property).
+ // TODO(jdonnelly): Land the new type CL before landing this CL then switch to the
+ // type-based check:
+ //if (suggestion.getType() == SEARCH_SUGGEST_ANSWER && !suggestion.hasAnswer()) {
+ if (!TextUtils.isEmpty(suggestion.getAnswerContents()) && !suggestion.hasAnswer()) {
Ted C 2014/06/13 23:54:16 I just remembered that we log selections based on
Justin Donnelly 2014/06/16 19:32:54 Well, on further reflection, maybe fallback is bet
Justin Donnelly 2014/06/17 21:34:03 Per our discussion yesterday, removed this code.
+ return;
+ }
suggestionList.add(suggestion);
}

Powered by Google App Engine
This is Rietveld 408576698