Chromium Code Reviews| 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..dbcdf0515fe74a3f6e2b9840630ef1d4573cf2d2 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 mCloseButtonRes; |
| 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: |
| + mCloseButtonRes = R.drawable.btn_chevron_left; |
| + break; |
| + case CustomTabIntentDataProvider.CUSTOM_TAB_CLOSE_BUTTON_CROSS: |
| + default: |
| + mCloseButtonRes = R.drawable.btn_close; |
|
Yusuf
2015/06/29 23:05:58
mCloseButtonResId
Ian Wen
2015/06/29 23:56:00
Done.
|
| + } |
| + |
| 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 getCloseButtonIconRes() { |
|
Yusuf
2015/06/29 23:05:58
getCloseButtonIconResId
Ian Wen
2015/06/29 23:56:00
Done.
|
| + return mCloseButtonRes; |
| + } |
| + |
| + /** |
| * @return The title visibility state for the toolbar. |
| * Default is {@link CustomTabIntentDataProvider#CUSTOM_TAB_NO_TITLE}. |
| */ |