| Index: chrome/android/java/src/org/chromium/chrome/browser/tabmodel/document/TabDelegate.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/document/TabDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/document/TabDelegate.java
|
| index d9e905caf765baca4114fdaf5d461407ff2631de..368fcebda97a7f6a8f461a7ce4d03367674e1295 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/document/TabDelegate.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/document/TabDelegate.java
|
| @@ -11,7 +11,6 @@ import android.net.Uri;
|
| import android.text.TextUtils;
|
|
|
| import org.chromium.base.ApplicationStatus;
|
| -import org.chromium.chrome.browser.ChromeActivity;
|
| import org.chromium.chrome.browser.IntentHandler;
|
| import org.chromium.chrome.browser.Tab;
|
| import org.chromium.chrome.browser.TabState;
|
| @@ -28,13 +27,12 @@ import org.chromium.content_public.browser.LoadUrlParams;
|
| import org.chromium.content_public.browser.WebContents;
|
| import org.chromium.ui.base.PageTransition;
|
|
|
| -import java.lang.ref.WeakReference;
|
| -
|
| /**
|
| * Asynchronously creates Tabs by creating/starting up Activities.
|
| */
|
| public class TabDelegate extends TabCreator {
|
| - private boolean mIsIncognito;
|
| + private final boolean mIsIncognito;
|
| + private final AsyncDocumentLauncher mLaunchSerializer;
|
|
|
| /**
|
| * Creates a TabDelegate.
|
| @@ -42,6 +40,7 @@ public class TabDelegate extends TabCreator {
|
| */
|
| public TabDelegate(boolean incognito) {
|
| mIsIncognito = incognito;
|
| + mLaunchSerializer = new AsyncDocumentLauncher(mIsIncognito);
|
| }
|
|
|
| @Override
|
| @@ -143,11 +142,10 @@ public class TabDelegate extends TabCreator {
|
| && asyncParams.getWebContents() != null);
|
|
|
| Context context = ApplicationStatus.getApplicationContext();
|
| - Activity parentActivity = getActivityForTabId(parentId);
|
| + Activity parentActivity = ActivityDelegate.getActivityForTabId(parentId);
|
|
|
| if (FeatureUtilities.isDocumentMode(context)) {
|
| - ChromeLauncherActivity.launchDocumentInstance(
|
| - parentActivity, mIsIncognito, asyncParams);
|
| + mLaunchSerializer.enqueueLaunch(parentId, asyncParams);
|
| } else {
|
| // TODO(dfalcantara): Is it possible to get rid of this conditional?
|
| int assignedTabId = TabIdManager.getInstance().generateValidId(Tab.INVALID_TAB_ID);
|
| @@ -173,19 +171,4 @@ public class TabDelegate extends TabCreator {
|
| IntentHandler.startActivityForTrustedIntent(intent, context);
|
| }
|
| }
|
| -
|
| - /** @return Running Activity that owns the given Tab, null if the Activity couldn't be found. */
|
| - private Activity getActivityForTabId(int id) {
|
| - if (id == Tab.INVALID_TAB_ID) return null;
|
| -
|
| - for (WeakReference<Activity> ref : ApplicationStatus.getRunningActivities()) {
|
| - if (!(ref.get() instanceof ChromeActivity)) continue;
|
| -
|
| - ChromeActivity activity = (ChromeActivity) ref.get();
|
| - if (activity == null) continue;
|
| -
|
| - if (activity.getTabModelSelector().getModelForTabId(id) != null) return activity;
|
| - }
|
| - return null;
|
| - }
|
| }
|
|
|