+ const size_t menu_count = GetNumberOfItems();
+ DCHECK_LT(index, menu_count + omitted_item_count_);
+
+ // In the common case, valid profile-cache indices correspond to indices in
+ // the menu.
+ if (!omitted_item_count_)
+ return index;
+
+ for (size_t i = 0; i < menu_count; ++i) {
+ const AvatarMenu::Item item = GetItemAt(i);
+ if (item.profile_index == index)
+ return i;
+ }
+
+ // The desired index was not found; return a fallback value.
+ NOTREACHED();
+ return 0;