| 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.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
| 8 import android.app.Activity; | 8 import android.app.Activity; |
| 9 import android.app.Application; | 9 import android.app.Application; |
| 10 import android.content.Context; | 10 import android.content.Context; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 import org.chromium.content_public.common.BrowserControlsState; | 99 import org.chromium.content_public.common.BrowserControlsState; |
| 100 import org.chromium.content_public.common.BrowserControlsState.BrowserControlsSt
ateEnum; | 100 import org.chromium.content_public.common.BrowserControlsState.BrowserControlsSt
ateEnum; |
| 101 import org.chromium.content_public.common.Referrer; | 101 import org.chromium.content_public.common.Referrer; |
| 102 import org.chromium.content_public.common.ResourceRequestBody; | 102 import org.chromium.content_public.common.ResourceRequestBody; |
| 103 import org.chromium.printing.PrintManagerDelegateImpl; | 103 import org.chromium.printing.PrintManagerDelegateImpl; |
| 104 import org.chromium.printing.PrintingController; | 104 import org.chromium.printing.PrintingController; |
| 105 import org.chromium.printing.PrintingControllerImpl; | 105 import org.chromium.printing.PrintingControllerImpl; |
| 106 import org.chromium.ui.base.LocalizationUtils; | 106 import org.chromium.ui.base.LocalizationUtils; |
| 107 import org.chromium.ui.base.PageTransition; | 107 import org.chromium.ui.base.PageTransition; |
| 108 import org.chromium.ui.base.ViewAndroidDelegate; | 108 import org.chromium.ui.base.ViewAndroidDelegate; |
| 109 import org.chromium.ui.base.ViewRoot; |
| 109 import org.chromium.ui.base.WindowAndroid; | 110 import org.chromium.ui.base.WindowAndroid; |
| 110 import org.chromium.ui.mojom.WindowOpenDisposition; | 111 import org.chromium.ui.mojom.WindowOpenDisposition; |
| 111 | 112 |
| 112 import java.lang.ref.WeakReference; | 113 import java.lang.ref.WeakReference; |
| 113 import java.nio.ByteBuffer; | 114 import java.nio.ByteBuffer; |
| 114 import java.util.List; | 115 import java.util.List; |
| 115 | 116 |
| 116 /** | 117 /** |
| 117 * The basic Java representation of a tab. Contains and manages a {@link Conten
tView}. | 118 * The basic Java representation of a tab. Contains and manages a {@link Conten
tView}. |
| 118 * <p> | 119 * <p> |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 | 159 |
| 159 /** | 160 /** |
| 160 * An Application {@link Context}. Unlike {@link #mActivity}, this is the o
nly one that is | 161 * An Application {@link Context}. Unlike {@link #mActivity}, this is the o
nly one that is |
| 161 * publicly exposed to help prevent leaking the {@link Activity}. | 162 * publicly exposed to help prevent leaking the {@link Activity}. |
| 162 */ | 163 */ |
| 163 private final Context mThemedApplicationContext; | 164 private final Context mThemedApplicationContext; |
| 164 | 165 |
| 165 /** Gives {@link Tab} a way to interact with the Android window. */ | 166 /** Gives {@link Tab} a way to interact with the Android window. */ |
| 166 private WindowAndroid mWindowAndroid; | 167 private WindowAndroid mWindowAndroid; |
| 167 | 168 |
| 169 /** {@link ViewRoot} used to forward input/view events down to native. */ |
| 170 private ViewRoot mViewRoot; |
| 171 |
| 168 /** Whether or not this {@link Tab} is initialized and should be interacted
with. */ | 172 /** Whether or not this {@link Tab} is initialized and should be interacted
with. */ |
| 169 private boolean mIsInitialized; | 173 private boolean mIsInitialized; |
| 170 | 174 |
| 171 /** The current native page (e.g. chrome-native://newtab), or {@code null} i
f there is none. */ | 175 /** The current native page (e.g. chrome-native://newtab), or {@code null} i
f there is none. */ |
| 172 private NativePage mNativePage; | 176 private NativePage mNativePage; |
| 173 | 177 |
| 174 /** InfoBar container to show InfoBars for this tab. */ | 178 /** InfoBar container to show InfoBars for this tab. */ |
| 175 private InfoBarContainer mInfoBarContainer; | 179 private InfoBarContainer mInfoBarContainer; |
| 176 | 180 |
| 177 /** Controls overscroll pull-to-refresh behavior for this tab. */ | 181 /** Controls overscroll pull-to-refresh behavior for this tab. */ |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 /** | 520 /** |
| 517 * Creates an instance of a {@link Tab}. | 521 * Creates an instance of a {@link Tab}. |
| 518 * | 522 * |
| 519 * This constructor may be called before the native library has been loaded,
so any additions | 523 * This constructor may be called before the native library has been loaded,
so any additions |
| 520 * must be vetted for library calls. | 524 * must be vetted for library calls. |
| 521 * | 525 * |
| 522 * @param id The id this tab should be identified with. | 526 * @param id The id this tab should be identified with. |
| 523 * @param incognito Whether or not this tab is incognito. | 527 * @param incognito Whether or not this tab is incognito. |
| 524 * @param window An instance of a {@link WindowAndroid}. | 528 * @param window An instance of a {@link WindowAndroid}. |
| 525 */ | 529 */ |
| 526 public Tab(int id, boolean incognito, WindowAndroid window) { | 530 public Tab(int id, boolean incognito, ViewRoot viewRoot) { |
| 527 this(id, INVALID_TAB_ID, incognito, null, window, null, null, null); | 531 this(id, INVALID_TAB_ID, incognito, null, viewRoot, null, null, null); |
| 528 } | 532 } |
| 529 | 533 |
| 530 /** | 534 /** |
| 531 * Creates an instance of a {@link Tab}. | 535 * Creates an instance of a {@link Tab}. |
| 532 * | 536 * |
| 533 * This constructor can be called before the native library has been loaded,
so any additions | 537 * This constructor can be called before the native library has been loaded,
so any additions |
| 534 * must be vetted for library calls. | 538 * must be vetted for library calls. |
| 535 * | 539 * |
| 536 * @param id The id this tab should be identified with. | 540 * @param id The id this tab should be identified with. |
| 537 * @param parentId The id id of the tab that caused this tab to be opened
. | 541 * @param parentId The id id of the tab that caused this tab to be opened
. |
| 538 * @param incognito Whether or not this tab is incognito. | 542 * @param incognito Whether or not this tab is incognito. |
| 539 * @param context An instance of a {@link Context}. | 543 * @param context An instance of a {@link Context}. |
| 540 * @param window An instance of a {@link WindowAndroid}. | 544 * @param window An instance of a {@link WindowAndroid}. |
| 541 * @param creationState State in which the tab is created, needed to initial
ize TabUma | 545 * @param creationState State in which the tab is created, needed to initial
ize TabUma |
| 542 * accounting. When null, TabUma will not be initialize
d. | 546 * accounting. When null, TabUma will not be initialize
d. |
| 543 * @param frozenState State containing information about this Tab, if it was
persisted. | 547 * @param frozenState State containing information about this Tab, if it was
persisted. |
| 544 */ | 548 */ |
| 545 @SuppressLint("HandlerLeak") | 549 @SuppressLint("HandlerLeak") |
| 546 public Tab(int id, int parentId, boolean incognito, Context context, | 550 public Tab(int id, int parentId, boolean incognito, Context context, |
| 547 WindowAndroid window, TabLaunchType type, TabCreationState creationS
tate, | 551 ViewRoot viewRoot, TabLaunchType type, TabCreationState creationStat
e, |
| 548 TabState frozenState) { | 552 TabState frozenState) { |
| 549 mId = TabIdManager.getInstance().generateValidId(id); | 553 mId = TabIdManager.getInstance().generateValidId(id); |
| 550 mParentId = parentId; | 554 mParentId = parentId; |
| 551 mIncognito = incognito; | 555 mIncognito = incognito; |
| 552 mThemedApplicationContext = context != null ? new ContextThemeWrapper( | 556 mThemedApplicationContext = context != null ? new ContextThemeWrapper( |
| 553 context.getApplicationContext(), ChromeActivity.getThemeId()) :
null; | 557 context.getApplicationContext(), ChromeActivity.getThemeId()) :
null; |
| 554 mWindowAndroid = window; | 558 mViewRoot = viewRoot; |
| 559 mWindowAndroid = viewRoot != null ? viewRoot.getWindowAndroid() : null; |
| 555 mLaunchType = type; | 560 mLaunchType = type; |
| 556 if (mThemedApplicationContext != null) { | 561 if (mThemedApplicationContext != null) { |
| 557 Resources resources = mThemedApplicationContext.getResources(); | 562 Resources resources = mThemedApplicationContext.getResources(); |
| 558 mIdealFaviconSize = resources.getDimensionPixelSize(R.dimen.default_
favicon_size); | 563 mIdealFaviconSize = resources.getDimensionPixelSize(R.dimen.default_
favicon_size); |
| 559 mDefaultThemeColor = mIncognito | 564 mDefaultThemeColor = mIncognito |
| 560 ? ApiCompatibilityUtils.getColor(resources, R.color.incognit
o_primary_color) | 565 ? ApiCompatibilityUtils.getColor(resources, R.color.incognit
o_primary_color) |
| 561 : ApiCompatibilityUtils.getColor(resources, R.color.default_
primary_color); | 566 : ApiCompatibilityUtils.getColor(resources, R.color.default_
primary_color); |
| 562 mThemeColor = calculateThemeColor(false); | 567 mThemeColor = calculateThemeColor(false); |
| 563 } else { | 568 } else { |
| 564 mIdealFaviconSize = 16; | 569 mIdealFaviconSize = 16; |
| (...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1441 // ensure the global count of tabs is correct. See crbug.com/611806. | 1446 // ensure the global count of tabs is correct. See crbug.com/611806. |
| 1442 intent.putExtra(IntentHandler.EXTRA_TAB_ID, mId); | 1447 intent.putExtra(IntentHandler.EXTRA_TAB_ID, mId); |
| 1443 AsyncTabParamsManager.add(mId, | 1448 AsyncTabParamsManager.add(mId, |
| 1444 new TabReparentingParams(this, intent, finalizeCallback)); | 1449 new TabReparentingParams(this, intent, finalizeCallback)); |
| 1445 | 1450 |
| 1446 tabModelSelector.getModel(mIncognito).removeTab(this); | 1451 tabModelSelector.getModel(mIncognito).removeTab(this); |
| 1447 | 1452 |
| 1448 // TODO(yusufo): We can't call updateWindowAndroid here and set mWin
dowAndroid to null | 1453 // TODO(yusufo): We can't call updateWindowAndroid here and set mWin
dowAndroid to null |
| 1449 // because many code paths (including navigation) expect the tab to
always be associated | 1454 // because many code paths (including navigation) expect the tab to
always be associated |
| 1450 // with an activity, and will crash. crbug.com/657007 | 1455 // with an activity, and will crash. crbug.com/657007 |
| 1451 if (mContentViewCore != null) mContentViewCore.updateWindowAndroid(n
ull); | 1456 if (mContentViewCore != null) mContentViewCore.updateViewRoot(null); |
| 1452 attachTabContentManager(null); | 1457 attachTabContentManager(null); |
| 1453 } | 1458 } |
| 1454 | 1459 |
| 1455 activity.startActivity(intent, startActivityOptions); | 1460 activity.startActivity(intent, startActivityOptions); |
| 1456 return true; | 1461 return true; |
| 1457 } | 1462 } |
| 1458 | 1463 |
| 1459 /** | 1464 /** |
| 1460 * Finishes the tab reparenting process. Attaches the tab to the new activit
y, and updates the | 1465 * Finishes the tab reparenting process. Attaches the tab to the new activit
y, and updates the |
| 1461 * tab and related objects to reference the new activity. This updates many
delegates inside the | 1466 * tab and related objects to reference the new activity. This updates many
delegates inside the |
| 1462 * tab and {@link ContentViewCore} both on java and native sides. | 1467 * tab and {@link ContentViewCore} both on java and native sides. |
| 1463 * | 1468 * |
| 1464 * @param activity The new activity this tab should be associated with. | 1469 * @param activity The new activity this tab should be associated with. |
| 1465 * @param tabDelegateFactory The new delegate factory this tab should be usi
ng. | 1470 * @param tabDelegateFactory The new delegate factory this tab should be usi
ng. |
| 1466 * @Param reparentingParams The TabReparentingParams associated with this re
parenting process. | 1471 * @Param reparentingParams The TabReparentingParams associated with this re
parenting process. |
| 1467 */ | 1472 */ |
| 1468 public void attachAndFinishReparenting(ChromeActivity activity, | 1473 public void attachAndFinishReparenting(ChromeActivity activity, |
| 1469 TabDelegateFactory tabDelegateFactory, TabReparentingParams reparent
ingParams) { | 1474 TabDelegateFactory tabDelegateFactory, TabReparentingParams reparent
ingParams) { |
| 1470 // TODO(yusufo): Share these calls with the construction related calls. | 1475 // TODO(yusufo): Share these calls with the construction related calls. |
| 1471 // crbug.com/590281 | 1476 // crbug.com/590281 |
| 1472 | 1477 |
| 1473 updateWindowAndroid(activity.getWindowAndroid()); | 1478 updateViewRoot(activity.getViewRoot()); |
| 1474 | 1479 |
| 1475 // Update for the controllers that need the Compositor from the new Acti
vity. | 1480 // Update for the controllers that need the Compositor from the new Acti
vity. |
| 1476 attachTabContentManager(activity.getTabContentManager()); | 1481 attachTabContentManager(activity.getTabContentManager()); |
| 1477 mFullscreenManager = activity.getFullscreenManager(); | 1482 mFullscreenManager = activity.getFullscreenManager(); |
| 1478 activity.getCompositorViewHolder().prepareForTabReparenting(); | 1483 activity.getCompositorViewHolder().prepareForTabReparenting(); |
| 1479 | 1484 |
| 1480 // Update the delegate factory, then recreate and propagate all delegate
s. | 1485 // Update the delegate factory, then recreate and propagate all delegate
s. |
| 1481 mDelegateFactory = tabDelegateFactory; | 1486 mDelegateFactory = tabDelegateFactory; |
| 1482 mWebContentsDelegate = mDelegateFactory.createWebContentsDelegate(this); | 1487 mWebContentsDelegate = mDelegateFactory.createWebContentsDelegate(this); |
| 1483 nativeUpdateDelegates(mNativeTabAndroid, | 1488 nativeUpdateDelegates(mNativeTabAndroid, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1495 maybeShowNativePage(getUrl(), true); | 1500 maybeShowNativePage(getUrl(), true); |
| 1496 | 1501 |
| 1497 mIsTabStateDirty = true; | 1502 mIsTabStateDirty = true; |
| 1498 | 1503 |
| 1499 for (TabObserver observer : mObservers) { | 1504 for (TabObserver observer : mObservers) { |
| 1500 observer.onReparentingFinished(this); | 1505 observer.onReparentingFinished(this); |
| 1501 } | 1506 } |
| 1502 } | 1507 } |
| 1503 | 1508 |
| 1504 /** | 1509 /** |
| 1505 * Update and propagate the new WindowAndroid. | 1510 * Update and propagate the new ViewRoot and its WindowAndroid |
| 1506 * @param windowAndroid The WindowAndroid to propagate. | 1511 * @param viewRoot New ViewRoot to update. |
| 1507 */ | 1512 */ |
| 1508 public void updateWindowAndroid(WindowAndroid windowAndroid) { | 1513 public void updateViewRoot(ViewRoot viewRoot) { |
| 1514 assert viewRoot != null; |
| 1515 mViewRoot = viewRoot; |
| 1516 mWindowAndroid = viewRoot.getWindowAndroid(); |
| 1509 // TODO(yusufo): mWindowAndroid can never be null until crbug.com/657007
is fixed. | 1517 // TODO(yusufo): mWindowAndroid can never be null until crbug.com/657007
is fixed. |
| 1510 assert windowAndroid != null; | 1518 if (mContentViewCore != null) mContentViewCore.updateViewRoot(viewRoot); |
| 1511 mWindowAndroid = windowAndroid; | |
| 1512 if (mContentViewCore != null) mContentViewCore.updateWindowAndroid(mWind
owAndroid); | |
| 1513 } | 1519 } |
| 1514 | 1520 |
| 1515 /** | 1521 /** |
| 1516 * @return Whether the tab is detached from its Activity and {@link WindowAn
droid} for | 1522 * @return Whether the tab is detached from its Activity and {@link WindowAn
droid} for |
| 1517 * reparenting. Certain functionalities will not work until it is attached t
o a new activity | 1523 * reparenting. Certain functionalities will not work until it is attached t
o a new activity |
| 1518 * with {@link Tab#attachAndFinishReparenting( | 1524 * with {@link Tab#attachAndFinishReparenting( |
| 1519 * ChromeActivity, TabDelegateFactory, TabReparentingParams)}. | 1525 * ChromeActivity, TabDelegateFactory, TabReparentingParams)}. |
| 1520 */ | 1526 */ |
| 1521 public boolean isDetachedForReparenting() { | 1527 public boolean isDetachedForReparenting() { |
| 1522 return mIsDetachedForReparenting; | 1528 return mIsDetachedForReparenting; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1541 public View getContentView() { | 1547 public View getContentView() { |
| 1542 if (!isNativePage()) { | 1548 if (!isNativePage()) { |
| 1543 return getView(); | 1549 return getView(); |
| 1544 } else if (mContentViewCore != null) { | 1550 } else if (mContentViewCore != null) { |
| 1545 return mContentViewCore.getContainerView(); | 1551 return mContentViewCore.getContainerView(); |
| 1546 } | 1552 } |
| 1547 return null; | 1553 return null; |
| 1548 } | 1554 } |
| 1549 | 1555 |
| 1550 /** | 1556 /** |
| 1557 * @return {@link ViewRoot} instance used to forward view/input events. |
| 1558 */ |
| 1559 public ViewRoot getViewRoot() { |
| 1560 return mViewRoot; |
| 1561 } |
| 1562 |
| 1563 /** |
| 1551 * Called when a navigation begins and no navigation was in progress | 1564 * Called when a navigation begins and no navigation was in progress |
| 1552 * @param toDifferentDocument Whether this navigation will transition betwee
n | 1565 * @param toDifferentDocument Whether this navigation will transition betwee
n |
| 1553 * documents (i.e., not a fragment navigation or JS History API call). | 1566 * documents (i.e., not a fragment navigation or JS History API call). |
| 1554 */ | 1567 */ |
| 1555 protected void onLoadStarted(boolean toDifferentDocument) { | 1568 protected void onLoadStarted(boolean toDifferentDocument) { |
| 1556 if (toDifferentDocument) mIsLoading = true; | 1569 if (toDifferentDocument) mIsLoading = true; |
| 1557 for (TabObserver observer : mObservers) observer.onLoadStarted(this, toD
ifferentDocument); | 1570 for (TabObserver observer : mObservers) observer.onLoadStarted(this, toD
ifferentDocument); |
| 1558 } | 1571 } |
| 1559 | 1572 |
| 1560 /** | 1573 /** |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1635 */ | 1648 */ |
| 1636 protected void initContentViewCore(WebContents webContents) { | 1649 protected void initContentViewCore(WebContents webContents) { |
| 1637 setContentViewCore(createContentViewCore(webContents)); | 1650 setContentViewCore(createContentViewCore(webContents)); |
| 1638 } | 1651 } |
| 1639 | 1652 |
| 1640 private ContentViewCore createContentViewCore(WebContents webContents) { | 1653 private ContentViewCore createContentViewCore(WebContents webContents) { |
| 1641 ContentViewCore cvc = new ContentViewCore(mThemedApplicationContext, PRO
DUCT_VERSION); | 1654 ContentViewCore cvc = new ContentViewCore(mThemedApplicationContext, PRO
DUCT_VERSION); |
| 1642 ContentView cv = ContentView.createContentView(mThemedApplicationContext
, cvc); | 1655 ContentView cv = ContentView.createContentView(mThemedApplicationContext
, cvc); |
| 1643 cv.setContentDescription(mThemedApplicationContext.getResources().getStr
ing( | 1656 cv.setContentDescription(mThemedApplicationContext.getResources().getStr
ing( |
| 1644 R.string.accessibility_content_view)); | 1657 R.string.accessibility_content_view)); |
| 1645 cvc.initialize(ViewAndroidDelegate.createBasicDelegate(cv), cv, webConte
nts, | 1658 cvc.initialize(ViewAndroidDelegate.createBasicDelegate(cv), cv, webConte
nts, mViewRoot); |
| 1646 getWindowAndroid()); | |
| 1647 ChromeActionModeCallback actionModeCallback = new ChromeActionModeCallba
ck( | 1659 ChromeActionModeCallback actionModeCallback = new ChromeActionModeCallba
ck( |
| 1648 mThemedApplicationContext, this, cvc.getActionModeCallbackHelper
()); | 1660 mThemedApplicationContext, this, cvc.getActionModeCallbackHelper
()); |
| 1649 cvc.setActionModeCallback(actionModeCallback); | 1661 cvc.setActionModeCallback(actionModeCallback); |
| 1650 return cvc; | 1662 return cvc; |
| 1651 } | 1663 } |
| 1652 | 1664 |
| 1653 /** | 1665 /** |
| 1654 * Completes the {@link ContentViewCore} specific initialization around a na
tive WebContents | 1666 * Completes the {@link ContentViewCore} specific initialization around a na
tive WebContents |
| 1655 * pointer. {@link #getNativePage()} will still return the {@link NativePage
} if there is one. | 1667 * pointer. {@link #getNativePage()} will still return the {@link NativePage
} if there is one. |
| 1656 * All initialization that needs to reoccur after a web contents swap should
be added here. | 1668 * All initialization that needs to reoccur after a web contents swap should
be added here. |
| (...skipping 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2891 return mParentIntent; | 2903 return mParentIntent; |
| 2892 } | 2904 } |
| 2893 | 2905 |
| 2894 /** | 2906 /** |
| 2895 * Creates a new, "frozen" tab from a saved state. This can be used for back
ground tabs restored | 2907 * Creates a new, "frozen" tab from a saved state. This can be used for back
ground tabs restored |
| 2896 * on cold start that should be loaded when switched to. initialize() needs
to be called | 2908 * on cold start that should be loaded when switched to. initialize() needs
to be called |
| 2897 * afterwards to complete the second level initialization. | 2909 * afterwards to complete the second level initialization. |
| 2898 */ | 2910 */ |
| 2899 public static Tab createFrozenTabFromState( | 2911 public static Tab createFrozenTabFromState( |
| 2900 int id, ChromeActivity activity, boolean incognito, | 2912 int id, ChromeActivity activity, boolean incognito, |
| 2901 WindowAndroid nativeWindow, int parentId, TabState state) { | 2913 ViewRoot viewRoot, int parentId, TabState state) { |
| 2902 assert state != null; | 2914 assert state != null; |
| 2903 return new Tab(id, parentId, incognito, activity, nativeWindow, | 2915 return new Tab(id, parentId, incognito, activity, viewRoot, |
| 2904 TabLaunchType.FROM_RESTORE, TabCreationState.FROZEN_ON_RESTORE,
state); | 2916 TabLaunchType.FROM_RESTORE, TabCreationState.FROZEN_ON_RESTORE,
state); |
| 2905 } | 2917 } |
| 2906 | 2918 |
| 2907 /** | 2919 /** |
| 2908 * Update whether or not the current native tab and/or web contents are | 2920 * Update whether or not the current native tab and/or web contents are |
| 2909 * currently visible (from an accessibility perspective), or whether | 2921 * currently visible (from an accessibility perspective), or whether |
| 2910 * they're obscured by another view. | 2922 * they're obscured by another view. |
| 2911 */ | 2923 */ |
| 2912 public void updateAccessibilityVisibility() { | 2924 public void updateAccessibilityVisibility() { |
| 2913 View view = getView(); | 2925 View view = getView(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2934 ChromeActivity activity = getActivity(); | 2946 ChromeActivity activity = getActivity(); |
| 2935 return activity != null && activity.isViewObscuringAllTabs(); | 2947 return activity != null && activity.isViewObscuringAllTabs(); |
| 2936 } | 2948 } |
| 2937 | 2949 |
| 2938 /** | 2950 /** |
| 2939 * Creates a new tab to be loaded lazily. This can be used for tabs opened i
n the background | 2951 * Creates a new tab to be loaded lazily. This can be used for tabs opened i
n the background |
| 2940 * that should be loaded when switched to. initialize() needs to be called a
fterwards to | 2952 * that should be loaded when switched to. initialize() needs to be called a
fterwards to |
| 2941 * complete the second level initialization. | 2953 * complete the second level initialization. |
| 2942 */ | 2954 */ |
| 2943 public static Tab createTabForLazyLoad(ChromeActivity activity, boolean inco
gnito, | 2955 public static Tab createTabForLazyLoad(ChromeActivity activity, boolean inco
gnito, |
| 2944 WindowAndroid nativeWindow, TabLaunchType type, int parentId, | 2956 ViewRoot viewRoot, TabLaunchType type, int parentId, |
| 2945 LoadUrlParams loadUrlParams) { | 2957 LoadUrlParams loadUrlParams) { |
| 2946 Tab tab = new Tab( | 2958 Tab tab = new Tab( |
| 2947 INVALID_TAB_ID, parentId, incognito, activity, nativeWindow, typ
e, | 2959 INVALID_TAB_ID, parentId, incognito, activity, viewRoot, type, |
| 2948 TabCreationState.FROZEN_FOR_LAZY_LOAD, null); | 2960 TabCreationState.FROZEN_FOR_LAZY_LOAD, null); |
| 2949 tab.setPendingLoadParams(loadUrlParams); | 2961 tab.setPendingLoadParams(loadUrlParams); |
| 2950 return tab; | 2962 return tab; |
| 2951 } | 2963 } |
| 2952 | 2964 |
| 2953 /** | 2965 /** |
| 2954 * Creates a fresh tab. initialize() needs to be called afterwards to comple
te the second level | 2966 * Creates a fresh tab. initialize() needs to be called afterwards to comple
te the second level |
| 2955 * initialization. | 2967 * initialization. |
| 2956 * @param initiallyHidden true iff the tab being created is initially in bac
kground | 2968 * @param initiallyHidden true iff the tab being created is initially in bac
kground |
| 2957 */ | 2969 */ |
| 2958 public static Tab createLiveTab(int id, ChromeActivity activity, boolean inc
ognito, | 2970 public static Tab createLiveTab(int id, ChromeActivity activity, boolean inc
ognito, |
| 2959 WindowAndroid nativeWindow, TabLaunchType type, int parentId, boolea
n initiallyHidden) { | 2971 ViewRoot viewRoot, TabLaunchType type, int parentId, boolean initial
lyHidden) { |
| 2960 return new Tab(id, parentId, incognito, activity, nativeWindow, type, in
itiallyHidden | 2972 return new Tab(id, parentId, incognito, activity, viewRoot, type, initia
llyHidden |
| 2961 ? TabCreationState.LIVE_IN_BACKGROUND | 2973 ? TabCreationState.LIVE_IN_BACKGROUND |
| 2962 : TabCreationState.LIVE_IN_FOREGROUND, null); | 2974 : TabCreationState.LIVE_IN_FOREGROUND, null); |
| 2963 } | 2975 } |
| 2964 | 2976 |
| 2965 /** | 2977 /** |
| 2966 * @return Whether the theme color for this tab is the default color. | 2978 * @return Whether the theme color for this tab is the default color. |
| 2967 */ | 2979 */ |
| 2968 public boolean isDefaultThemeColor() { | 2980 public boolean isDefaultThemeColor() { |
| 2969 return isNativePage() || mDefaultThemeColor == getThemeColor(); | 2981 return isNativePage() || mDefaultThemeColor == getThemeColor(); |
| 2970 } | 2982 } |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3101 private native void nativeLoadOriginalImage(long nativeTabAndroid); | 3113 private native void nativeLoadOriginalImage(long nativeTabAndroid); |
| 3102 private native long nativeGetBookmarkId(long nativeTabAndroid, boolean onlyE
ditable); | 3114 private native long nativeGetBookmarkId(long nativeTabAndroid, boolean onlyE
ditable); |
| 3103 private native boolean nativeIsOfflinePage(long nativeTabAndroid); | 3115 private native boolean nativeIsOfflinePage(long nativeTabAndroid); |
| 3104 private native OfflinePageItem nativeGetOfflinePage(long nativeTabAndroid); | 3116 private native OfflinePageItem nativeGetOfflinePage(long nativeTabAndroid); |
| 3105 private native void nativeSetInterceptNavigationDelegate(long nativeTabAndro
id, | 3117 private native void nativeSetInterceptNavigationDelegate(long nativeTabAndro
id, |
| 3106 InterceptNavigationDelegate delegate); | 3118 InterceptNavigationDelegate delegate); |
| 3107 private native void nativeAttachToTabContentManager(long nativeTabAndroid, | 3119 private native void nativeAttachToTabContentManager(long nativeTabAndroid, |
| 3108 TabContentManager tabContentManager); | 3120 TabContentManager tabContentManager); |
| 3109 private native boolean nativeHasPrerenderedUrl(long nativeTabAndroid, String
url); | 3121 private native boolean nativeHasPrerenderedUrl(long nativeTabAndroid, String
url); |
| 3110 } | 3122 } |
| OLD | NEW |