Skip to content

Commit

Permalink
Reland "Android: Delete in-product help for media download code"
Browse files Browse the repository at this point in the history
This is a reland of b011f9b

FindIt was too aggressive and auto-reverted r632842, as r632848,
which results in a broken tree because it is incompatible with
r632847 which already fixed the build.

TBR=jinsukkim@chromium.org
NOTRY=true
NOTREECHECKS=true
NOPRESUBMIT=true

Original change's description:
> Android: Delete in-product help for media download code
>
> In-product help system was determined not to be launched.
> This CL reverts https://crrev.com/2943983003 which added
> the functionality for media download.
>
> Bug: 715185, 889682
> Change-Id: I7478eb2438023febd894560b18b6c380f81577e2
> Reviewed-on: https://chromium-review.googlesource.com/c/1367065
> Reviewed-by: David Trainor <dtrainor@chromium.org>
> Reviewed-by: Stephen Chenney <schenney@chromium.org>
> Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> Reviewed-by: Mounir Lamouri <mlamouri@chromium.org>
> Reviewed-by: Pavel Feldman <pfeldman@chromium.org>
> Commit-Queue: Jinsuk Kim <jinsukkim@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#632842}

Bug: 715185, 889682
Change-Id: I73be467fcb49cb5e08ccf4d35737c6bff9ce9019
Reviewed-on: https://chromium-review.googlesource.com/c/1476083
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#632849}
  • Loading branch information
JinsukKim authored and Commit Bot committed Feb 16, 2019
1 parent 32c34de commit 8caf17f
Show file tree
Hide file tree
Showing 37 changed files with 5 additions and 773 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1928,8 +1928,6 @@ && getCompositorViewHolder().getLayoutManager().getToolbarSwipeHandler() != null
@Override
public void onOrientationChange(int orientation) {
if (mToolbarManager != null) mToolbarManager.onOrientationChange();
Tab tab = getActivityTab();
if (tab != null) tab.onOrientationChange();
}

/**
Expand Down
111 changes: 0 additions & 111 deletions chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,10 @@
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.view.ContextThemeWrapper;
import android.view.Gravity;
import android.view.View;
import android.view.View.OnAttachStateChangeListener;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.PopupWindow;
import android.widget.PopupWindow.OnDismissListener;

import org.chromium.base.ApplicationStatus;
import org.chromium.base.ContextUtils;
Expand All @@ -38,7 +33,6 @@
import org.chromium.base.UserDataHost;
import org.chromium.base.VisibleForTesting;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.task.PostTask;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.AppHooks;
import org.chromium.chrome.browser.ChromeActionModeCallback;
Expand All @@ -59,7 +53,6 @@
import org.chromium.chrome.browser.crypto.CipherFactory;
import org.chromium.chrome.browser.customtabs.CustomTabActivity;
import org.chromium.chrome.browser.document.ChromeLauncherActivity;
import org.chromium.chrome.browser.feature_engagement.TrackerFactory;
import org.chromium.chrome.browser.fullscreen.FullscreenManager;
import org.chromium.chrome.browser.fullscreen.FullscreenOptions;
import org.chromium.chrome.browser.infobar.InfoBarContainer;
Expand All @@ -84,13 +77,8 @@
import org.chromium.chrome.browser.tabmodel.TabReparentingParams;
import org.chromium.chrome.browser.tabmodel.TabSelectionType;
import org.chromium.chrome.browser.vr.VrModuleProvider;
import org.chromium.chrome.browser.widget.PulseDrawable;
import org.chromium.chrome.browser.widget.textbubble.TextBubble;
import org.chromium.components.dom_distiller.core.DomDistillerUrlUtils;
import org.chromium.components.embedder_support.view.ContentView;
import org.chromium.components.feature_engagement.EventConstants;
import org.chromium.components.feature_engagement.FeatureConstants;
import org.chromium.components.feature_engagement.Tracker;
import org.chromium.components.navigation_interception.InterceptNavigationDelegate;
import org.chromium.components.security_state.ConnectionSecurityLevel;
import org.chromium.content_public.browser.ChildProcessImportance;
Expand All @@ -99,7 +87,6 @@
import org.chromium.content_public.browser.ImeEventObserver;
import org.chromium.content_public.browser.LoadUrlParams;
import org.chromium.content_public.browser.SelectionPopupController;
import org.chromium.content_public.browser.UiThreadTaskTraits;
import org.chromium.content_public.browser.WebContents;
import org.chromium.content_public.browser.WebContentsAccessibility;
import org.chromium.content_public.common.BrowserControlsState;
Expand All @@ -109,7 +96,6 @@
import org.chromium.ui.base.PageTransition;
import org.chromium.ui.base.WindowAndroid;
import org.chromium.ui.mojom.WindowOpenDisposition;
import org.chromium.ui.widget.AnchoredPopupWindow;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
Expand Down Expand Up @@ -341,16 +327,6 @@ public class Tab
*/
private boolean mIsDetached;

