| Index: chrome/browser/ui/cocoa/website_settings/chooser_bubble_ui_cocoa.mm
|
| diff --git a/chrome/browser/ui/cocoa/website_settings/chooser_bubble_ui_cocoa.mm b/chrome/browser/ui/cocoa/website_settings/chooser_bubble_ui_cocoa.mm
|
| index 27602d31fc7a3444756d186eb1d071d3fb987816..93b445623d532f7df6e195003388c913be2a082a 100644
|
| --- a/chrome/browser/ui/cocoa/website_settings/chooser_bubble_ui_cocoa.mm
|
| +++ b/chrome/browser/ui/cocoa/website_settings/chooser_bubble_ui_cocoa.mm
|
| @@ -252,11 +252,17 @@ std::unique_ptr<BubbleUi> ChooserBubbleDelegate::BuildBubbleUi() {
|
| }
|
|
|
| - (void)onOptionRemoved:(NSInteger)index {
|
| - // |tableView_| will automatically selects the next item if the current
|
| - // item is removed, so here it tracks if the removed item is the item
|
| - // that was previously selected, if so, deselect it.
|
| - if ([tableView_ selectedRow] == index)
|
| + // |tableView_| will automatically select the removed item's next item.
|
| + // So here it tracks if the removed item is the item that was currently
|
| + // selected, if so, deselect it. Also if the removed item is before the
|
| + // currently selected item, the currently selected item's index needs to
|
| + // be adjusted by one.
|
| + NSInteger selectedRow = [tableView_ selectedRow];
|
| + if (selectedRow == index)
|
| [tableView_ deselectRow:index];
|
| + else if (selectedRow > index)
|
| + [tableView_ selectRowIndexes:[NSIndexSet indexSetWithIndex:selectedRow - 1]
|
| + byExtendingSelection:NO];
|
|
|
| [self updateTableView];
|
| }
|
|
|