| Index: chrome/browser/ui/cocoa/history_menu_bridge.mm
|
| diff --git a/chrome/browser/ui/cocoa/history_menu_bridge.mm b/chrome/browser/ui/cocoa/history_menu_bridge.mm
|
| index 82ac3853c6eb2becf5fd4f9750b4dc760498e5c8..2de3d122443dd374e177b5862e32bd82bab7f839 100644
|
| --- a/chrome/browser/ui/cocoa/history_menu_bridge.mm
|
| +++ b/chrome/browser/ui/cocoa/history_menu_bridge.mm
|
| @@ -137,16 +137,15 @@ void HistoryMenuBridge::TabRestoreServiceChanged(
|
| NSInteger index = [menu indexOfItemWithTag:kRecentlyClosedTitle] + 1;
|
| NSUInteger added_count = 0;
|
|
|
| - for (sessions::TabRestoreService::Entries::const_iterator it =
|
| - entries.begin();
|
| - it != entries.end() && added_count < kRecentlyClosedCount; ++it) {
|
| - sessions::TabRestoreService::Entry* entry = *it;
|
| -
|
| + for (const auto& entry : entries) {
|
| + if (added_count >= kRecentlyClosedCount)
|
| + break;
|
| // If this is a window, create a submenu for all of its tabs.
|
| if (entry->type == sessions::TabRestoreService::WINDOW) {
|
| - sessions::TabRestoreService::Window* entry_win =
|
| - (sessions::TabRestoreService::Window*)entry;
|
| - std::vector<sessions::TabRestoreService::Tab>& tabs = entry_win->tabs;
|
| + const auto* entry_win =
|
| + static_cast<sessions::TabRestoreService::Window*>(entry.get());
|
| + const std::vector<std::unique_ptr<sessions::TabRestoreService::Tab>>&
|
| + tabs = entry_win->tabs;
|
| if (tabs.empty())
|
| continue;
|
|
|
| @@ -178,9 +177,8 @@ void HistoryMenuBridge::TabRestoreServiceChanged(
|
|
|
| // Loop over the window's tabs and add them to the submenu.
|
| NSInteger subindex = [[submenu itemArray] count];
|
| - std::vector<sessions::TabRestoreService::Tab>::const_iterator it;
|
| - for (it = tabs.begin(); it != tabs.end(); ++it) {
|
| - HistoryItem* tab_item = HistoryItemForTab(*it);
|
| + for (const auto& tab : tabs) {
|
| + HistoryItem* tab_item = HistoryItemForTab(*tab);
|
| if (tab_item) {
|
| item->tabs.push_back(tab_item);
|
| AddItemToMenu(tab_item, submenu.get(), kRecentlyClosed + 1,
|
| @@ -203,9 +201,8 @@ void HistoryMenuBridge::TabRestoreServiceChanged(
|
| ++added_count;
|
| }
|
| } else if (entry->type == sessions::TabRestoreService::TAB) {
|
| - sessions::TabRestoreService::Tab* tab =
|
| - static_cast<sessions::TabRestoreService::Tab*>(entry);
|
| - HistoryItem* item = HistoryItemForTab(*tab);
|
| + const auto& tab = static_cast<sessions::TabRestoreService::Tab&>(*entry);
|
| + HistoryItem* item = HistoryItemForTab(tab);
|
| if (item) {
|
| AddItemToMenu(item, menu, kRecentlyClosed, index++);
|
| ++added_count;
|
|
|