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

Unified Diff: chrome/browser/android/recently_closed_tabs_bridge.cc

Issue 2088443003: Shortcut ctrl+shift+T added on android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase master, and minor changes. Created 4 years, 5 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/android/recently_closed_tabs_bridge.cc
diff --git a/chrome/browser/android/recently_closed_tabs_bridge.cc b/chrome/browser/android/recently_closed_tabs_bridge.cc
index 771c815e70b9b7e507f46b5ea43618d09bc9e015..c40d6dd21cc6bf0fcf76ffda95d6643431996795 100644
--- a/chrome/browser/android/recently_closed_tabs_bridge.cc
+++ b/chrome/browser/android/recently_closed_tabs_bridge.cc
@@ -10,6 +10,8 @@
#include "chrome/browser/profiles/profile_android.h"
#include "chrome/browser/sessions/session_restore.h"
#include "chrome/browser/sessions/tab_restore_service_factory.h"
+#include "chrome/browser/ui/android/tab_model/tab_model_list.h"
+#include "components/sessions/core/live_tab.h"
#include "components/sessions/core/tab_restore_service.h"
#include "content/public/browser/web_contents.h"
#include "jni/RecentlyClosedBridge_jni.h"
@@ -126,6 +128,22 @@ jboolean RecentlyClosedTabsBridge::OpenRecentlyClosedTab(
return true;
}
+jboolean RecentlyClosedTabsBridge::OpenMostRecentlyClosedTab(
+ JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& obj) {
+ EnsureTabRestoreService();
+ if (!tab_restore_service_ || TabModelList::empty() ||
+ tab_restore_service_->entries().empty())
+ return false;
+
+ // Passing nullptr here because LiveTabContext will be determined later by
+ // a call to AndroidLiveTabContext::FindLiveTabContextWithID.
nyquist 2016/07/13 18:51:30 Nit: Could you mention that this is done in Chrome
+ std::vector<sessions::LiveTab*> restored_tab =
+ tab_restore_service_->RestoreMostRecentEntry(nullptr);
+
+ return restored_tab.empty() ? false : true;
nyquist 2016/07/13 18:51:30 Optional nit: How about !restored_tab.empty()?
+}
+
void RecentlyClosedTabsBridge::ClearRecentlyClosedTabs(
JNIEnv* env,
const JavaParamRef<jobject>& obj) {

Powered by Google App Engine
This is Rietveld 408576698