Chromium Code Reviews| 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. |