Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5462)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/webshare/ShareServiceImpl.java

Issue 2395963002: Web Share: Remove dead code for showing a warning prompt in incognito. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationDelegateImpl.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/webshare/ShareServiceImpl.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webshare/ShareServiceImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/webshare/ShareServiceImpl.java
index 89edc9e048bc6babec58d30e49fe768b368d7b11..c7e9c0b942badc90993e9a86e39ce09db8c813ce 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/webshare/ShareServiceImpl.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/webshare/ShareServiceImpl.java
@@ -6,13 +6,9 @@ package org.chromium.chrome.browser.webshare;
import android.app.Activity;
import android.content.ComponentName;
-import android.content.DialogInterface;
-import android.content.DialogInterface.OnCancelListener;
-import android.content.DialogInterface.OnClickListener;
import android.support.annotation.Nullable;
import org.chromium.base.metrics.RecordHistogram;
-import org.chromium.chrome.browser.externalnav.ExternalNavigationDelegateImpl;
import org.chromium.chrome.browser.share.ShareHelper;
import org.chromium.content.browser.ContentViewCore;
import org.chromium.content_public.browser.WebContents;
@@ -27,9 +23,6 @@ import org.chromium.webshare.mojom.ShareService;
*/
public class ShareServiceImpl implements ShareService {
private final Activity mActivity;
- // We no longer show a warning for incognito mode.
- // TODO(mgiuca): Remove this code (https://crrev.com/420564, https://crbug.com/645007).
- private static final boolean mIsIncognito = false;
// These numbers are written to histograms. Keep in sync with WebShareMethod enum in
// histograms.xml, and don't reuse or renumber entries (except for the _COUNT entry).
@@ -67,28 +60,6 @@ public class ShareServiceImpl implements ShareService {
return;
}
- if (mIsIncognito) {
- // In incognito mode, confirm with the user before sending intent externally.
- showIncognitoWarningDialog(title, text, url, callback);
- } else {
- startShare(title, text, url, callback);
- }
- }
-
- @Nullable
- private static Activity activityFromWebContents(@Nullable WebContents webContents) {
- if (webContents == null) return null;
-
- ContentViewCore contentViewCore = ContentViewCore.fromWebContents(webContents);
- if (contentViewCore == null) return null;
-
- WindowAndroid window = contentViewCore.getWindowAndroid();
- if (window == null) return null;
-
- return window.getActivity().get();
- }
-
- private void startShare(String title, String text, Url url, final ShareResponse callback) {
ShareHelper.TargetChosenCallback innerCallback = new ShareHelper.TargetChosenCallback() {
public void onTargetChosen(ComponentName chosenComponent) {
RecordHistogram.recordEnumeratedHistogram("WebShare.ShareOutcome",
@@ -97,33 +68,25 @@ public class ShareServiceImpl implements ShareService {
}
public void onCancel() {
- cancelShare(callback);
+ RecordHistogram.recordEnumeratedHistogram("WebShare.ShareOutcome",
+ WEBSHARE_OUTCOME_CANCELED, WEBSHARE_OUTCOME_COUNT);
+ callback.call("Share canceled");
}
};
ShareHelper.share(false, false, mActivity, title, text, url.url, null, null, innerCallback);
}
- private static void cancelShare(ShareResponse callback) {
- RecordHistogram.recordEnumeratedHistogram("WebShare.ShareOutcome",
- WEBSHARE_OUTCOME_CANCELED, WEBSHARE_OUTCOME_COUNT);
- callback.call("Share canceled");
- }
+ @Nullable
+ private static Activity activityFromWebContents(@Nullable WebContents webContents) {
+ if (webContents == null) return null;
- private void showIncognitoWarningDialog(final String title, final String text, final Url url,
- final ShareResponse callback) {
- ExternalNavigationDelegateImpl.showLeaveIncognitoWarningDialog(mActivity,
- new OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- startShare(title, text, url, callback);
- }
- },
- new OnCancelListener() {
- @Override
- public void onCancel(DialogInterface dialog) {
- cancelShare(callback);
- }
- });
+ ContentViewCore contentViewCore = ContentViewCore.fromWebContents(webContents);
+ if (contentViewCore == null) return null;
+
+ WindowAndroid window = contentViewCore.getWindowAndroid();
+ if (window == null) return null;
+
+ return window.getActivity().get();
}
}
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationDelegateImpl.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698