Index: trunk/src/chrome/browser/ui/webui/ntp/recently_closed_tabs_handler.cc |
=================================================================== |
--- trunk/src/chrome/browser/ui/webui/ntp/recently_closed_tabs_handler.cc (revision 267099) |
+++ trunk/src/chrome/browser/ui/webui/ntp/recently_closed_tabs_handler.cc (working copy) |
@@ -18,6 +18,10 @@ |
#include "content/public/browser/web_ui.h" |
#include "ui/base/webui/web_ui_util.h" |
+#if defined(OS_ANDROID) |
+#include "chrome/browser/sessions/session_restore.h" |
+#endif |
+ |
namespace { |
void TabToValue(const TabRestoreService::Tab& tab, |
@@ -72,6 +76,23 @@ |
double session_to_restore = 0.0; |
CHECK(args->GetDouble(0, &session_to_restore)); |
+#if defined(OS_ANDROID) |
+ // Find and remove the corresponding tab entry from TabRestoreService. |
+ // We take ownership of the returned tab. |
+ scoped_ptr<TabRestoreService::Tab> tab_entry( |
+ tab_restore_service_->RemoveTabEntryById(static_cast<int>( |
+ session_to_restore))); |
+ if (tab_entry.get() == NULL) |
+ return; |
+ |
+ // RestoreForeignSessionTab needs a SessionTab. |
+ SessionTab session_tab; |
+ session_tab.current_navigation_index = tab_entry->current_navigation_index; |
+ session_tab.navigations = tab_entry->navigations; |
+ |
+ SessionRestore::RestoreForeignSessionTab(web_ui()->GetWebContents(), |
+ session_tab, NEW_FOREGROUND_TAB); |
+#else |
double index = -1.0; |
CHECK(args->GetDouble(1, &index)); |
@@ -94,6 +115,7 @@ |
disposition); |
// The current tab has been nuked at this point; don't touch any member |
// variables. |
+#endif |
} |
void RecentlyClosedTabsHandler::HandleClearRecentlyClosed( |
@@ -112,7 +134,7 @@ |
void RecentlyClosedTabsHandler::TabRestoreServiceChanged( |
TabRestoreService* service) { |
- base::ListValue list_value; |
+ base::ListValue list_value; |
const int max_count = 10; |
int added_count = 0; |
// We filter the list of recently closed to only show 'interesting' entries, |