| Index: chrome/android/java/src/org/chromium/chrome/browser/FullscreenWebContentsActivity.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/FullscreenWebContentsActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/FullscreenWebContentsActivity.java
|
| index 56078856803f045e88bae62394f72c1d05fb0f08..b9800291bff22c921160d49bb2767c1766e4d758 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/FullscreenWebContentsActivity.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/FullscreenWebContentsActivity.java
|
| @@ -8,23 +8,29 @@ import android.app.Activity;
|
| import android.content.ComponentName;
|
| import android.content.Intent;
|
| import android.provider.Browser;
|
| +import android.view.View;
|
| +import android.view.ViewGroup;
|
|
|
| import org.chromium.base.Log;
|
| import org.chromium.chrome.R;
|
| +import org.chromium.chrome.browser.compositor.layouts.LayoutManagerDocument;
|
| import org.chromium.chrome.browser.fullscreen.ChromeFullscreenManager;
|
| import org.chromium.chrome.browser.tab.Tab;
|
| import org.chromium.chrome.browser.tabmodel.AsyncTabParamsManager;
|
| import org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType;
|
| import org.chromium.chrome.browser.tabmodel.TabReparentingParams;
|
| import org.chromium.chrome.browser.util.IntentUtils;
|
| -import org.chromium.chrome.browser.webapps.FullScreenActivity;
|
| +import org.chromium.chrome.browser.widget.ControlContainer;
|
| +import org.chromium.content_public.browser.WebContentsObserver;
|
|
|
| /**
|
| * An Activity used to display fullscreen WebContents.
|
| */
|
| -public class FullscreenWebContentsActivity extends FullScreenActivity {
|
| +public class FullscreenWebContentsActivity extends SingleTabActivity {
|
| private static final String TAG = "FullWebConActivity";
|
|
|
| + private WebContentsObserver mWebContentsObserver;
|
| +
|
| @Override
|
| protected Tab createTab() {
|
| assert getIntent().hasExtra(IntentHandler.EXTRA_TAB_ID);
|
| @@ -33,7 +39,7 @@ public class FullscreenWebContentsActivity extends FullScreenActivity {
|
| getIntent(), IntentHandler.EXTRA_TAB_ID, Tab.INVALID_TAB_ID);
|
| TabReparentingParams params = (TabReparentingParams) AsyncTabParamsManager.remove(tabId);
|
|
|
| - Tab tab;
|
| + final Tab tab;
|
| if (params != null) {
|
| tab = params.getTabToReparent();
|
| tab.attachAndFinishReparenting(this, createTabDelegateFactory(), params);
|
| @@ -43,9 +49,36 @@ public class FullscreenWebContentsActivity extends FullScreenActivity {
|
| TabLaunchType.FROM_CHROME_UI, null, null);
|
| tab.initialize(null, getTabContentManager(), createTabDelegateFactory(), false, false);
|
| }
|
| + mWebContentsObserver = new WebContentsObserver(tab.getWebContents()) {
|
| + @Override
|
| + public void didFinishNavigation(String url, boolean isInMainFrame, boolean isErrorPage,
|
| + boolean hasCommitted, boolean isSameDocument, boolean isFragmentNavigation,
|
| + Integer pageTransition, int errorCode, String errorDescription,
|
| + int httpStatusCode) {
|
| + if (hasCommitted && isInMainFrame) {
|
| + // Notify the renderer to permanently hide the top controls since they do
|
| + // not apply to fullscreen content views.
|
| + tab.updateBrowserControlsState(tab.getBrowserControlsStateConstraints(), true);
|
| + }
|
| + }
|
| + };
|
| return tab;
|
| }
|
|
|
| + @Override
|
| + public void finishNativeInitialization() {
|
| + ControlContainer controlContainer = (ControlContainer) findViewById(R.id.control_container);
|
| + initializeCompositorContent(new LayoutManagerDocument(getCompositorViewHolder()),
|
| + (View) controlContainer, (ViewGroup) findViewById(android.R.id.content),
|
| + controlContainer);
|
| +
|
| + if (getFullscreenManager() != null) getFullscreenManager().setTab(getActivityTab());
|
| + super.finishNativeInitialization();
|
| + }
|
| +
|
| + @Override
|
| + protected void initializeToolbar() {}
|
| +
|
| @Override
|
| protected int getControlContainerLayoutId() {
|
| // TODO(peconn): Determine if there's something more suitable to use here.
|
| @@ -107,6 +140,16 @@ public class FullscreenWebContentsActivity extends FullScreenActivity {
|
| // has none.
|
| }
|
|
|
| + ChromeActivity tabActivity = tab.getActivity();
|
| + if (tabActivity instanceof FullscreenWebContentsActivity) {
|
| + FullscreenWebContentsActivity fullscreenActivity =
|
| + (FullscreenWebContentsActivity) tabActivity;
|
| + if (fullscreenActivity.mWebContentsObserver != null) {
|
| + fullscreenActivity.mWebContentsObserver.destroy();
|
| + fullscreenActivity.mWebContentsObserver = null;
|
| + }
|
| + }
|
| +
|
| // TODO(peconn): Deal with tricky multiwindow scenarios.
|
| }
|
| intent.putExtra(Browser.EXTRA_APPLICATION_ID, activity.getPackageName());
|
|
|