import org.chromium.base.CalledByNative;
import org.chromium.base.ObserverList;
+import org.chromium.chrome.browser.banners.AppBannerManager;
import org.chromium.chrome.browser.contextmenu.ChromeContextMenuItemDelegate;
import org.chromium.chrome.browser.contextmenu.ChromeContextMenuPopulator;
import org.chromium.chrome.browser.contextmenu.ContextMenuParams;
/** InfoBar container to show InfoBars for this tab. */
private InfoBarContainer mInfoBarContainer;
+ /** Manages app banners shown for this tab. */
+ private AppBannerManager mAppBannerManager;
+
/** The sync id of the TabBase if session sync is enabled. */
private int mSyncId;
} else {
mInfoBarContainer.onParentViewChanged(getId(), getContentView());
}
+
+ if (AppBannerManager.isEnabled() && mAppBannerManager == null) {
+ mAppBannerManager = new AppBannerManager(this);
+ }
+
+ for (TabObserver observer : mObservers) observer.onContentChanged(this);
}
/**
/**
* @return The {@link WindowAndroid} associated with this {@link TabBase}.
*/
- protected WindowAndroid getWindowAndroid() {
+ public WindowAndroid getWindowAndroid() {
return mWindowAndroid;
}
}
/**
+ * Called when the navigation entry containing the historyitem changed,
+ * for example because of a scroll offset or form field change.
+ */
+ @CalledByNative
+ protected void onNavEntryChanged() {
+ }
+
+ /**
* @return The native pointer representing the native side of this {@link TabBase} object.
*/
@CalledByNative
/** This is currently called when committing a pre-rendered page. */
@CalledByNative
- private void swapWebContents(final long newWebContents) {
- if (mContentViewCore != null) mContentViewCore.onHide();
+ private void swapWebContents(
+ final long newWebContents, boolean didStartLoad, boolean didFinishLoad) {
+ int originalWidth = 0;
+ int originalHeight = 0;
+ if (mContentViewCore != null) {
+ originalWidth = mContentViewCore.getViewportWidthPix();
+ originalHeight = mContentViewCore.getViewportHeightPix();
+ mContentViewCore.onHide();
+ }
destroyContentView(false);
NativePage previousNativePage = mNativePage;
mNativePage = null;
initContentView(newWebContents);
+ // Size of the new ContentViewCore is zero at this point. If we don't call onSizeChanged(),
+ // next onShow() call would send a resize message with the current ContentViewCore size
+ // (zero) to the renderer process, although the new size will be set soon.
+ // However, this size fluttering may confuse Blink and rendered result can be broken
+ // (see http://crbug.com/340987).
+ mContentViewCore.onSizeChanged(originalWidth, originalHeight, 0, 0);
mContentViewCore.onShow();
mContentViewCore.attachImeAdapter();
for (TabObserver observer : mObservers) observer.onContentChanged(this);
destroyNativePageInternal(previousNativePage);
- for (TabObserver observer : mObservers) observer.onWebContentsSwapped(this);
+ for (TabObserver observer : mObservers) {
+ observer.onWebContentsSwapped(this, didStartLoad, didFinishLoad);
+ }
}
@CalledByNative