Commit 69b9f731 authored by John Abd-El-Malek's avatar John Abd-El-Malek Committed by Commit Bot

Fix exception when setting DownloadCallback in builds before 83.

This regressed in r753679.

Bug: 1066387, 1025603
Change-Id: I77702548bbf7d7606f4f4a9a3f5007e9773f193a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2130347
Commit-Queue: John Abd-El-Malek <jam@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Auto-Submit: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#755036}
parent 1347e7c0
......@@ -213,7 +213,7 @@ public class Profile {
return mCookieManager;
}
private static final class DownloadCallbackClientImpl extends IDownloadCallbackClient.Stub {
static final class DownloadCallbackClientImpl extends IDownloadCallbackClient.Stub {
private final DownloadCallback mCallback;
DownloadCallbackClientImpl(DownloadCallback callback) {
......
......@@ -44,6 +44,7 @@ public class Tab {
private final FindInPageController mFindInPageController;
private final ObserverList<TabCallback> mCallbacks;
private Browser mBrowser;
private Profile.DownloadCallbackClientImpl mDownloadCallbackClient;
private FullscreenCallbackClientImpl mFullscreenCallbackClient;
private NewTabCallback mNewTabCallback;
// Id from the remote side.
......@@ -111,12 +112,21 @@ public class Tab {
}
/**
* Deprecated. Use Profile.setDownloadCallback instead. For now this works by always using
* the last DownloadCallback that has been set by any tab in the same Profile.
* Deprecated. Use Profile.setDownloadCallback instead.
*/
public void setDownloadCallback(@Nullable DownloadCallback callback) {
ThreadCheck.ensureOnUiThread();
mBrowser.getProfile().setDownloadCallback(callback);
try {
if (callback != null) {
mDownloadCallbackClient = new Profile.DownloadCallbackClientImpl(callback);
mImpl.setDownloadCallbackClient(mDownloadCallbackClient);
} else {
mDownloadCallbackClient = null;
mImpl.setDownloadCallbackClient(null);
}
} catch (RemoteException e) {
throw new APICallException(e);
}
}
public void setErrorPageCallback(@Nullable ErrorPageCallback callback) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment