Index: chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc |
diff --git a/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc b/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc |
index c8e5fd264e797b70d45047ec0ee82caf2dcafdff..90b6687a3c3fc63842ee5c10954cf200980d9fb8 100644 |
--- a/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc |
+++ b/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc |
@@ -440,27 +440,28 @@ void RecentTabsSubMenuModel::BuildLocalEntries() { |
#endif |
int added_count = 0; |
- sessions::TabRestoreService::Entries entries = service->entries(); |
- for (sessions::TabRestoreService::Entries::const_iterator it = |
- entries.begin(); |
- it != entries.end() && added_count < kMaxLocalEntries; ++it) { |
- sessions::TabRestoreService::Entry* entry = *it; |
- if (entry->type == sessions::TabRestoreService::TAB) { |
- sessions::TabRestoreService::Tab* tab = |
- static_cast<sessions::TabRestoreService::Tab*>(entry); |
- const sessions::SerializedNavigationEntry& current_navigation = |
- tab->navigations.at(tab->current_navigation_index); |
- BuildLocalTabItem( |
- entry->id, |
- current_navigation.title(), |
- current_navigation.virtual_url(), |
- ++last_local_model_index_); |
- } else { |
- DCHECK_EQ(entry->type, sessions::TabRestoreService::WINDOW); |
- BuildLocalWindowItem( |
- entry->id, static_cast<sessions::TabRestoreService::Window*>(entry) |
- ->tabs.size(), |
- ++last_local_model_index_); |
+ for (const auto& entry : service->entries()) { |
+ if (added_count == kMaxLocalEntries) |
+ break; |
+ switch (entry->type) { |
+ case sessions::TabRestoreService::TAB: { |
+ auto& tab = |
+ static_cast<const sessions::TabRestoreService::Tab&>(*entry); |
+ const sessions::SerializedNavigationEntry& current_navigation = |
+ tab.navigations.at(tab.current_navigation_index); |
+ BuildLocalTabItem(entry->id, current_navigation.title(), |
+ current_navigation.virtual_url(), |
+ ++last_local_model_index_); |
+ break; |
+ } |
+ case sessions::TabRestoreService::WINDOW: { |
+ BuildLocalWindowItem( |
+ entry->id, |
+ static_cast<const sessions::TabRestoreService::Window&>(*entry) |
+ .tabs.size(), |
+ ++last_local_model_index_); |
+ break; |
+ } |
} |
++added_count; |
} |