Commit 11427159 authored by Stepan Khapugin's avatar Stepan Khapugin Committed by Chromium LUCI CQ

[iOS][Tail Suggest] Add formatter properties for tail suggest.

Exposes necessary tail suggest fields of an autocomplete match, wrapped
in Foundation types.

Bug: none
Change-Id: Ia8a8a1e69befc3a8e510dfa196deda1544b9290e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2571876
Commit-Queue: edchin <edchin@chromium.org>
Reviewed-by: default avataredchin <edchin@chromium.org>
Reviewed-by: default avatarRobbie Gibson <rkgibson@google.com>
Auto-Submit: Stepan Khapugin <stkhapugin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#833799}
parent 8c9c508a
......@@ -246,6 +246,19 @@ UIColor* DimColorIncognito() {
return _match.has_tab_match;
}
#pragma mark tail suggest
- (BOOL)isTailSuggestion {
return _match.type == AutocompleteMatchType::SEARCH_SUGGEST_TAIL;
}
- (NSString*)commonPrefix {
if (![self isTailSuggestion]) {
return @"";
}
return base::SysUTF16ToNSString(_match.tail_suggest_common_prefix);
}
#pragma mark helpers
// Create a string to display for an entire answer line.
......
......@@ -45,6 +45,15 @@ class GURL;
- (id<OmniboxIcon>)icon;
#pragma mark tail suggest
// Yes if this is a tail suggestion. Used by the popup to display according to
// tail suggest standards.
- (BOOL)isTailSuggestion;
// Common prefix for tail suggestions. Empty otherwise.
- (NSString*)commonPrefix;
@end
#endif // IOS_CHROME_BROWSER_UI_OMNIBOX_POPUP_AUTOCOMPLETE_SUGGESTION_H_
......@@ -29,7 +29,8 @@
@property(nonatomic, assign) GURL imageURL;
@property(nonatomic, assign) GURL faviconPageURL;
@property(nonatomic, strong) id<OmniboxIcon> icon;
@property(nonatomic, assign) BOOL isTailSuggestion;
@property(nonatomic, assign) NSString* commonPrefix;
@end
@implementation FakeAutocompleteMatch
......
......@@ -23,8 +23,9 @@
@property(nonatomic) NSAttributedString* detailText;
@property(nonatomic) NSInteger numberOfLines;
@property(nonatomic) UIImage* suggestionTypeIcon;
@property(nonatomic) id<OmniboxIcon> icon;
@property(nonatomic, assign) BOOL isTailSuggestion;
@property(nonatomic, copy) NSString* commonPrefix;
// Simple suggestion with text.
+ (instancetype)simpleSuggestion;
......
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