| Index: chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java
|
| index 664819585c3d86773ae28c6adce692251c2b8ffd..123ebe524bfb41cb420ba8c0a8863181a12200a7 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java
|
| @@ -87,6 +87,7 @@ import org.chromium.chrome.browser.tabmodel.TabModelSelector;
|
| import org.chromium.chrome.browser.tabmodel.TabReparentingParams;
|
| import org.chromium.chrome.browser.util.ColorUtils;
|
| import org.chromium.chrome.browser.util.FeatureUtilities;
|
| +import org.chromium.chrome.browser.widget.textbubble.TextBubble;
|
| import org.chromium.chrome.browser.widget.textbubble.ViewAnchoredTextBubble;
|
| import org.chromium.components.dom_distiller.core.DomDistillerUrlUtils;
|
| import org.chromium.components.feature_engagement_tracker.EventConstants;
|
| @@ -382,6 +383,11 @@ public class Tab
|
|
|
| private ChromeDownloadDelegate mDownloadDelegate;
|
|
|
| + /**
|
| + * The Text bubble used to display In Product help widget for download feature on videos.
|
| + */
|
| + private TextBubble mDownloadIPHBubble;
|
| +
|
| /** Whether or not the tab closing the tab can send the user back to the app that opened it. */
|
| private boolean mIsAllowedToReturnToExternalApp;
|
|
|
| @@ -3104,6 +3110,54 @@ public class Tab
|
| nativeEnableEmbeddedMediaExperience(mNativeTabAndroid, enabled);
|
| }
|
|
|
| + @CalledByNative
|
| + public boolean showMediaDownloadIPH() {
|
| + assert mDownloadIPHBubble == null;
|
| +
|
| + // Ask the FeatureEngagementTracker if we should be showing the IPH widget.
|
| + FeatureEngagementTracker tracker =
|
| + FeatureEngagementTrackerFactory.getFeatureEngagementTrackerForProfile(getProfile());
|
| + tracker.notifyEvent(EventConstants.MEDIA_DOWNLOAD_BUTTON_DISPLAYED);
|
| + if (tracker.shouldTriggerHelpUI(FeatureConstants.MEDIA_DOWNLOAD_FEATURE)) {
|
| + mDownloadIPHBubble = new TextBubble(getApplicationContext(),
|
| + mContentViewCore.getContainerView(), R.string.iph_media_download_text,
|
| + R.string.iph_media_download_accessibility_text);
|
| + return true;
|
| + }
|
| +
|
| + return false;
|
| + }
|
| +
|
| + @CalledByNative
|
| + public void updateMediaDownloadIPH(int x, int y, int width, int height) {
|
| + assert mDownloadIPHBubble != null;
|
| +
|
| + mDownloadIPHBubble.show();
|
| + Rect rect = new Rect(x, y, x + width, y + height);
|
| + mDownloadIPHBubble.setAnchorRect(rect);
|
| + }
|
| +
|
| + /**
|
| + * Notifies the tab that a motion/touch event may be dispatched to the ContentView.
|
| + */
|
| + public void notifyMotionEvent() {
|
| + if (mDownloadIPHBubble == null) return;
|
| + hideMediaDownloadIPH();
|
| + }
|
| +
|
| + @CalledByNative
|
| + public void hideMediaDownloadIPH() {
|
| + assert mDownloadIPHBubble != null;
|
| + assert mNativeTabAndroid != 0;
|
| +
|
| + mDownloadIPHBubble.dismiss();
|
| + mDownloadIPHBubble = null;
|
| + FeatureEngagementTracker tracker =
|
| + FeatureEngagementTrackerFactory.getFeatureEngagementTrackerForProfile(getProfile());
|
| + tracker.dismissed(FeatureConstants.MEDIA_DOWNLOAD_FEATURE);
|
| + nativeDownloadMediaIPHDismissed(mNativeTabAndroid);
|
| + }
|
| +
|
| private native void nativeInit();
|
| private native void nativeDestroy(long nativeTabAndroid);
|
| private native void nativeInitWebContents(long nativeTabAndroid, boolean incognito,
|
| @@ -3136,4 +3190,5 @@ public class Tab
|
| private native void nativeSetWebappManifestScope(long nativeTabAndroid, String scope);
|
| private native void nativeEnableEmbeddedMediaExperience(long nativeTabAndroid, boolean enabled);
|
| private native void nativeAttachDetachedTab(long nativeTabAndroid);
|
| + private native void nativeDownloadMediaIPHDismissed(long nativeTabAndroid);
|
| }
|
|
|