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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabIntentDataProvider.java

Issue 1683533002: Herb: Show an icon allowing the user to open a tab in Chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ripping out back behavior yet again because people can't decide things Created 4 years, 10 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
Index: chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabIntentDataProvider.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabIntentDataProvider.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabIntentDataProvider.java
index 958835bffce6d6a4cbd3f465328a2df9b0974d27..90b43f611b2352590502fb736a1f8deac7a9f16b 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabIntentDataProvider.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabIntentDataProvider.java
@@ -26,6 +26,7 @@ import org.chromium.base.Log;
import org.chromium.base.VisibleForTesting;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.ChromeActivity;
+import org.chromium.chrome.browser.preferences.ChromePreferenceManager;
import org.chromium.chrome.browser.util.IntentUtils;
import org.chromium.chrome.browser.widget.TintedDrawable;
@@ -44,6 +45,13 @@ public class CustomTabIntentDataProvider {
*/
public static final String EXTRA_KEEP_ALIVE = "android.support.customtabs.extra.KEEP_ALIVE";
+ /**
+ * Extra used by Chrome to tell the CustomTabActivity to finish itself and open the current URL
+ * in the browser. Guarded explicitly for use only by PendingIntents with the Chrome package.
+ */
+ public static final String EXTRA_FINISH_AFTER_OPENING_IN_BROWSER =
+ "org.chromium.chrome.browser.customtabs.FINISH_AFTER_OPENING_IN_BROWSER";
+
private static final int MAX_CUSTOM_MENU_ITEMS = 5;
private static final String ANIMATION_BUNDLE_PREFIX =
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ? "android:activity." : "android:";
@@ -63,6 +71,7 @@ public class CustomTabIntentDataProvider {
private List<Pair<String, PendingIntent>> mMenuEntries = new ArrayList<>();
private Bundle mAnimationBundle;
private boolean mShowShareItem;
+ private boolean mFinishAfterOpeningInBrowser;
private CustomButtonParams mToolbarButton;
private List<CustomButtonParams> mBottombarButtons = new ArrayList<>(2);
// OnFinished listener for PendingIntents. Used for testing only.
@@ -74,6 +83,10 @@ public class CustomTabIntentDataProvider {
public CustomTabIntentDataProvider(Intent intent, Context context) {
if (intent == null) assert false;
mSession = IntentUtils.safeGetBinderExtra(intent, CustomTabsIntent.EXTRA_SESSION);
+ mFinishAfterOpeningInBrowser = !TextUtils.isEmpty(ChromePreferenceManager.getHerbFlavor())
+ && IntentUtils.safeGetBooleanExtra(
+ intent, EXTRA_FINISH_AFTER_OPENING_IN_BROWSER, false);
+
retrieveCustomButtons(intent, context);
retrieveToolbarColor(intent, context);
retrieveBottomBarColor(intent);
@@ -359,4 +372,11 @@ public class CustomTabIntentDataProvider {
void setPendingIntentOnFinishedForTesting(PendingIntent.OnFinished onFinished) {
mOnFinished = onFinished;
}
+
+ /**
+ * @return See {@link #EXTRA_FINISH_AFTER_OPENING_IN_BROWSER}.
+ */
+ public boolean finishAfterOpeningInBrowser() {
+ return mFinishAfterOpeningInBrowser;
+ }
}

Powered by Google App Engine
This is Rietveld 408576698