Chromium Code Reviews| Index: chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm |
| diff --git a/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm b/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm |
| index fade6898f5157e459a726971b385b76c09c53089..e09ee0d517737e9da1027f40134298b071d15dad 100644 |
| --- a/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm |
| +++ b/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm |
| @@ -736,6 +736,13 @@ - (void)handleFocusEvent:(NSEvent*)event |
| } |
| } |
| +- (int)leadingDecorationIndex:(LocationBarDecoration*)decoration { |
| + for (size_t i = 0; i < leadingDecorations_.size(); ++i) |
|
Mark Mentovai
2017/04/25 20:44:31
I like to use std::find and std::distance for this
Elly Fong-Jones
2017/04/26 16:50:01
I prefer the explicit loop, but I'm not quite sure
|
| + if (leadingDecorations_[i] == decoration) |
| + return leadingDecorations_.size() - (i + 1); |
| + return -1; |
| +} |
| + |
| @end |
| @implementation AutocompleteTextFieldCell (TestingAPI) |