Commit 61b55bdc authored by Colin Blundell's avatar Colin Blundell Committed by Commit Bot

[WebLayer] Clarify naming in flow of BVC setting/clearing its active tab

When BrowserViewController sets/clears its active Tab, it notifies the
Tab in question. This is currently done via
TabImpl#onDid{Gain, Lose}Active callbacks. As boliu@ pointed out on the
bug linked below, this is confusing as there would be a natural
expectation that these callbacks are invoked when the *BrowserImpl* is
setting and clearing its active Tab. These flows are not identical; for
example, when the BrowserImpl is moved between Activities
BrowserViewController clears its active Tab as part of its destruction
but the actual active Tab in the BrowserImpl doesn't change.

This CL updates the relevant method names for clarity.

Bug: 1129077
Change-Id: I04fd58d6bcd69abfdc7cdde3a3c0186d83d67b39
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2421309Reviewed-by: default avatarBo <boliu@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Colin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#809368}
parent 6f8efcb3
......@@ -186,7 +186,7 @@ public final class BrowserViewController
if (tab == mTab) return;
if (mTab != null) {
mTab.onDidLoseActive();
mTab.onDetachedFromViewController();
mTab.setBrowserControlsVisibilityConstraint(
ImplControlsVisibilityReason.ANIMATION, BrowserControlsState.BOTH);
// WebContentsGestureStateTracker is relatively cheap, easier to destroy rather than
......@@ -215,7 +215,7 @@ public final class BrowserViewController
if (mTab != null) {
mTab.setBrowserControlsVisibilityConstraint(
ImplControlsVisibilityReason.ANIMATION, mBrowserControlsConstraint);
mTab.onDidGainActive(mTopControlsContainerView.getNativeHandle(),
mTab.onAttachedToViewController(mTopControlsContainerView.getNativeHandle(),
mBottomControlsContainerView.getNativeHandle());
mContentView.requestFocus();
}
......
......@@ -101,13 +101,13 @@ public class InfoBarContainer implements KeyboardVisibilityListener, InfoBar.Con
}
};
public void onTabDidGainActive() {
public void onTabAttachedToViewController() {
initializeContainerView(mTab.getBrowser().getContext());
updateWebContents();
mInfoBarContainerView.addToParentView();
}
public void onTabDidLoseActive() {
public void onTabDetachedFromViewController() {
mInfoBarContainerView.removeFromParentView();
destroyContainerView();
}
......
......@@ -398,23 +398,23 @@ public final class TabImpl extends ITab.Stub implements LoginPrompt.Observer {
}
/**
* Called when this TabImpl becomes the active TabImpl.
* Called when this TabImpl is attached to the BrowserViewController.
*/
public void onDidGainActive(
public void onAttachedToViewController(
long topControlsContainerViewHandle, long bottomControlsContainerViewHandle) {
// attachToFragment() must be called before activate().
assert mBrowser != null;
TabImplJni.get().setBrowserControlsContainerViews(
mNativeTab, topControlsContainerViewHandle, bottomControlsContainerViewHandle);
mInfoBarContainer.onTabDidGainActive();
mInfoBarContainer.onTabAttachedToViewController();
updateWebContentsVisibility();
updateDisplayCutoutController();
}
/**
* Called when this TabImpl is no longer the active TabImpl.
* Called when this TabImpl is detached from the BrowserViewController.
*/
public void onDidLoseActive() {
public void onDetachedFromViewController() {
if (mAutofillProvider != null) {
mAutofillProvider.hidePopup();
}
......@@ -428,7 +428,7 @@ public final class TabImpl extends ITab.Stub implements LoginPrompt.Observer {
// This method is called as part of the final phase of TabImpl destruction, at which
// point mInfoBarContainer has already been destroyed.
if (mInfoBarContainer != null) {
mInfoBarContainer.onTabDidLoseActive();
mInfoBarContainer.onTabDetachedFromViewController();
}
TabImplJni.get().setBrowserControlsContainerViews(mNativeTab, 0, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment