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

Unified Diff: ios/chrome/browser/ui/omnibox/omnibox_popup_material_view_controller.mm

Issue 2852553002: Remove the use of custom logic to determine search suggestion types. (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/ui/omnibox/omnibox_popup_material_view_controller.mm
diff --git a/ios/chrome/browser/ui/omnibox/omnibox_popup_material_view_controller.mm b/ios/chrome/browser/ui/omnibox/omnibox_popup_material_view_controller.mm
index 2c8477999ce16d7e20f8f479edb09c4a45e89fc3..ca1a193a9cd4e103a974747ceb7be374d608fdae 100644
--- a/ios/chrome/browser/ui/omnibox/omnibox_popup_material_view_controller.mm
+++ b/ios/chrome/browser/ui/omnibox/omnibox_popup_material_view_controller.mm
@@ -285,7 +285,7 @@ initWithPopupView:(OmniboxPopupViewIOS*)view
// suggestions. For all other search suggestions, |match.description| is the
// name of the currently selected search engine, which for mobile we suppress.
NSString* detailText = nil;
- if (![self isSearchMatch:match.type])
+ if (!AutocompleteMatch::IsSearchType(match.type))
detailText = base::SysUTF16ToNSString(match.contents);
else if (match.type == AutocompleteMatchType::SEARCH_SUGGEST_ENTITY)
detailText = base::SysUTF16ToNSString(match.description);
@@ -304,7 +304,8 @@ initWithPopupView:(OmniboxPopupViewIOS*)view
detailTextLabel.numberOfLines = 1;
} else {
const ACMatchClassifications* classifications =
- ![self isSearchMatch:match.type] ? &match.contents_class : nil;
+ !AutocompleteMatch::IsSearchType(match.type) ? &match.contents_class
+ : nil;
// The suggestion detail color should match the main text color for entity
// suggestions. For non-search suggestions (URLs), a highlight color is used
// instead.
@@ -334,12 +335,13 @@ initWithPopupView:(OmniboxPopupViewIOS*)view
// The text should be search term (|match.contents|) for searches, otherwise
// page title (|match.description|).
- base::string16 textString =
- [self isSearchMatch:match.type] ? match.contents : match.description;
+ base::string16 textString = AutocompleteMatch::IsSearchType(match.type)
+ ? match.contents
+ : match.description;
NSString* text = base::SysUTF16ToNSString(textString);
const ACMatchClassifications* textClassifications =
- [self isSearchMatch:match.type] ? &match.contents_class
- : &match.description_class;
+ AutocompleteMatch::IsSearchType(match.type) ? &match.contents_class
+ : &match.description_class;
// If for some reason the title is empty, copy the detailText.
if ([text length] == 0 && [detailText length] != 0) {
@@ -669,15 +671,6 @@ initWithPopupView:(OmniboxPopupViewIOS*)view
_alignment = alignment;
}
-- (BOOL)isSearchMatch:(const AutocompleteMatch::Type&)type {
- return (type == AutocompleteMatchType::NAVSUGGEST ||
- type == AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED ||
- type == AutocompleteMatchType::SEARCH_HISTORY ||
- type == AutocompleteMatchType::SEARCH_SUGGEST ||
- type == AutocompleteMatchType::SEARCH_SUGGEST_ENTITY ||
- type == AutocompleteMatchType::SEARCH_OTHER_ENGINE);
-}
-
- (NSMutableAttributedString*)
attributedStringWithString:(NSString*)text
classifications:(const ACMatchClassifications*)classifications
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698