Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chrome.browser.tab; | 5 package org.chromium.chrome.browser.tab; |
| 6 | 6 |
| 7 import android.app.Activity; | 7 import android.app.Activity; |
| 8 import android.content.Context; | 8 import android.content.Context; |
| 9 import android.content.Intent; | 9 import android.content.Intent; |
| 10 import android.content.res.Resources; | 10 import android.content.res.Resources; |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 345 | 345 |
| 346 private TabRedirectHandler mTabRedirectHandler; | 346 private TabRedirectHandler mTabRedirectHandler; |
| 347 | 347 |
| 348 private FullscreenManager mFullscreenManager; | 348 private FullscreenManager mFullscreenManager; |
| 349 private float mPreviousFullscreenTopControlsOffsetY = Float.NaN; | 349 private float mPreviousFullscreenTopControlsOffsetY = Float.NaN; |
| 350 private float mPreviousFullscreenContentOffsetY = Float.NaN; | 350 private float mPreviousFullscreenContentOffsetY = Float.NaN; |
| 351 private int mFullscreenHungRendererToken = FullscreenManager.INVALID_TOKEN; | 351 private int mFullscreenHungRendererToken = FullscreenManager.INVALID_TOKEN; |
| 352 private boolean mIsFullscreenWaitingForLoad = false; | 352 private boolean mIsFullscreenWaitingForLoad = false; |
| 353 | 353 |
| 354 /** | 354 /** |
| 355 * Indicates whether this tab has been detached from its activity and the co rresponding | |
| 356 * {@link WindowAndroid} for reparenting to a new activity. | |
| 357 */ | |
| 358 private boolean mDetachedForReparenting; | |
| 359 | |
| 360 /** | |
| 355 * The UMA object used to report stats for this tab. Note that this may be n ull under certain | 361 * The UMA object used to report stats for this tab. Note that this may be n ull under certain |
| 356 * conditions, such as incognito mode. | 362 * conditions, such as incognito mode. |
| 357 */ | 363 */ |
| 358 private TabUma mTabUma; | 364 private TabUma mTabUma; |
| 359 | 365 |
| 360 /** | 366 /** |
| 361 * Reference to the current sadTabView if one is defined. | 367 * Reference to the current sadTabView if one is defined. |
| 362 */ | 368 */ |
| 363 private View mSadTabView; | 369 private View mSadTabView; |
| 364 | 370 |
| (...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1412 * launching the new host activity. This intent's URI and acti on will be | 1418 * launching the new host activity. This intent's URI and acti on will be |
| 1413 * overriden. This may be null if no intent customization is n eeded. | 1419 * overriden. This may be null if no intent customization is n eeded. |
| 1414 * @param startActivityOptions Options to pass to {@link Activity#startActiv ity(Intent, Bundle)} | 1420 * @param startActivityOptions Options to pass to {@link Activity#startActiv ity(Intent, Bundle)} |
| 1415 * @param finalizeCallback A callback that will be called after the tab is a ttached to the new | 1421 * @param finalizeCallback A callback that will be called after the tab is a ttached to the new |
| 1416 * host activity in {@link #attachAndFinishReparenti ng}. | 1422 * host activity in {@link #attachAndFinishReparenti ng}. |
| 1417 * @return Whether reparenting succeeded. If false, the tab was not removed and the intent was | 1423 * @return Whether reparenting succeeded. If false, the tab was not removed and the intent was |
| 1418 * not fired. | 1424 * not fired. |
| 1419 */ | 1425 */ |
| 1420 public boolean detachAndStartReparenting(Intent intent, Bundle startActivity Options, | 1426 public boolean detachAndStartReparenting(Intent intent, Bundle startActivity Options, |
| 1421 Runnable finalizeCallback) { | 1427 Runnable finalizeCallback) { |
| 1428 mDetachedForReparenting = true; | |
| 1422 ChromeActivity activity = getActivity(); | 1429 ChromeActivity activity = getActivity(); |
| 1423 if (activity == null) return false; | 1430 if (activity == null) return false; |
| 1424 TabModelSelector tabModelSelector = getTabModelSelector(); | 1431 TabModelSelector tabModelSelector = getTabModelSelector(); |
| 1425 if (tabModelSelector == null) return false; | 1432 if (tabModelSelector == null) return false; |
| 1426 tabModelSelector.getModel(mIncognito).removeTab(this); | 1433 tabModelSelector.getModel(mIncognito).removeTab(this); |
| 1427 | 1434 |
| 1428 if (mContentViewCore != null) mContentViewCore.updateWindowAndroid(null) ; | 1435 if (mContentViewCore != null) mContentViewCore.updateWindowAndroid(null) ; |
| 1429 attachTabContentManager(null); | 1436 attachTabContentManager(null); |
| 1430 | 1437 |
| 1431 if (intent == null) intent = new Intent(); | 1438 if (intent == null) intent = new Intent(); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1475 mWebContentsDelegate, mDelegateFactory.createContextMenuPopulato r(this)); | 1482 mWebContentsDelegate, mDelegateFactory.createContextMenuPopulato r(this)); |
| 1476 mTopControlsVisibilityDelegate = mDelegateFactory.createTopControlsVisib ilityDelegate(this); | 1483 mTopControlsVisibilityDelegate = mDelegateFactory.createTopControlsVisib ilityDelegate(this); |
| 1477 setInterceptNavigationDelegate(mDelegateFactory.createInterceptNavigatio nDelegate(this)); | 1484 setInterceptNavigationDelegate(mDelegateFactory.createInterceptNavigatio nDelegate(this)); |
| 1478 mAppBannerManager = mDelegateFactory.createAppBannerManager(this); | 1485 mAppBannerManager = mDelegateFactory.createAppBannerManager(this); |
| 1479 | 1486 |
| 1480 // Reload the NativePage (if any), since the old NativePage has a refere nce to the old | 1487 // Reload the NativePage (if any), since the old NativePage has a refere nce to the old |
| 1481 // activity. | 1488 // activity. |
| 1482 maybeShowNativePage(getUrl(), true); | 1489 maybeShowNativePage(getUrl(), true); |
| 1483 | 1490 |
| 1484 reparentingParams.finalizeTabReparenting(); | 1491 reparentingParams.finalizeTabReparenting(); |
| 1492 mDetachedForReparenting = false; | |
|
gone
2016/04/26 22:05:38
nit: mIsDetachedForReparenting
Yusuf
2016/04/26 22:10:15
Done.
| |
| 1485 } | 1493 } |
| 1486 | 1494 |
| 1487 /** | 1495 /** |
| 1496 * @return Whether the tab is detached from its Activity and {@link WindowAn droid} for | |
| 1497 * reparenting. Certain functionalities will not work until it is attached t o a new activity | |
| 1498 * with {@link Tab#attachAndFinishReparenting( | |
| 1499 * ChromeActivity, TabDelegateFactory, TabReparentingParams)}. | |
| 1500 */ | |
| 1501 public boolean isDetachedForReparenting() { | |
| 1502 return mDetachedForReparenting; | |
| 1503 } | |
| 1504 | |
| 1505 /** | |
| 1488 * Attach the content layer for this tab to the given {@link TabContentManag er}. | 1506 * Attach the content layer for this tab to the given {@link TabContentManag er}. |
| 1489 * @param tabContentManager {@link TabContentManager} to attach to. | 1507 * @param tabContentManager {@link TabContentManager} to attach to. |
| 1490 */ | 1508 */ |
| 1491 public void attachTabContentManager(TabContentManager tabContentManager) { | 1509 public void attachTabContentManager(TabContentManager tabContentManager) { |
| 1492 nativeAttachToTabContentManager(mNativeTabAndroid, tabContentManager); | 1510 nativeAttachToTabContentManager(mNativeTabAndroid, tabContentManager); |
| 1493 } | 1511 } |
| 1494 | 1512 |
| 1495 /** | 1513 /** |
| 1496 * @return The delegate factory for testing purposes only. | 1514 * @return The delegate factory for testing purposes only. |
| 1497 */ | 1515 */ |
| (...skipping 1669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3167 private native void nativeSetInterceptNavigationDelegate(long nativeTabAndro id, | 3185 private native void nativeSetInterceptNavigationDelegate(long nativeTabAndro id, |
| 3168 InterceptNavigationDelegate delegate); | 3186 InterceptNavigationDelegate delegate); |
| 3169 private native void nativeAttachToTabContentManager(long nativeTabAndroid, | 3187 private native void nativeAttachToTabContentManager(long nativeTabAndroid, |
| 3170 TabContentManager tabContentManager); | 3188 TabContentManager tabContentManager); |
| 3171 private native void nativeAttachOverlayContentViewCore(long nativeTabAndroid , | 3189 private native void nativeAttachOverlayContentViewCore(long nativeTabAndroid , |
| 3172 ContentViewCore content, boolean visible); | 3190 ContentViewCore content, boolean visible); |
| 3173 private native void nativeDetachOverlayContentViewCore(long nativeTabAndroid , | 3191 private native void nativeDetachOverlayContentViewCore(long nativeTabAndroid , |
| 3174 ContentViewCore content); | 3192 ContentViewCore content); |
| 3175 private native boolean nativeHasPrerenderedUrl(long nativeTabAndroid, String url); | 3193 private native boolean nativeHasPrerenderedUrl(long nativeTabAndroid, String url); |
| 3176 } | 3194 } |
| OLD | NEW |