summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Choc <tedchoc@google.com>2015-10-09 10:48:43 -0700
committerTed Choc <tedchoc@google.com>2015-10-09 17:50:09 +0000
commit515802327800e492f8af123ddd5f495609dfda41 (patch)
treef435b9d5c8721ec068354d5d3c4878fef4fc714b
parent83a90d3befcb37b68620d63782be6c4283cd697b (diff)
downloadchromium_src-515802327800e492f8af123ddd5f495609dfda41.zip
chromium_src-515802327800e492f8af123ddd5f495609dfda41.tar.gz
chromium_src-515802327800e492f8af123ddd5f495609dfda41.tar.bz2
Disable new tab animations on svelte.
This was accidentally removed in some cleanup downstream. BUG=531785 Use the tab URL as a fallback title on the svelte tab switcher. Currently if you open tabs in the background in svelte, the title in the tab switcher is "Loading..." until you access it. This changes it to use the URL if available. BUG=None Review URL: https://codereview.chromium.org/1399603002 Review URL: https://codereview.chromium.org/1398843002 Cr-Commit-Position: refs/heads/master@{#353189} Cr-Commit-Position: refs/heads/master@{#353185} Review URL: https://codereview.chromium.org/1399073002 . Cr-Commit-Position: refs/branch-heads/2526@{#62} Cr-Branched-From: cb947c0153db0ec02a8abbcb3ca086d88bf6006f-refs/heads/master@{#352221}
-rw-r--r--chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java2
-rw-r--r--chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerChrome.java10
-rw-r--r--chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerChromePhone.java6
-rw-r--r--chrome/android/java/src/org/chromium/chrome/browser/widget/accessibility/AccessibilityTabModelListItem.java9
-rw-r--r--chrome/android/javatests/src/org/chromium/chrome/browser/ChromeActivityTest.java16
5 files changed, 36 insertions, 7 deletions
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
index b8d40d8..a2b39cc4 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
@@ -409,7 +409,7 @@ public class ChromeTabbedActivity extends ChromeActivity implements OverviewMode
mLayoutManager = new LayoutManagerChromePhone(compositorViewHolder,
new StackLayoutFactory());
}
-
+ mLayoutManager.setEnableAnimations(DeviceClassManager.enableAnimations(this));
mLayoutManager.addOverviewModeObserver(this);
// TODO(yusufo): get rid of findViewById(R.id.url_bar).
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerChrome.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerChrome.java
index b737817..44751a6 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerChrome.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerChrome.java
@@ -77,7 +77,7 @@ public class LayoutManagerChrome
/** Responsible for building all incognito titles. */
protected TitleBitmapFactory mIncognitoTitleBitmapFactory;
/** Whether or not animations are enabled. This can disable certain layouts or effects. */
- protected boolean mEnableAnimations = true;
+ private boolean mEnableAnimations = true;
private boolean mCreatingNtp;
private final ObserverList<OverviewModeObserver> mOverviewModeObservers;
private TabModelSelectorObserver mTabModelSelectorObserver;
@@ -678,6 +678,14 @@ public class LayoutManagerChrome
mEnableAnimations = enabled;
}
+ /**
+ * @return Whether animations should be done for model changes.
+ */
+ @VisibleForTesting
+ public boolean animationsEnabled() {
+ return mEnableAnimations;
+ }
+
@Override
public boolean overviewVisible() {
Layout activeLayout = getActiveLayout();
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerChromePhone.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerChromePhone.java
index bb56c7c..9265acb 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerChromePhone.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerChromePhone.java
@@ -89,7 +89,7 @@ public class LayoutManagerChromePhone extends LayoutManagerChrome {
// The user is currently interacting with the {@code LayoutHost}.
// Allow the foreground layout to animate the tab closing.
getActiveLayout().onTabClosing(time(), id);
- } else if (mEnableAnimations) {
+ } else if (animationsEnabled()) {
startShowing(mSimpleAnimationLayout, false);
getActiveLayout().onTabClosing(time(), id);
}
@@ -107,7 +107,7 @@ public class LayoutManagerChromePhone extends LayoutManagerChrome {
getActiveLayout().onTabClosed(time(), id, nextId, incognito);
Tab nextTab = getTabById(nextId);
if (nextTab != null) nextTab.requestFocus();
- if (getActiveLayout() != overviewLayout && showOverview && !mEnableAnimations) {
+ if (getActiveLayout() != overviewLayout && showOverview && !animationsEnabled()) {
startShowing(overviewLayout, false);
}
}
@@ -119,7 +119,7 @@ public class LayoutManagerChromePhone extends LayoutManagerChrome {
// This check allows us to switch from the StackLayout to the SimpleAnimationLayout
// smoothly.
getActiveLayout().onTabCreating(sourceId);
- } else if (mEnableAnimations) {
+ } else if (animationsEnabled()) {
if (getActiveLayout() != null && getActiveLayout().isHiding()) {
setNextLayout(mSimpleAnimationLayout);
// The method Layout#doneHiding() will automatically show the next layout.
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/widget/accessibility/AccessibilityTabModelListItem.java b/chrome/android/java/src/org/chromium/chrome/browser/widget/accessibility/AccessibilityTabModelListItem.java
index 530d345..0159d18 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/widget/accessibility/AccessibilityTabModelListItem.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/widget/accessibility/AccessibilityTabModelListItem.java
@@ -11,6 +11,7 @@ import android.animation.ObjectAnimator;
import android.content.Context;
import android.graphics.Bitmap;
import android.os.Handler;
+import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.GestureDetector;
import android.view.MotionEvent;
@@ -261,8 +262,12 @@ public class AccessibilityTabModelListItem extends FrameLayout implements OnClic
}
private void updateTabTitle() {
- String title = mTab != null ? mTab.getTitle() : null;
- if (title == null || title.isEmpty()) {
+ String title = null;
+ if (mTab != null) {
+ title = mTab.getTitle();
+ if (TextUtils.isEmpty(title)) title = mTab.getUrl();
+ }
+ if (TextUtils.isEmpty(title)) {
title = getContext().getResources().getString(R.string.tab_loading_default_title);
}
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/ChromeActivityTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/ChromeActivityTest.java
index 0ba06e9..21a3a49 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/ChromeActivityTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/ChromeActivityTest.java
@@ -5,8 +5,10 @@
package org.chromium.chrome.browser;
import android.test.suitebuilder.annotation.MediumTest;
+import android.test.suitebuilder.annotation.SmallTest;
import org.chromium.base.ThreadUtils;
+import org.chromium.chrome.browser.device.DeviceClassManager;
import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tabmodel.ChromeTabCreator;
import org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType;
@@ -14,6 +16,8 @@ import org.chromium.chrome.test.ChromeTabbedActivityTestBase;
import org.chromium.chrome.test.util.TestHttpServerClient;
import org.chromium.content_public.browser.LoadUrlParams;
+import java.util.concurrent.Callable;
+
/**
* Instrumentation tests for ChromeActivity.
*/
@@ -85,6 +89,18 @@ public class ChromeActivityTest extends ChromeTabbedActivityTestBase {
assertTrue(tabs[1].isHidden());
}
+ @SmallTest
+ public void testTabAnimationsCorrectlyEnabled() {
+ boolean animationsEnabled = ThreadUtils.runOnUiThreadBlockingNoException(
+ new Callable<Boolean>() {
+ @Override
+ public Boolean call() throws Exception {
+ return getActivity().getLayoutManager().animationsEnabled();
+ }
+ });
+ assertEquals(animationsEnabled, DeviceClassManager.enableAnimations(getActivity()));
+ }
+
@Override
public void startMainActivity() throws InterruptedException {
startMainActivityOnBlankPage();