Index: chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java |
index a3cd9d92308fd0a280050a98af7381d9ce560f98..8fc3825cd5c841492f018a5497761dd9f94ce4bd 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java |
@@ -12,6 +12,7 @@ import android.content.Intent; |
import android.content.ServiceConnection; |
import android.content.pm.PackageManager; |
import android.content.res.Resources; |
+import android.graphics.Bitmap; |
import android.graphics.Point; |
import android.net.ConnectivityManager; |
import android.net.Uri; |
@@ -23,6 +24,7 @@ import android.os.IBinder; |
import android.os.Process; |
import android.os.RemoteException; |
import android.os.SystemClock; |
+import android.support.customtabs.CustomTabsIntent; |
import android.support.customtabs.ICustomTabsCallback; |
import android.support.customtabs.ICustomTabsService; |
import android.text.TextUtils; |
@@ -45,6 +47,7 @@ import org.chromium.chrome.browser.device.DeviceClassManager; |
import org.chromium.chrome.browser.init.ChromeBrowserInitializer; |
import org.chromium.chrome.browser.prerender.ExternalPrerenderHandler; |
import org.chromium.chrome.browser.profiles.Profile; |
+import org.chromium.chrome.browser.util.IntentUtils; |
import org.chromium.content.browser.ChildProcessLauncher; |
import org.chromium.content_public.browser.LoadUrlParams; |
import org.chromium.content_public.browser.WebContents; |
@@ -58,6 +61,8 @@ import java.util.Arrays; |
import java.util.HashMap; |
import java.util.List; |
import java.util.Map; |
+import java.util.concurrent.Callable; |
+import java.util.concurrent.ExecutionException; |
import java.util.concurrent.TimeUnit; |
import java.util.concurrent.atomic.AtomicBoolean; |
import java.util.concurrent.atomic.AtomicReference; |
@@ -374,6 +379,31 @@ public class CustomTabsConnection extends ICustomTabsService.Stub { |
return result; |
} |
+ @Override |
+ public boolean updateVisuals(final ICustomTabsCallback callback, Bundle bundle) { |
+ final Bundle actionButtonBundle = IntentUtils.safeGetBundle(bundle, |
+ CustomTabsIntent.EXTRA_ACTION_BUTTON_BUNDLE); |
+ if (actionButtonBundle == null) return false; |
+ |
+ final Bitmap bitmap = ActionButtonParams.tryParseBitmapFromBundle(mApplication, |
+ actionButtonBundle); |
+ final String description = ActionButtonParams |
+ .tryParseDescriptionFromBundle(actionButtonBundle); |
+ if (bitmap == null || description == null) return false; |
+ |
+ try { |
+ return ThreadUtils.runOnUiThreadBlocking(new Callable<Boolean>() { |
+ @Override |
+ public Boolean call() throws Exception { |
+ return CustomTabActivity.updateActionButton(callback.asBinder(), bitmap, |
+ description); |
+ } |
+ }); |
+ } catch (ExecutionException e) { |
+ return false; |
+ } |
+ } |
+ |
/** |
* Registers a launch of a |url| for a given |session|. |
* |