Commit 408491d2 authored by Robbie Gibson's avatar Robbie Gibson Committed by Commit Bot

Add rich entity suggestion to showcase

Currently, this doesn't do much because showcase has no way to fetch the
image, but the URL is there just in case.

Bug: 966429
Change-Id: I34f7bf7a329e60774c7ca314994e86123dae451d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1627374
Commit-Queue: Robbie Gibson <rkgibson@google.com>
Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#663083}
parent 6d718787
......@@ -74,6 +74,9 @@
// Suggestion for calculator.
+ (instancetype)calculatorSuggestion;
// Suggestion for a rich entity (entity with image).
+ (instancetype)richEntitySuggestion;
@end
#endif // IOS_SHOWCASE_OMNIBOX_POPUP_FAKE_AUTOCOMPLETE_SUGGESTION_H_
......@@ -513,4 +513,22 @@ NSAttributedString* calculatorText() {
return suggestion;
}
+ (instancetype)richEntitySuggestion {
FakeAutocompleteSuggestion* suggestion =
[[FakeAutocompleteSuggestion alloc] init];
suggestion.text = textString(@"Avengers : Endgame");
suggestion.detailText = detailTextString(@"Film (2019)");
// The image currently doesn't display because there is no fake
// Image Retriever, but leaving this here in case this is ever necessary.
GURL imageURL = GURL("https://encrypted-tbn0.gstatic.com/"
"images?q=tbn:ANd9GcRl35jshKCRWt76yUSKh5r0_"
"BRbWuSU1uZOCGnzq95nJ8yXUg913LciCgz-s3reyfACsrAAYg");
suggestion.icon =
[[SimpleOmniboxIcon alloc] initWithIconType:OmniboxIconTypeImage
suggestionIconType:SEARCH
isAnswer:NO
imageURL:imageURL];
return suggestion;
}
@end
......@@ -48,6 +48,7 @@
[FakeAutocompleteSuggestion currencySuggestion],
[FakeAutocompleteSuggestion translateSuggestion],
[FakeAutocompleteSuggestion calculatorSuggestion],
[FakeAutocompleteSuggestion richEntitySuggestion],
];
[self.consumer updateMatches:suggestions withAnimation:YES];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment