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

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

Issue 774183004: Upstream historical tab logic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@upstreaming_2
Patch Set: Created 6 years 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 | « chrome/browser/android/tab_android.h ('k') | chrome/browser/android/tab_state.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/tab_android.cc
diff --git a/chrome/browser/android/tab_android.cc b/chrome/browser/android/tab_android.cc
index b377cecf7c02b44cfef85241ac4d222e2dbb30f6..99ed22753c86a08b5475d0799cfc323a3b548442 100644
--- a/chrome/browser/android/tab_android.cc
+++ b/chrome/browser/android/tab_android.cc
@@ -25,6 +25,8 @@
#include "chrome/browser/search/instant_service_factory.h"
#include "chrome/browser/search/search.h"
#include "chrome/browser/sessions/session_tab_helper.h"
+#include "chrome/browser/sessions/tab_restore_service.h"
+#include "chrome/browser/sessions/tab_restore_service_factory.h"
#include "chrome/browser/sync/glue/synced_tab_delegate_android.h"
#include "chrome/browser/tab_contents/tab_util.h"
#include "chrome/browser/ui/android/content_settings/popup_blocked_infobar_delegate.h"
@@ -679,6 +681,31 @@ prerender::PrerenderManager* TabAndroid::GetPrerenderManager() const {
return prerender::PrerenderManagerFactory::GetForProfile(profile);
}
+void TabAndroid::CreateHistoricalTabFromContents(WebContents* web_contents) {
David Trainor- moved to gerrit 2014/12/04 07:45:27 Put "// static" above this? Might as well do same
gone 2014/12/04 18:19:51 Done.
+ DCHECK(web_contents);
+
+ TabRestoreService* service =
+ TabRestoreServiceFactory::GetForProfile(
+ Profile::FromBrowserContext(web_contents->GetBrowserContext()));
+ if (!service)
+ return;
+
+ // Exclude internal pages from being marked as recent when they are closed.
+ const GURL& tab_url = web_contents->GetURL();
+ if (tab_url.SchemeIs(content::kChromeUIScheme) ||
+ tab_url.SchemeIs(chrome::kChromeNativeScheme) ||
+ tab_url.SchemeIs(url::kAboutScheme)) {
+ return;
+ }
+
+ // TODO(jcivelli): is the index important?
+ service->CreateHistoricalTab(web_contents, -1);
+}
+
+void TabAndroid::CreateHistoricalTab(JNIEnv* env, jobject obj) {
+ TabAndroid::CreateHistoricalTabFromContents(web_contents());
+}
+
static void Init(JNIEnv* env, jobject obj) {
TRACE_EVENT0("native", "TabAndroid::Init");
// This will automatically bind to the Java object and pass ownership there.
« no previous file with comments | « chrome/browser/android/tab_android.h ('k') | chrome/browser/android/tab_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698