Chromium Code Reviews| 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 da09744e60dae6808d26eb6ed504d4edfb1ae5bf..74cc5c619026277005cc092dfd84576fa0ec75ea 100644 |
| --- a/chrome/browser/ui/webui/ntp/recently_closed_tabs_handler.cc |
| +++ b/chrome/browser/ui/webui/ntp/recently_closed_tabs_handler.cc |
| @@ -57,6 +57,9 @@ void RecentlyClosedTabsHandler::RegisterMessages() { |
| web_ui()->RegisterMessageCallback("reopenTab", |
| base::Bind(&RecentlyClosedTabsHandler::HandleReopenTab, |
| base::Unretained(this))); |
| + web_ui()->RegisterMessageCallback("clearRecentlyClosed", |
| + base::Bind(&RecentlyClosedTabsHandler::HandleClearRecentlyClosed, |
| + base::Unretained(this))); |
| } |
| RecentlyClosedTabsHandler::~RecentlyClosedTabsHandler() { |
| @@ -68,13 +71,6 @@ void RecentlyClosedTabsHandler::HandleReopenTab(const ListValue* args) { |
| if (!tab_restore_service_) |
| return; |
| - double index = -1.0; |
| - CHECK(args->GetDouble(1, &index)); |
| - |
| - // There are actually less than 20 restore tab items displayed in the UI. |
| - UMA_HISTOGRAM_ENUMERATION("NewTabPage.SessionRestore", |
| - static_cast<int>(index), 20); |
| - |
| double session_to_restore = 0.0; |
| CHECK(args->GetDouble(0, &session_to_restore)); |
| @@ -95,6 +91,13 @@ void RecentlyClosedTabsHandler::HandleReopenTab(const ListValue* args) { |
| SessionRestore::RestoreForeignSessionTab(web_ui()->GetWebContents(), |
| session_tab, NEW_FOREGROUND_TAB); |
| #else |
| + double index = -1.0; |
| + CHECK(args->GetDouble(1, &index)); |
| + |
| + // There are actually less than 20 restore tab items displayed in the UI. |
| + UMA_HISTOGRAM_ENUMERATION("NewTabPage.SessionRestore", |
| + static_cast<int>(index), 20); |
| + |
| TabRestoreServiceDelegate* delegate = |
| TabRestoreServiceDelegate::FindDelegateForWebContents( |
| web_ui()->GetWebContents()); |
| @@ -110,6 +113,12 @@ void RecentlyClosedTabsHandler::HandleReopenTab(const ListValue* args) { |
| #endif |
| } |
| +void RecentlyClosedTabsHandler::HandleClearRecentlyClosed( |
| + const ListValue* args) { |
| + if (tab_restore_service_) |
|
newt (away)
2012/10/02 13:07:31
Not totally sure about this. If tab_restore_servi
Evan Stade
2012/10/02 14:42:43
pull out an EnsureTabRestoreService function that
newt (away)
2012/10/05 13:31:05
Done.
|
| + tab_restore_service_->ClearEntries(); |
| +} |
| + |
| void RecentlyClosedTabsHandler::HandleGetRecentlyClosedTabs( |
| const ListValue* args) { |
| if (!tab_restore_service_) { |