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

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

Issue 1203223003: Replace return button with close button on custom tab toolbar (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 6 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 2dd0ec14d4c9a1d205cf0d60941ef4542523b3dc..60d454eb3e180a275d3a14e9fa727a78db372db2 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
@@ -53,12 +53,29 @@ public class CustomTabIntentDataProvider {
/**
* Extra that changes the background color for the omnibox. colorRes is an int that specifies a
- * color
+ * color.
*/
public static final String EXTRA_CUSTOM_TABS_TOOLBAR_COLOR =
"android.support.CUSTOM_TABS:toolbar_color";
/**
+ * Extra int that specifies the style of the back button on the toolbar. Default is showing a
+ * cross icon.
+ */
+ public static final String EXTRA_CUSTOM_TABS_CLOSE_BUTTON_STYLE =
+ "android.support.CUSTOM_TABS:close_button_style";
+
+ /**
+ * Uses 'X'-like cross icon for close button.
+ */
+ public static final int CUSTOM_TAB_CLOSE_BUTTON_CROSS = 0;
+
+ /**
+ * Uses '<'-like chevron arrow icon for close button.
+ */
+ public static final int CUSTOM_TAB_CLOSE_BUTTON_ARROW = 1;
+
+ /**
* Extra int that specifies state for showing the page title. Default is showing only the domain
* and no information about the title.
*/
@@ -126,6 +143,7 @@ public class CustomTabIntentDataProvider {
private final long mSessionId;
private final Intent mKeepAliveServiceIntent;
private final int mTitleVisibilityState;
+ private final int mCloseButtonResId;
private int mToolbarColor;
private Bitmap mIcon;
private PendingIntent mActionButtonPendingIntent;
@@ -175,6 +193,17 @@ public class CustomTabIntentDataProvider {
mAnimationBundle = IntentUtils.safeGetBundleExtra(
intent, EXTRA_CUSTOM_TABS_EXIT_ANIMATION_BUNDLE);
+ int closeButtonStyle = IntentUtils.safeGetIntExtra(intent,
+ EXTRA_CUSTOM_TABS_CLOSE_BUTTON_STYLE, CUSTOM_TAB_CLOSE_BUTTON_CROSS);
+ switch(closeButtonStyle) {
+ case CustomTabIntentDataProvider.CUSTOM_TAB_CLOSE_BUTTON_ARROW:
+ mCloseButtonResId = R.drawable.btn_chevron_left;
+ break;
+ case CustomTabIntentDataProvider.CUSTOM_TAB_CLOSE_BUTTON_CROSS:
+ default:
+ mCloseButtonResId = R.drawable.btn_close;
+ }
+
mTitleVisibilityState = IntentUtils.safeGetIntExtra(
intent, EXTRA_CUSTOM_TABS_TITLE_VISIBILITY_STATE, CUSTOM_TAB_NO_TITLE);
}
@@ -219,6 +248,13 @@ public class CustomTabIntentDataProvider {
}
/**
+ * @return The resource id of the close button shown in the custom tab toolbar.
+ */
+ public int getCloseButtonIconResId() {
+ return mCloseButtonResId;
+ }
+
+ /**
* @return The title visibility state for the toolbar.
* Default is {@link CustomTabIntentDataProvider#CUSTOM_TAB_NO_TITLE}.
*/

Powered by Google App Engine
This is Rietveld 408576698