Index: chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java |
index 091e627cbfc8eb1d94e9b30cbfad0ec13a42eb86..12ca253240b15d78b276d88fc0838eb0f1e4d3a8 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java |
@@ -186,6 +186,9 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener, |
/** The parent view of the ContentView and the InfoBarContainer. */ |
private FrameLayout mContentViewParent; |
+ /** The parent view of the NativePage's view and the InfoBarContainer. **/ |
+ private FrameLayout mNativePageParent; |
+ |
/** A list of Tab observers. These are used to broadcast Tab events to listeners. */ |
private final ObserverList<TabObserver> mObservers = new ObserverList<TabObserver>(); |
@@ -784,7 +787,7 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener, |
* This can be {@code null}, if the tab is frozen or being initialized or destroyed. |
*/ |
public View getView() { |
- return mNativePage != null ? mNativePage.getView() : mContentViewParent; |
+ return mNativePage != null ? mNativePageParent : mContentViewParent; |
} |
/** |
@@ -1210,6 +1213,13 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener, |
if (mNativePage == nativePage) return; |
NativePage previousNativePage = mNativePage; |
mNativePage = nativePage; |
+ if (mNativePageParent == null) { |
+ mNativePageParent = new FrameLayout(mActivity); |
+ } |
+ mNativePageParent.removeAllViews(); |
+ mNativePageParent.addView(nativePage.getView(), new FrameLayout.LayoutParams( |
+ LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); |
+ mInfoBarContainer.onParentViewChanged(getId(), mNativePageParent); |
pushNativePageStateToNavigationEntry(); |
// Notifying of theme color change before content change because some of |
// the observers depend on the theme information being correct in |
@@ -1242,6 +1252,8 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener, |
if (mNativePage == null) return; |
NativePage previousNativePage = mNativePage; |
mNativePage = null; |
+ mNativePageParent = null; |
+ mInfoBarContainer.onParentViewChanged(getId(), mContentViewParent); |
gone
2015/11/12 21:41:33
Why is this call necessary now? How often does it
Kibeom Kim (inactive)
2015/11/17 11:49:49
note: split patch https://codereview.chromium.org/
|
for (TabObserver observer : mObservers) observer.onContentChanged(this); |
destroyNativePageInternal(previousNativePage); |
} |
@@ -1521,6 +1533,7 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener, |
TraceEvent.begin("ChromeTab.setContentViewCore"); |
NativePage previousNativePage = mNativePage; |
mNativePage = null; |
+ mNativePageParent = null; |
destroyNativePageInternal(previousNativePage); |
mContentViewCore = cvc; |
@@ -1710,6 +1723,7 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener, |
NativePage currentNativePage = mNativePage; |
mNativePage = null; |
+ mNativePageParent = null; |
destroyNativePageInternal(currentNativePage); |
destroyContentViewCore(true); |
@@ -2188,6 +2202,7 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener, |
destroyContentViewCore(deleteOldNativeWebContents); |
NativePage previousNativePage = mNativePage; |
mNativePage = null; |
+ mNativePageParent = null; |
setContentViewCore(newContentViewCore); |
// 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 |