/**
* The Text bubble used to display In Product help widget for download feature on videos.
*/
private TextBubble mDownloadIPHBubble;

/**
* The popup used to display the pulse around the download button on videos.
*/
private PopupWindow mPulsePopupWindow;

/** Whether or not the tab closing the tab can send the user back to the app that opened it. */
private boolean mIsAllowedToReturnToExternalApp;

Expand Down Expand Up @@ -1605,8 +1581,6 @@ public void destroy() {
for (TabObserver observer : mObservers) observer.onDestroyed(this);
mObservers.clear();

hideMediaDownloadInProductHelp();

mUserDataHost.destroy();

NativePage currentNativePage = mNativePage;
Expand Down Expand Up @@ -2751,13 +2725,6 @@ public void enableEmbeddedMediaExperience(boolean enabled) {
nativeEnableEmbeddedMediaExperience(mNativeTabAndroid, enabled);
}

/**
* Called when the orientation of the activity has changed.
*/
public void onOrientationChange() {
hideMediaDownloadInProductHelp();
}

/**
* Handle browser controls when a tab modal dialog is shown.
* @param isShowing Whether a tab modal dialog is showing.
Expand All @@ -2773,83 +2740,6 @@ public boolean areRendererInputEventsIgnored() {
return nativeAreRendererInputEventsIgnored(mNativeTabAndroid);
}

@CalledByNative
private void showMediaDownloadInProductHelp(int x, int y, int width, int height) {
Rect rect = new Rect(x, y, x + width, y + height);

// If we are not currently showing the widget, ask the tracker if we can show it.
if (mDownloadIPHBubble == null) {
Tracker tracker = TrackerFactory.getTrackerForProfile(Profile.getLastUsedProfile());
tracker.notifyEvent(EventConstants.MEDIA_DOWNLOAD_BUTTON_DISPLAYED);
if (!tracker.shouldTriggerHelpUI(FeatureConstants.MEDIA_DOWNLOAD_FEATURE)) {
// Inform native that the button was dismissed to notify the renderer that the
// request was rejected.
nativeMediaDownloadInProductHelpDismissed(mNativeTabAndroid);
return;
}

mDownloadIPHBubble = new TextBubble(getApplicationContext(), mContentView,
R.string.iph_media_download_text,
R.string.iph_media_download_accessibility_text, rect);
mDownloadIPHBubble.setDismissOnTouchInteraction(true);
mDownloadIPHBubble.addOnDismissListener(new OnDismissListener() {
@Override
public void onDismiss() {
PostTask.postTask(UiThreadTaskTraits.DEFAULT, new Runnable() {
@Override
public void run() {
hideMediaDownloadInProductHelp();
}
});
}
});
}

mDownloadIPHBubble.setPreferredVerticalOrientation(
AnchoredPopupWindow.VerticalOrientation.BELOW);
mDownloadIPHBubble.show();
createPulse(rect);
}

private void createPulse(Rect rect) {
if (mPulsePopupWindow == null) {
PulseDrawable pulseDrawable = PulseDrawable.createCircle(mThemedApplicationContext);
View view = new Button(getActivity());
view.setLayoutParams(new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
view.setBackground(pulseDrawable);

mPulsePopupWindow = new PopupWindow(getActivity());
mPulsePopupWindow.setBackgroundDrawable(null);
mPulsePopupWindow.setContentView(view);
mPulsePopupWindow.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
mPulsePopupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
mPulsePopupWindow.getContentView().setOnClickListener(
v -> hideMediaDownloadInProductHelp());
mPulsePopupWindow.showAtLocation(
getView(), Gravity.TOP | Gravity.START, rect.left, rect.top);
pulseDrawable.start();
}

mPulsePopupWindow.update(rect.left, rect.top, rect.width(), rect.height());
}

@CalledByNative
private void hideMediaDownloadInProductHelp() {
if (mPulsePopupWindow != null && mPulsePopupWindow.isShowing()) {
mPulsePopupWindow.dismiss();
mPulsePopupWindow = null;
}

if (mDownloadIPHBubble == null) return;

mDownloadIPHBubble.dismiss();
mDownloadIPHBubble = null;
Tracker tracker = TrackerFactory.getTrackerForProfile(Profile.getLastUsedProfile());
tracker.dismissed(FeatureConstants.MEDIA_DOWNLOAD_FEATURE);
nativeMediaDownloadInProductHelpDismissed(mNativeTabAndroid);
}

/**
* @return The publisher URL if the current page is hosted on a trusted CDN, or null otherwise.
*/
Expand Down Expand Up @@ -2900,6 +2790,5 @@ private native void nativeAttachToTabContentManager(long nativeTabAndroid,
private native void nativeSetPictureInPictureEnabled(long nativeTabAndroid, boolean enabled);
private native void nativeEnableEmbeddedMediaExperience(long nativeTabAndroid, boolean enabled);
private native void nativeAttachDetachedTab(long nativeTabAndroid);
private native void nativeMediaDownloadInProductHelpDismissed(long nativeTabAndroid);
private native boolean nativeAreRendererInputEventsIgnored(long nativeTabAndroid);
}
7 changes: 0 additions & 7 deletions chrome/android/java/strings/android_chrome_strings.grd
Original file line number Diff line number Diff line change
Expand Up @@ -3867,12 +3867,6 @@ However, you aren’t invisible. Going private doesn’t hide your browsing from
<message name="IDS_IPH_DATA_SAVER_DETAIL_ACCESSIBILITY_TEXT" desc="The in-product-help accessibility text to open data saver.">
See how much data you've saved from the More Options button
</message>
<message name="IDS_IPH_MEDIA_DOWNLOAD_TEXT" desc="The in-product-help message to download a video.">
Download videos to watch later
</message>
<message name="IDS_IPH_MEDIA_DOWNLOAD_ACCESSIBILITY_TEXT" desc="The in-product-help accessibility text to download a video.">
Download videos to watch later using the Download button
</message>
<message name="IDS_IPH_PREVIEWS_OMNIBOX_UI_TEXT" desc="The in-product-help text informing the user that the displayed page was modified to make it load faster or use less data. Prompts the user to tap the message and load the original, unaltered, page if they would like. The 'Lite page provided by Google.' sentence should match TC ID 373879247902731825">
Lite page provided by Google. Tap to load the original.
</message>
Expand All @@ -3886,7 +3880,6 @@ However, you aren’t invisible. Going private doesn’t hide your browsing from
Translate this page to any language from the More options button
</message>


<!-- Search Widget strings -->
<message name="IDS_SEARCH_WIDGET_DEFAULT" desc="Default text for the search widget">
Search
Expand Down
1 change: 0 additions & 1 deletion chrome/app/chrome_content_browser_overlay_manifest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ const service_manager::Manifest& GetChromeContentBrowserOverlayManifest() {
autofill::mojom::PasswordManagerDriver,
blink::mojom::BadgeService, blink::mojom::CredentialManager,
blink::mojom::InstalledAppProvider,
blink::mojom::MediaDownloadInProductHelp,
blink::mojom::ShareService,
blink::mojom::TextSuggestionHost,
chrome::mojom::OfflinePageAutoFetcher,
Expand Down
1 change: 0 additions & 1 deletion chrome/browser/android/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ include_rules = [
"+sandbox/linux/seccomp-bpf-helpers",
"+sandbox/sandbox_buildflags.h",
"+third_party/gvr-android-sdk",
"+third_party/blink/public/platform/media_download_in_product_help.mojom.h",
"+third_party/blink/public/platform/unhandled_tap_notifier.mojom.h",
]

Expand Down
Loading

0 comments on commit 8caf17f

Please sign in to comment.