Commit bc113d52 authored by yusufo's avatar yusufo Committed by Commit bot

Revert of Start calling show/hide onStart/onStop in DocumentActivity (patchset...

Revert of Start calling show/hide onStart/onStop in DocumentActivity (patchset #1 id:1 of https://codereview.chromium.org/1455343002/ )

Reason for revert:
BUG=559197

This was causing an early tab.show call which made the test think the activity is in the foreground.

Reverting my CL for now. Will have to figure out a proper way to hide/show to reland.

Original issue's description:
> Start calling show/hide onStart/onStop in DocumentActivity
>
> This logic in documents diverge from CHromeActivity behavior for
> archaic reasons (crbug.com/451672). Making documents show/hide
> in the same time as all other ChromeActivities with this change.
> Verified that the previous bug that caused the bheavior divergence
> no longer exists after this CL.
>
> BUG=546182
>
> Committed: https://crrev.com/e548d4580bbd915716a855f9195b6f5f2d63d2a1
> Cr-Commit-Position: refs/heads/master@{#360581}

TBR=dfalcantara@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=546182

Review URL: https://codereview.chromium.org/1464313003

Cr-Commit-Position: refs/heads/master@{#361223}
parent e9643545
...@@ -46,6 +46,7 @@ import org.chromium.chrome.browser.tab.Tab; ...@@ -46,6 +46,7 @@ import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tab.TabUma.TabCreationState; import org.chromium.chrome.browser.tab.TabUma.TabCreationState;
import org.chromium.chrome.browser.tabmodel.SingleTabModelSelector; import org.chromium.chrome.browser.tabmodel.SingleTabModelSelector;
import org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType; import org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType;
import org.chromium.chrome.browser.tabmodel.TabModel.TabSelectionType;
import org.chromium.chrome.browser.tabmodel.document.ActivityDelegate; import org.chromium.chrome.browser.tabmodel.document.ActivityDelegate;
import org.chromium.chrome.browser.tabmodel.document.AsyncTabCreationParams; import org.chromium.chrome.browser.tabmodel.document.AsyncTabCreationParams;
import org.chromium.chrome.browser.tabmodel.document.AsyncTabCreationParamsManager; import org.chromium.chrome.browser.tabmodel.document.AsyncTabCreationParamsManager;
...@@ -479,6 +480,7 @@ public class DocumentActivity extends ChromeActivity { ...@@ -479,6 +480,7 @@ public class DocumentActivity extends ChromeActivity {
if (asyncParams != null && asyncParams.getLoadUrlParams().getUrl() != null) { if (asyncParams != null && asyncParams.getLoadUrlParams().getUrl() != null) {
loadLastKnownUrl(asyncParams); loadLastKnownUrl(asyncParams);
} }
mDocumentTab.show(TabSelectionType.FROM_USER);
} }
StartupMetrics.getInstance().recordHistogram(false); StartupMetrics.getInstance().recordHistogram(false);
} }
......
...@@ -164,6 +164,13 @@ public class DocumentTab extends Tab { ...@@ -164,6 +164,13 @@ public class DocumentTab extends Tab {
} }
} }
@Override
public void onActivityStart() {
// DocumentActivity#onResumeWithNative() will call Tab.show(), and so we don't need to call
// it at this point.
onActivityStartInternal(false /* showNow */);
}
/** /**
* A helper function to create TabUma and set it to the tab. * A helper function to create TabUma and set it to the tab.
* @param creationState In what state the tab was created. * @param creationState In what state the tab was created.
......
...@@ -1086,8 +1086,19 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener, ...@@ -1086,8 +1086,19 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener,
* on both cold and warm starts. * on both cold and warm starts.
*/ */
public void onActivityStart() { public void onActivityStart() {
onActivityStartInternal(true);
}
/**
* Called on the foreground tab when the Activity showing the Tab gets stopped.
*/
public void onActivityStop() {
hide();
}
protected void onActivityStartInternal(boolean showNow) {
if (isHidden()) { if (isHidden()) {
show(TabSelectionType.FROM_USER); if (showNow) show(TabSelectionType.FROM_USER);
} else { } else {
// The visible Tab's renderer process may have died after the activity was paused. // The visible Tab's renderer process may have died after the activity was paused.
// Ensure that it's restored appropriately. // Ensure that it's restored appropriately.
...@@ -1100,13 +1111,6 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener, ...@@ -1100,13 +1111,6 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener,
updateFullscreenEnabledState(); updateFullscreenEnabledState();
} }
/**
* Called on the foreground tab when the Activity showing the Tab gets stopped.
*/
public void onActivityStop() {
hide();
}
/** /**
* @return Whether the tab is ready to display or it should be faded in as it loads. * @return Whether the tab is ready to display or it should be faded in as it loads.
*/ */
......
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