Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(304)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/tab/TabContentViewParent.java

Issue 2232943002: Revert of [Android] Make it possible to show Infobar in native pages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/tab/TabContentViewParent.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabContentViewParent.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabContentViewParent.java
index 83af3f8ecc17e0c4a2e7e72831304e72111bcfdf..71c2912c000f4e37712690337955fb7bd7ab0e6a 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabContentViewParent.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabContentViewParent.java
@@ -12,53 +12,22 @@
import org.chromium.chrome.R;
import org.chromium.chrome.browser.banners.SwipableOverlayView;
-import org.chromium.ui.UiUtils;
import org.chromium.ui.base.DeviceFormFactor;
/**
- * Parent {@link FrameLayout} holding the infobar and content of a tab. The content could be either
- * a native page or a content view.
+ * Parent {@link FrameLayout} holding the infobar and content view of a tab.
*/
public class TabContentViewParent extends FrameLayout {
- private static final int CONTENT_INDEX = 0;
-
// A wrapper is needed because infobar's translation is controlled by SwipableOverlayView.
// Setting infobar's translation directly from this class will cause UI flickering.
private final FrameLayout mInfobarWrapper;
private final Behavior<?> mBehavior = new SnackbarAwareBehavior();
- private EmptyTabObserver mTabObserver = new EmptyTabObserver() {
-
- @Override
- public void onContentChanged(Tab tab) {
- // If the tab is frozen, both native page and content view are not ready.
- if (tab.isFrozen()) return;
- View viewToShow = null;
- if (tab.getNativePage() != null) {
- viewToShow = tab.getNativePage().getView();
- if (isShowing(viewToShow)) return;
-
- } else {
- viewToShow = tab.getContentViewCore().getContainerView();
- if (isShowing(viewToShow)) return;
- }
-
- removeCurrentContent();
- UiUtils.removeViewFromParent(viewToShow);
- addView(viewToShow, CONTENT_INDEX, new FrameLayout.LayoutParams(
- LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
- viewToShow.requestFocus();
- }
- };
-
- public TabContentViewParent(Context context, Tab tab) {
+ public TabContentViewParent(Context context) {
super(context);
mInfobarWrapper = new FrameLayout(context);
- mInfobarWrapper.setFocusable(true);
- mInfobarWrapper.setFocusableInTouchMode(true);
addView(mInfobarWrapper,
new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
- tab.addObserver(mTabObserver);
}
/**
@@ -79,18 +48,6 @@
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
mInfobarWrapper.setTranslationY(0f);
- }
-
- /**
- * @return Whether the given {@link View} is already in the view hierarchy.
- */
- private boolean isShowing(View view) {
- return view.getParent() == this;
- }
-
- private void removeCurrentContent() {
- // Native page or content view should always be at index 0.
- if (getChildCount() > 1) removeViewAt(CONTENT_INDEX);
}
private static class SnackbarAwareBehavior
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java ('k') | ui/android/java/src/org/chromium/ui/UiUtils.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698