Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(509)

Unified Diff: trunk/src/chrome/browser/ui/webui/ntp/recently_closed_tabs_handler.cc

Issue 264543002: Revert 267095 "Remove WebUI NTP on Android." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « trunk/src/chrome/browser/ui/webui/ntp/ntp_resource_cache.h ('k') | trunk/src/chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « trunk/src/chrome/browser/ui/webui/ntp/ntp_resource_cache.h ('k') | trunk/src/chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698