Commit e275c1ef authored by Evan Stade's avatar Evan Stade Committed by Commit Bot

WebLayer: change name of receiver and AIDL interface for download notifs

This interface will be re-used for non-downloads notifications so it
gets a more generic name.

- DownloadBroadcastReceiver -> BroadcastReceiver
- onReceivedDownloadNotification -> onReceivedBroadcast

Bug: 1025662
Change-Id: Ib52429b7ef4ec1c4a85c05a7b7c13a4aa457b48d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2137588Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
Commit-Queue: Evan Stade <estade@chromium.org>
Cr-Commit-Position: refs/heads/master@{#757061}
parent 3ab3a892
......@@ -305,7 +305,7 @@ public final class WebLayerImpl extends IWebLayer.Stub {
}
@Override
public void onReceivedDownloadNotification(IObjectWrapper appContextWrapper, Intent intent) {
public void onReceivedBroadcast(IObjectWrapper appContextWrapper, Intent intent) {
StrictModeWorkaround.apply();
Context context = ObjectWrapper.unwrap(appContextWrapper, Context.class);
DownloadImpl.forwardIntent(context, intent, mProfileManager);
......
......@@ -70,8 +70,8 @@ interface IWebLayer {
in IObjectWrapper appContext,
in IObjectWrapper remoteContext) = 10;
// Forwards download intent notifications to the implementation.
void onReceivedDownloadNotification(in IObjectWrapper appContext, in Intent intent) = 11;
// Forwards broadcast from a notification to the implementation.
void onReceivedBroadcast(in IObjectWrapper appContext, in Intent intent) = 11;
// Added in Version 82.
void enumerateAllProfileNames(in IObjectWrapper valueCallback) = 12;
......
......@@ -54,7 +54,7 @@
android:resource="@xml/weblayer_file_paths" />
</provider>
<receiver android:name="org.chromium.weblayer.DownloadBroadcastReceiver"
<receiver android:name="org.chromium.weblayer.BroadcastReceiver"
android:exported="false">
<intent-filter>
<!-- these need to be in sync with DownloadImpl.java-->
......
......@@ -25,6 +25,7 @@ android_resources("client_resources") {
android_library("java") {
sources = [
"org/chromium/weblayer/BroadcastReceiver.java",
"org/chromium/weblayer/Browser.java",
"org/chromium/weblayer/BrowserFragment.java",
"org/chromium/weblayer/BrowsingDataType.java",
......@@ -37,7 +38,6 @@ android_library("java") {
"org/chromium/weblayer/CrashReporterCallback.java",
"org/chromium/weblayer/CrashReporterController.java",
"org/chromium/weblayer/Download.java",
"org/chromium/weblayer/DownloadBroadcastReceiver.java",
"org/chromium/weblayer/DownloadCallback.java",
"org/chromium/weblayer/DownloadError.java",
"org/chromium/weblayer/DownloadState.java",
......
......@@ -4,7 +4,6 @@
package org.chromium.weblayer;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.RemoteException;
......@@ -12,16 +11,15 @@ import android.os.RemoteException;
import org.chromium.weblayer_private.interfaces.ObjectWrapper;
/**
* Listens to events from the download system notifications.
* Listens to events from WebLayer-spawned notifications.
*/
public class DownloadBroadcastReceiver extends BroadcastReceiver {
class BroadcastReceiver extends android.content.BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
try {
WebLayer.loadAsync(context, webLayer -> {
try {
webLayer.getImpl().onReceivedDownloadNotification(
ObjectWrapper.wrap(context), intent);
webLayer.getImpl().onReceivedBroadcast(ObjectWrapper.wrap(context), intent);
} catch (RemoteException e) {
throw new RuntimeException(e);
}
......
......@@ -284,7 +284,7 @@ public class Profile {
// Intent objects need to be created in the client library so they can refer to the
// broadcast receiver that will handle them. The broadcast receiver needs to be in the
// client library because it's referenced in the manifest.
return new Intent(WebLayer.getAppContext(), DownloadBroadcastReceiver.class);
return new Intent(WebLayer.getAppContext(), BroadcastReceiver.class);
}
}
}
......@@ -609,7 +609,7 @@ public class WebLayer {
// Intent objects need to be created in the client library so they can refer to the
// broadcast receiver that will handle them. The broadcast receiver needs to be in the
// client library because it's referenced in the manifest.
return new Intent(WebLayer.getAppContext(), DownloadBroadcastReceiver.class);
return new Intent(WebLayer.getAppContext(), BroadcastReceiver.class);
}
}
}
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