| Index: chrome/browser/ui/webui/ntp/recently_closed_tabs_handler.cc
|
| diff --git a/chrome/browser/ui/webui/ntp/recently_closed_tabs_handler.cc b/chrome/browser/ui/webui/ntp/recently_closed_tabs_handler.cc
|
| index 5e751f8108974652c20d2007aa690c7b00499327..284d06e02865f4555042fc361e0d4dd5b7d82b59 100644
|
| --- a/chrome/browser/ui/webui/ntp/recently_closed_tabs_handler.cc
|
| +++ b/chrome/browser/ui/webui/ntp/recently_closed_tabs_handler.cc
|
| @@ -14,24 +14,6 @@
|
|
|
| namespace {
|
|
|
| -bool IsTabUnique(const DictionaryValue* tab,
|
| - std::set<std::string>* unique_items) {
|
| - DCHECK(unique_items);
|
| - std::string title;
|
| - std::string url;
|
| - if (tab->GetString("title", &title) &&
|
| - tab->GetString("url", &url)) {
|
| - // TODO(viettrungluu): this isn't obviously reliable, since different
|
| - // combinations of titles/urls may conceivably yield the same string.
|
| - std::string unique_key = title + url;
|
| - if (unique_items->find(unique_key) != unique_items->end())
|
| - return false;
|
| - else
|
| - unique_items->insert(unique_key);
|
| - }
|
| - return true;
|
| -}
|
| -
|
| bool TabToValue(const TabRestoreService::Tab& tab,
|
| DictionaryValue* dictionary) {
|
| if (tab.navigations.empty())
|
| @@ -94,7 +76,8 @@ void RecentlyClosedTabsHandler::HandleReopenTab(const ListValue* args) {
|
| if (!ExtractIntegerValue(args, &session_to_restore))
|
| return;
|
|
|
| - const TabRestoreService::Entries& entries = tab_restore_service_->entries();
|
| + TabRestoreService::Entries entries;
|
| + tab_restore_service_->FilteredEntries(&entries);
|
| int index = 0;
|
| for (TabRestoreService::Entries::const_iterator iter = entries.begin();
|
| iter != entries.end(); ++iter, ++index) {
|
| @@ -133,7 +116,10 @@ void RecentlyClosedTabsHandler::HandleGetRecentlyClosedTabs(
|
| void RecentlyClosedTabsHandler::TabRestoreServiceChanged(
|
| TabRestoreService* service) {
|
| ListValue list_value;
|
| - AddRecentlyClosedEntries(service->entries(), &list_value);
|
| + TabRestoreService::Entries entries;
|
| + service->FilteredEntries(&entries);
|
| +
|
| + AddRecentlyClosedEntries(entries, &list_value);
|
|
|
| web_ui_->CallJavascriptFunction("recentlyClosedTabs", list_value);
|
| }
|
| @@ -148,7 +134,6 @@ void RecentlyClosedTabsHandler::AddRecentlyClosedEntries(
|
| const TabRestoreService::Entries& entries, ListValue* entry_list_value) {
|
| const int max_count = 10;
|
| int added_count = 0;
|
| - std::set<std::string> unique_items;
|
| // We filter the list of recently closed to only show 'interesting' entries,
|
| // where an interesting entry is either a closed window or a closed tab
|
| // whose selected navigation is not the new tab ui.
|
| @@ -159,8 +144,7 @@ void RecentlyClosedTabsHandler::AddRecentlyClosedEntries(
|
| if ((entry->type == TabRestoreService::TAB &&
|
| TabToValue(
|
| *static_cast<TabRestoreService::Tab*>(entry),
|
| - entry_dict.get()) &&
|
| - IsTabUnique(entry_dict.get(), &unique_items)) ||
|
| + entry_dict.get())) ||
|
| (entry->type == TabRestoreService::WINDOW &&
|
| WindowToValue(
|
| *static_cast<TabRestoreService::Window*>(entry),
|
|
|