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

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

Issue 11038014: [Android] Upstream remaining changes to NTP UI code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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
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_) {

Powered by Google App Engine
This is Rietveld 408576698