Commit fe02e13b authored by Theresa's avatar Theresa Committed by Commit Bot

Remove document mode migrate tab switcher callout

Remove the IPH shown after document mode migration. This is part of an
ongoing effort to simplify ToolbarPhone in prepartion for refactoring.

BUG=897835

Change-Id: I52510e945dbb352ce2dc2c9aae1314967a9c9b9b
Reviewed-on: https://chromium-review.googlesource.com/c/1294597Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Commit-Queue: Theresa <twellington@chromium.org>
Cr-Commit-Position: refs/heads/master@{#601772}
parent 6eebb95a
...@@ -33,7 +33,6 @@ import org.chromium.chrome.browser.tabmodel.document.DocumentTabModelImpl; ...@@ -33,7 +33,6 @@ import org.chromium.chrome.browser.tabmodel.document.DocumentTabModelImpl;
import org.chromium.chrome.browser.tabmodel.document.DocumentTabModelSelector; import org.chromium.chrome.browser.tabmodel.document.DocumentTabModelSelector;
import org.chromium.chrome.browser.tabmodel.document.StorageDelegate; import org.chromium.chrome.browser.tabmodel.document.StorageDelegate;
import org.chromium.chrome.browser.tabmodel.document.TabDelegate; import org.chromium.chrome.browser.tabmodel.document.TabDelegate;
import org.chromium.chrome.browser.toolbar.TabSwitcherCallout;
import org.chromium.chrome.browser.util.FeatureUtilities; import org.chromium.chrome.browser.util.FeatureUtilities;
import java.io.File; import java.io.File;
...@@ -407,7 +406,6 @@ public class DocumentModeAssassin { ...@@ -407,7 +406,6 @@ public class DocumentModeAssassin {
// safely copied to the other directory. // safely copied to the other directory.
Log.d(TAG, "Setting tabbed mode preference."); Log.d(TAG, "Setting tabbed mode preference.");
setOptedOutState(OPTED_OUT_OF_DOCUMENT_MODE); setOptedOutState(OPTED_OUT_OF_DOCUMENT_MODE);
TabSwitcherCallout.setIsTabSwitcherCalloutNecessary(true);
// Remove all the {@link DocumentActivity} tasks from Android's Recents list. Users // Remove all the {@link DocumentActivity} tasks from Android's Recents list. Users
// viewing Recents during migration will continue to see their tabs until they exit. // viewing Recents during migration will continue to see their tabs until they exit.
......
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.chrome.browser.toolbar;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import android.view.View;
import org.chromium.base.ContextUtils;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.widget.textbubble.TextBubble;
import org.chromium.ui.widget.ViewRectProvider;
/**
* Draws a bubble pointing upward at the tab switcher button.
* TODO(dtrainor, nyquist): Migrate this to an IPH message if it doesn't go away.
*/
public class TabSwitcherCallout {
public static final String PREF_NEED_TO_SHOW_TAB_SWITCHER_CALLOUT =
"org.chromium.chrome.browser.toolbar.NEED_TO_SHOW_TAB_SWITCHER_CALLOUT";
private static final int TAB_SWITCHER_CALLOUT_DISMISS_MS = 10000;
private static final float Y_OVERLAP_DP = 18.f;
/**
* Show the TabSwitcherCallout, if necessary.
* @param context {@link Context} to draw resources from.
* @param tabSwitcherButton Button that triggers the tab switcher.
* @return {@link TextBubble} if one was shown, {@code null} otherwise.
*/
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static TextBubble showIfNecessary(Context context, View tabSwitcherButton) {
if (!isTabSwitcherCalloutNecessary()) return null;
setIsTabSwitcherCalloutNecessary(false);
ViewRectProvider rectProvider = new ViewRectProvider(tabSwitcherButton);
int yInsetPx = (int) (Y_OVERLAP_DP * context.getResources().getDisplayMetrics().density);
rectProvider.setInsetPx(0, yInsetPx, 0, yInsetPx);
TextBubble bubble =
new TextBubble(context, tabSwitcherButton, R.string.tab_switcher_callout_body,
R.string.tab_switcher_callout_body, rectProvider);
bubble.setDismissOnTouchInteraction(true);
bubble.setAutoDismissTimeout(TAB_SWITCHER_CALLOUT_DISMISS_MS);
bubble.show();
return bubble;
}
/** @return Whether or not the tab switcher button callout needs to be shown. */
public static boolean isTabSwitcherCalloutNecessary() {
SharedPreferences prefs = ContextUtils.getAppSharedPreferences();
return prefs.getBoolean(PREF_NEED_TO_SHOW_TAB_SWITCHER_CALLOUT, false);
}
/** Sets whether the tab switcher callout should be shown when the browser starts up. */
public static void setIsTabSwitcherCalloutNecessary(boolean shouldShow) {
SharedPreferences prefs = ContextUtils.getAppSharedPreferences();
prefs.edit().putBoolean(PREF_NEED_TO_SHOW_TAB_SWITCHER_CALLOUT, shouldShow).apply();
}
}
...@@ -47,7 +47,6 @@ import android.view.animation.Interpolator; ...@@ -47,7 +47,6 @@ import android.view.animation.Interpolator;
import android.view.animation.LinearInterpolator; import android.view.animation.LinearInterpolator;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.PopupWindow.OnDismissListener;
import android.widget.TextView; import android.widget.TextView;
import org.chromium.base.ApiCompatibilityUtils; import org.chromium.base.ApiCompatibilityUtils;
...@@ -60,8 +59,6 @@ import org.chromium.chrome.browser.compositor.Invalidator; ...@@ -60,8 +59,6 @@ import org.chromium.chrome.browser.compositor.Invalidator;
import org.chromium.chrome.browser.compositor.layouts.LayoutUpdateHost; import org.chromium.chrome.browser.compositor.layouts.LayoutUpdateHost;
import org.chromium.chrome.browser.device.DeviceClassManager; import org.chromium.chrome.browser.device.DeviceClassManager;
import org.chromium.chrome.browser.feature_engagement.TrackerFactory; import org.chromium.chrome.browser.feature_engagement.TrackerFactory;
import org.chromium.chrome.browser.fullscreen.BrowserStateBrowserControlsVisibilityDelegate;
import org.chromium.chrome.browser.fullscreen.FullscreenManager;
import org.chromium.chrome.browser.ntp.NewTabPage; import org.chromium.chrome.browser.ntp.NewTabPage;
import org.chromium.chrome.browser.omaha.UpdateMenuItemHelper; import org.chromium.chrome.browser.omaha.UpdateMenuItemHelper;
import org.chromium.chrome.browser.omnibox.LocationBar; import org.chromium.chrome.browser.omnibox.LocationBar;
...@@ -78,7 +75,6 @@ import org.chromium.chrome.browser.util.FeatureUtilities; ...@@ -78,7 +75,6 @@ import org.chromium.chrome.browser.util.FeatureUtilities;
import org.chromium.chrome.browser.util.MathUtils; import org.chromium.chrome.browser.util.MathUtils;
import org.chromium.chrome.browser.util.ViewUtils; import org.chromium.chrome.browser.util.ViewUtils;
import org.chromium.chrome.browser.widget.animation.CancelAwareAnimatorListener; import org.chromium.chrome.browser.widget.animation.CancelAwareAnimatorListener;
import org.chromium.chrome.browser.widget.textbubble.TextBubble;
import org.chromium.components.feature_engagement.EventConstants; import org.chromium.components.feature_engagement.EventConstants;
import org.chromium.ui.UiUtils; import org.chromium.ui.UiUtils;
import org.chromium.ui.base.LocalizationUtils; import org.chromium.ui.base.LocalizationUtils;
...@@ -265,18 +261,6 @@ public class ToolbarPhone extends ToolbarLayout ...@@ -265,18 +261,6 @@ public class ToolbarPhone extends ToolbarLayout
private LayoutUpdateHost mLayoutUpdateHost; private LayoutUpdateHost mLayoutUpdateHost;
/** Callout for the tab switcher button. */
private TextBubble mTabSwitcherCallout;
/** Whether or not we've checked if the TabSwitcherCallout needs to be shown. */
private boolean mHasCheckedIfTabSwitcherCalloutIsNecessary;
/** Manages when the Toolbar hides and unhides. */
private BrowserStateBrowserControlsVisibilityDelegate mControlsVisibilityDelegate;
/** Token held when the TabSwitcherCallout is displayed to prevent the Toolbar from hiding. */
private int mFullscreenCalloutToken = FullscreenManager.INVALID_TOKEN;
/** The vertical inset of the location bar background. */ /** The vertical inset of the location bar background. */
private int mLocationBarBackgroundVerticalInset; private int mLocationBarBackgroundVerticalInset;
...@@ -509,12 +493,6 @@ public class ToolbarPhone extends ToolbarLayout ...@@ -509,12 +493,6 @@ public class ToolbarPhone extends ToolbarLayout
mNewTabButton.setOnLongClickListener(this); mNewTabButton.setOnLongClickListener(this);
} }
@Override
protected void onMenuShown() {
dismissTabSwitcherCallout();
super.onMenuShown();
}
/** /**
* Sets up click and key listeners once we have native library available to handle clicks. * Sets up click and key listeners once we have native library available to handle clicks.
*/ */
...@@ -621,7 +599,6 @@ public class ToolbarPhone extends ToolbarLayout ...@@ -621,7 +599,6 @@ public class ToolbarPhone extends ToolbarLayout
// and the listener is setup. // and the listener is setup.
if (mToggleTabStackButton != null && mToggleTabStackButton.isClickable() if (mToggleTabStackButton != null && mToggleTabStackButton.isClickable()
&& mTabSwitcherListener != null) { && mTabSwitcherListener != null) {
dismissTabSwitcherCallout();
cancelAppMenuUpdateBadgeAnimation(); cancelAppMenuUpdateBadgeAnimation();
mTabSwitcherListener.onClick(mToggleTabStackButton); mTabSwitcherListener.onClick(mToggleTabStackButton);
} }
...@@ -1965,11 +1942,6 @@ public class ToolbarPhone extends ToolbarLayout ...@@ -1965,11 +1942,6 @@ public class ToolbarPhone extends ToolbarLayout
} }
} }
@Override
public void destroy() {
dismissTabSwitcherCallout();
}
@Override @Override
public void setOnTabSwitcherClickHandler(OnClickListener listener) { public void setOnTabSwitcherClickHandler(OnClickListener listener) {
mTabSwitcherListener = listener; mTabSwitcherListener = listener;
...@@ -2175,8 +2147,6 @@ public class ToolbarPhone extends ToolbarLayout ...@@ -2175,8 +2147,6 @@ public class ToolbarPhone extends ToolbarLayout
super.onUrlFocusChange(hasFocus); super.onUrlFocusChange(hasFocus);
triggerUrlFocusAnimation(hasFocus); triggerUrlFocusAnimation(hasFocus);
if (hasFocus) dismissTabSwitcherCallout();
} }
protected void triggerUrlFocusAnimation(final boolean hasFocus) { protected void triggerUrlFocusAnimation(final boolean hasFocus) {
...@@ -2292,13 +2262,6 @@ public class ToolbarPhone extends ToolbarLayout ...@@ -2292,13 +2262,6 @@ public class ToolbarPhone extends ToolbarLayout
super.onTabOrModelChanged(); super.onTabOrModelChanged();
updateNtpAnimationState(); updateNtpAnimationState();
updateVisualsForToolbarState(); updateVisualsForToolbarState();
if (mHasCheckedIfTabSwitcherCalloutIsNecessary) {
dismissTabSwitcherCallout();
} else {
mHasCheckedIfTabSwitcherCalloutIsNecessary = true;
showTabSwitcherCalloutIfNecessary();
}
} }
private static boolean isVisualStateValidForBrandColorTransition(@VisualState int state) { private static boolean isVisualStateValidForBrandColorTransition(@VisualState int state) {
...@@ -2905,13 +2868,6 @@ public class ToolbarPhone extends ToolbarLayout ...@@ -2905,13 +2868,6 @@ public class ToolbarPhone extends ToolbarLayout
((BitmapDrawable) mTabSwitcherAnimationMenuBadgeLightDrawable).setGravity(Gravity.CENTER); ((BitmapDrawable) mTabSwitcherAnimationMenuBadgeLightDrawable).setGravity(Gravity.CENTER);
} }
@Override
public void setBrowserControlsVisibilityDelegate(
BrowserStateBrowserControlsVisibilityDelegate controlsVisibilityDelegate) {
super.setBrowserControlsVisibilityDelegate(controlsVisibilityDelegate);
mControlsVisibilityDelegate = controlsVisibilityDelegate;
}
private void setUseLightDrawablesForTextureCapture() { private void setUseLightDrawablesForTextureCapture() {
int currentPrimaryColor = getToolbarDataProvider().getPrimaryColor(); int currentPrimaryColor = getToolbarDataProvider().getPrimaryColor();
mUseLightDrawablesForTextureCapture = mUseLightDrawablesForTextureCapture =
...@@ -2920,34 +2876,6 @@ public class ToolbarPhone extends ToolbarLayout ...@@ -2920,34 +2876,6 @@ public class ToolbarPhone extends ToolbarLayout
&& ColorUtils.shouldUseLightForegroundOnBackground(currentPrimaryColor)); && ColorUtils.shouldUseLightForegroundOnBackground(currentPrimaryColor));
} }
private void dismissTabSwitcherCallout() {
if (mTabSwitcherCallout != null) mTabSwitcherCallout.dismiss();
}
private void showTabSwitcherCalloutIfNecessary() {
assert mTabSwitcherCallout == null;
mTabSwitcherCallout =
TabSwitcherCallout.showIfNecessary(getContext(), mToggleTabStackButton);
if (mTabSwitcherCallout == null) return;
mTabSwitcherCallout.addOnDismissListener(new OnDismissListener() {
@Override
public void onDismiss() {
if (mControlsVisibilityDelegate != null) {
mControlsVisibilityDelegate.releasePersistentShowingToken(
mFullscreenCalloutToken);
}
mTabSwitcherCallout = null;
}
});
if (mControlsVisibilityDelegate != null) {
mFullscreenCalloutToken =
mControlsVisibilityDelegate.showControlsPersistentAndClearOldToken(
mFullscreenCalloutToken);
}
}
/** /**
* Custom drawable that allows sharing the NTP search box drawable between the toolbar and the * Custom drawable that allows sharing the NTP search box drawable between the toolbar and the
* NTP. This allows animations to continue as the drawable is switched between the two owning * NTP. This allows animations to continue as the drawable is switched between the two owning
......
...@@ -3553,11 +3553,6 @@ However, you aren’t invisible. Going private doesn’t hide your browsing from ...@@ -3553,11 +3553,6 @@ However, you aren’t invisible. Going private doesn’t hide your browsing from
Image decoder Image decoder
</message> </message>
<!-- Migration strings -->
<message name="IDS_TAB_SWITCHER_CALLOUT_BODY" desc="Indicates that clicking the tab switcher button gives you quick access to your tabs.">
Tap this button for quick access to your tabs.
</message>
<!-- Special locale UI strings --> <!-- Special locale UI strings -->
<message name="IDS_SEARCH_WITH_SOGOU" desc="Text telling the user that the search engine will be switched to Sogou."> <message name="IDS_SEARCH_WITH_SOGOU" desc="Text telling the user that the search engine will be switched to Sogou.">
Search with Sogou Search with Sogou
......
...@@ -1531,7 +1531,6 @@ chrome_java_sources = [ ...@@ -1531,7 +1531,6 @@ chrome_java_sources = [
"java/src/org/chromium/chrome/browser/toolbar/TabSwitcherButtonCoordinator.java", "java/src/org/chromium/chrome/browser/toolbar/TabSwitcherButtonCoordinator.java",
"java/src/org/chromium/chrome/browser/toolbar/TabSwitcherButtonProperties.java", "java/src/org/chromium/chrome/browser/toolbar/TabSwitcherButtonProperties.java",
"java/src/org/chromium/chrome/browser/toolbar/TabSwitcherButtonView.java", "java/src/org/chromium/chrome/browser/toolbar/TabSwitcherButtonView.java",
"java/src/org/chromium/chrome/browser/toolbar/TabSwitcherCallout.java",
"java/src/org/chromium/chrome/browser/toolbar/TabSwitcherDrawable.java", "java/src/org/chromium/chrome/browser/toolbar/TabSwitcherDrawable.java",
"java/src/org/chromium/chrome/browser/toolbar/Toolbar.java", "java/src/org/chromium/chrome/browser/toolbar/Toolbar.java",
"java/src/org/chromium/chrome/browser/toolbar/ToolbarActionModeCallback.java", "java/src/org/chromium/chrome/browser/toolbar/ToolbarActionModeCallback.java",
......
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