Index: chrome/android/java/src/org/chromium/chrome/browser/toolbar/BottomToolbarPhone.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/BottomToolbarPhone.java b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/BottomToolbarPhone.java |
index 4710a3418d8e74c2390fc95a98edc1a0ade6492e..725982127ebbb2e7924b3e80c3cd7f2e4cc5a10e 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/BottomToolbarPhone.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/BottomToolbarPhone.java |
@@ -23,6 +23,8 @@ import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet; |
import org.chromium.chrome.browser.widget.bottomsheet.BottomSheetMetrics; |
import org.chromium.chrome.browser.widget.bottomsheet.BottomSheetObserver; |
import org.chromium.chrome.browser.widget.bottomsheet.EmptyBottomSheetObserver; |
+import org.chromium.ui.resources.dynamics.BitmapDynamicResource; |
+import org.chromium.ui.resources.dynamics.DynamicResourceLoader; |
/** |
* Phone specific toolbar that exists at the bottom of the screen. |
@@ -85,6 +87,12 @@ public class BottomToolbarPhone extends ToolbarPhone { |
/** The dark version of the toolbar handle; this is the default handle to use. */ |
private final Bitmap mHandleDark; |
+ /** |
+ * The resource id for the dark version of the toolbar handle; used to register a dynamic |
+ * resource. |
+ */ |
+ private int mHandleDarkResourceId; |
+ |
/** A handle to the bottom sheet. */ |
private BottomSheet mBottomSheet; |
@@ -355,4 +363,21 @@ public class BottomToolbarPhone extends ToolbarPhone { |
otherToolbar.requestLayout(); |
} |
+ |
+ /** |
+ * Retrieve a resource id for the dark toolbar handle, registering it as a dynamic resource if |
+ * it has not been previously registered. |
+ * @param resourceLoader The {@link DynamicResourceLoader} used to register the handle bitmap. |
+ * @return The resource id for the toolbar handle. |
+ */ |
+ public int getHandleBitmapResourceId(DynamicResourceLoader resourceLoader) { |
+ if (mHandleDarkResourceId == 0) { |
+ mHandleDarkResourceId = ApiCompatibilityUtils.generateViewId(); |
+ BitmapDynamicResource handleDarkResource = |
+ new BitmapDynamicResource(mHandleDarkResourceId); |
+ handleDarkResource.setBitmap(mHandleDark); |
+ resourceLoader.registerResource(mHandleDarkResourceId, handleDarkResource); |
+ } |
+ return mHandleDarkResourceId; |
+ } |
} |